Improve UI

This commit is contained in:
ItsDrike 2025-02-26 14:18:41 +01:00
parent cff0316c0a
commit 028f492c32
Signed by: ItsDrike
GPG key ID: FA2745890B7048C0

View file

@ -22,12 +22,14 @@ ApplicationWindow {
Layout.fillWidth: true Layout.fillWidth: true
ColumnLayout { ColumnLayout {
anchors.fill: parent
spacing: 10 spacing: 10
TextField { TextField {
id: numberInput id: numberInput
placeholderText: "Enter a number" placeholderText: "Enter a number"
// NOTE: We can't use the IntValidator here, since it doesn't support 64-bit values (long long) // NOTE: We can't use the IntValidator here, since it doesn't support 64-bit values (long long)
// Entering invalid numbers might cause unexpected behavior (will be fed to parseInt).
Layout.fillWidth: true Layout.fillWidth: true
font.pixelSize: 16 font.pixelSize: 16
onTextChanged: factorizationController.reset() onTextChanged: factorizationController.reset()
@ -61,7 +63,9 @@ ApplicationWindow {
GroupBox { GroupBox {
title: "Settings" title: "Settings"
Layout.fillWidth: true Layout.fillWidth: true
ColumnLayout { ColumnLayout {
anchors.fill: parent
spacing: 10 spacing: 10
RowLayout { RowLayout {
@ -97,29 +101,29 @@ ApplicationWindow {
} }
} }
ProgressBar {
Layout.fillWidth: true
from: 0
to: 100
value: factorizationController.progress
}
GroupBox { GroupBox {
title: "Current Status" title: "Current Status"
Layout.fillWidth: true Layout.fillWidth: true
ColumnLayout {
spacing: 5
Text { ColumnLayout {
text: "Current Factor: " + factorizationController.currentFactor anchors.fill: parent
font.pixelSize: 14 spacing: 5
Layout.alignment: Qt.AlignHCenter
}
Text { Text {
text: "Current Number (being factorized): " + factorizationController.curFactNumber text: "Current Number (being factorized): " + factorizationController.curFactNumber
font.pixelSize: 14 font.pixelSize: 14
Layout.alignment: Qt.AlignHCenter }
Text {
text: "Current Factor: " + factorizationController.currentFactor
font.pixelSize: 14
}
ProgressBar {
Layout.fillWidth: true
from: 0
to: 100
value: factorizationController.progress
} }
} }
} }
@ -137,7 +141,7 @@ ApplicationWindow {
} }
Text { Text {
text: factorizationController.useSqrtOptimization ? "Note: Only factors up to sqrt(n) are searched." : "Note: Searching all factors (slower)." text: factorizationController.useSqrtOptimization ? "Note: Only factors up to sqrt(n) are searched." : "Warning: Searching all factors (inefficient)."
font.pixelSize: 12 font.pixelSize: 12
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
} }