From db510e98c16437bf00b1d2aac5b1effc4fda971e Mon Sep 17 00:00:00 2001 From: Nikita Kostovsky Date: Sun, 2 Feb 2025 22:15:27 +0100 Subject: minor ui fixes --- Main.qml | 70 +++++++++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 52 insertions(+), 18 deletions(-) (limited to 'Main.qml') diff --git a/Main.qml b/Main.qml index 7d26c9d..0725efc 100644 --- a/Main.qml +++ b/Main.qml @@ -34,6 +34,8 @@ ApplicationWindow { Material.theme: Material.Dark Material.accent: Material.Indigo + Material.containerStyle: Material.Filled + // Material.Variant: Material.Dense function requestExposureTime(type, uri) { console.log("request url: ", apiRoot + uri); @@ -95,7 +97,9 @@ ApplicationWindow { }); } - Component.onCompleted: readParams() + Component.onCompleted: { + readParams(); + } function writeParams() { var url = apiRoot + "/sensor/params"; @@ -180,14 +184,19 @@ ApplicationWindow { id: pane Layout.fillHeight: true - Layout.fillWidth: true - Layout.minimumWidth: 250 + // Layout.fillWidth: true + // Layout.minimumWidth: 250 + // implicitWidth: columnLayout.implicitWidth + // Layout.minimumWidth: columnLayout.implicitWidth - ColumnLayout { + GridLayout { id: columnLayout anchors.fill: parent + columns: 2 + rowSpacing: 0 + function color_by_value(value) { const limit = 0.02; @@ -202,16 +211,18 @@ ApplicationWindow { id: fpsLabel Layout.fillWidth: true - Layout.alignment: Qt.AlignTop + Layout.columnSpan: 2 + // Layout.alignment: Qt.AlignTop color: "green" } + /* Label { id: maxDiffLabel Layout.fillWidth: true - Layout.alignment: Qt.AlignTop + // Layout.alignment: Qt.AlignTop color: columnLayout.color_by_value(max_diff) text: "max diff: " + max_diff.toFixed(3) @@ -221,7 +232,7 @@ ApplicationWindow { id: maxDiffIdxLabel Layout.fillWidth: true - Layout.alignment: Qt.AlignTop + // Layout.alignment: Qt.AlignTop text: "max diff: " + max_diff_idx } @@ -230,7 +241,7 @@ ApplicationWindow { id: minDiffLabel Layout.fillWidth: true - Layout.alignment: Qt.AlignTop + // Layout.alignment: Qt.AlignTop color: columnLayout.color_by_value(-min_diff) text: "min diff: " + min_diff.toFixed(3) @@ -240,7 +251,7 @@ ApplicationWindow { id: minDiffIdxLabel Layout.fillWidth: true - Layout.alignment: Qt.AlignTop + // Layout.alignment: Qt.AlignTop text: "min diff: " + min_diff_idx } @@ -249,7 +260,7 @@ ApplicationWindow { id: avgDiffLabel Layout.fillWidth: true - Layout.alignment: Qt.AlignTop + // Layout.alignment: Qt.AlignTop color: columnLayout.color_by_value(avg_diff) text: "avg diff: " + avg_diff.toFixed(3) @@ -259,7 +270,7 @@ ApplicationWindow { id: medianhDiffLabel Layout.fillWidth: true - Layout.alignment: Qt.AlignTop + // Layout.alignment: Qt.AlignTop color: columnLayout.color_by_value(median_diff) text: "med. diff: " + median_diff.toFixed(3) @@ -267,21 +278,22 @@ ApplicationWindow { Label { Layout.fillWidth: true - Layout.alignment: Qt.AlignTop + // Layout.alignment: Qt.AlignTop text: "Pos: " + (parseFloat(encoderPosition) / 200.).toFixed(3) } Label { Layout.fillWidth: true - Layout.alignment: Qt.AlignTop + // Layout.alignment: Qt.AlignTop text: "Measurement: " + measurementCounter } - +*/ Label { Layout.fillWidth: true - Layout.alignment: Qt.AlignTop + Layout.columnSpan: 2 + // Layout.alignment: Qt.AlignTop text: "Timestamp (ms): " + (parseFloat(timestampUs % (1000 * 1000 * 1000)) / 1000.).toFixed(1) @@ -295,13 +307,15 @@ ApplicationWindow { id: exposureTimeSpinBox Layout.fillWidth: true + // onImplicitWidthChanged: console.log("azaza: ", implicitWidth) + Layout.minimumWidth: implicitWidth from: 10 to: 30000000 stepSize: 100 editable: true - value: 1000 + value: 3000000 onValueChanged: writeParams() } @@ -314,6 +328,8 @@ ApplicationWindow { Layout.fillWidth: true + Layout.minimumWidth: implicitWidth + from: 0 to: 50000 stepSize: 1 @@ -331,19 +347,22 @@ ApplicationWindow { id: gainSpinBox Layout.fillWidth: true + Layout.minimumWidth: implicitWidth from: 0 to: 254 stepSize: 1 editable: true - value: 3 + value: 2 onValueChanged: writeParams() } CheckBox { id: enableAutoExposureCheckbox + Layout.columnSpan: 2 + text: qsTr("Auto exposure") onCheckedChanged: writeParams() @@ -370,6 +389,7 @@ ApplicationWindow { id: feedRateSpinBox Layout.fillWidth: true + Layout.minimumWidth: implicitWidth from: 1 to: 500 @@ -382,6 +402,8 @@ ApplicationWindow { GridLayout { id: printerControlGridLayout + Layout.columnSpan: 2 + columns: 4 Label { @@ -497,6 +519,7 @@ ApplicationWindow { Button { Layout.fillWidth: true + Layout.columnSpan: 2 text: qsTr("Reset encoder") onClicked: resetEncoder() @@ -506,6 +529,7 @@ ApplicationWindow { Button { Layout.fillWidth: true + Layout.columnSpan: 2 text: qsTr("Start calibration") onClicked: startCalibration() @@ -557,9 +581,11 @@ ApplicationWindow { } SwipeView { + id: swipeView + Layout.fillHeight: true Layout.fillWidth: true - Layout.minimumWidth: mainWindowRoot.width * 0.8 + // Layout.minimumWidth: mainWindowRoot.width * 0.8 currentIndex: tabBar.currentIndex clip: true @@ -567,6 +593,14 @@ ApplicationWindow { ImageViewer { id: image + visible: SwipeView.index = SwipeView.currentIndex + onVisibleChanged: console.log("image viewer visible: ", visible, " index ", index, SwipeView.currentIndex) + property int iii: SwipeView.index + property int ccc: SwipeView.currentIndex + Connections { + target: swipeView + onCurrentIndexChanged: console.log("image viewer visible: ", visible, " index ", image.iii, image.ccc, swipeView.currentIndex) + } } QmlCustomPlot { -- cgit v1.2.3-70-g09d2