From 028f492c32c4b9de0602282912ae76695637b63b Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Wed, 26 Feb 2025 14:18:41 +0100 Subject: [PATCH] Improve UI --- qml/Main.qml | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/qml/Main.qml b/qml/Main.qml index f0ae300..78dc6fc 100644 --- a/qml/Main.qml +++ b/qml/Main.qml @@ -22,12 +22,14 @@ ApplicationWindow { Layout.fillWidth: true ColumnLayout { + anchors.fill: parent spacing: 10 TextField { id: numberInput placeholderText: "Enter a number" // 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 font.pixelSize: 16 onTextChanged: factorizationController.reset() @@ -61,7 +63,9 @@ ApplicationWindow { GroupBox { title: "Settings" Layout.fillWidth: true + ColumnLayout { + anchors.fill: parent spacing: 10 RowLayout { @@ -97,29 +101,29 @@ ApplicationWindow { } } - ProgressBar { - Layout.fillWidth: true - from: 0 - to: 100 - value: factorizationController.progress - } - GroupBox { title: "Current Status" Layout.fillWidth: true - ColumnLayout { - spacing: 5 - Text { - text: "Current Factor: " + factorizationController.currentFactor - font.pixelSize: 14 - Layout.alignment: Qt.AlignHCenter - } + ColumnLayout { + anchors.fill: parent + spacing: 5 Text { text: "Current Number (being factorized): " + factorizationController.curFactNumber 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: 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 Layout.alignment: Qt.AlignHCenter }