diff options
| -rw-r--r-- | CMakeLists.txt | 6 | ||||
| -rw-r--r-- | ImageViewer.qml | 6 | ||||
| -rw-r--r-- | Main.qml | 70 | ||||
| -rw-r--r-- | eurydice.qrc | 5 | ||||
| -rw-r--r-- | main.cpp | 6 | ||||
| -rw-r--r-- | qtquickcontrols2.conf | 4 |
6 files changed, 76 insertions, 21 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 3515951..296bf37 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,7 @@ qt_add_executable(appeurydice main.cpp QmlCustomPlot.h QmlCustomPlot.cpp + qtquickcontrols2.conf ) qt_add_qml_module(appeurydice @@ -27,6 +28,7 @@ qt_add_qml_module(appeurydice Main.qml QML_FILES request.js QML_FILES ImageViewer.qml + RESOURCES eurydice.qrc ) # Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1. @@ -44,8 +46,8 @@ target_link_libraries(appeurydice PRIVATE Qt6::Widgets Qt6::Quick - qcustomplot-qt6 - # qcustomplot + #qcustomplot-qt6 + qcustomplot ) target_compile_definitions(app${PROJECT_NAME} PRIVATE QCUSTOMPLOT_USE_LIBRARY) diff --git a/ImageViewer.qml b/ImageViewer.qml index 30a28e2..74c06e7 100644 --- a/ImageViewer.qml +++ b/ImageViewer.qml @@ -48,6 +48,7 @@ Page { height: flickable.contentHeight function updateImage() { + console.log("updateImage. visible: ", visible) if (image.source == apiRoot + "/sensor/image") image.source = apiRoot + "/sensor/image2" else @@ -69,6 +70,9 @@ Page { } onStatusChanged: { + if (!visible) + return; + // console.log(image.source) if (status == Image.Ready) { updateImage(); @@ -102,7 +106,7 @@ Page { interval: 1000 repeat: true - running: true + running: visible property int fpsCounter: 0 @@ -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 { diff --git a/eurydice.qrc b/eurydice.qrc new file mode 100644 index 0000000..4fbf17b --- /dev/null +++ b/eurydice.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/"> + <file>qtquickcontrols2.conf</file> + </qresource> +</RCC> @@ -13,7 +13,13 @@ int main( int argc, char *argv[]) { + qputenv("QT_SCALE_FACTOR", "1.5"); QApplication app(argc, argv); + qDebug() << qgetenv("QT_QUICK_CONTROLS_MATERIAL_VARIANT"); + + auto font = app.font(); + // font.setPointSize(font.pointSize() / 1.5); + app.setFont(font); QQmlApplicationEngine engine; diff --git a/qtquickcontrols2.conf b/qtquickcontrols2.conf new file mode 100644 index 0000000..7d4eccb --- /dev/null +++ b/qtquickcontrols2.conf @@ -0,0 +1,4 @@ +[Controls] +Style=Material +[Material] +Variant=Dense |
