diff options
| -rw-r--r-- | CMakeLists.txt | 2 | ||||
| -rw-r--r-- | ImageViewer.qml | 2 | ||||
| -rw-r--r-- | Main.qml | 22 | ||||
| -rw-r--r-- | main.cpp | 32 |
4 files changed, 23 insertions, 35 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 296bf37..30cf56d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.16) project(eurydice VERSION 0.1 LANGUAGES CXX) set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_STANDARD 23) +set(CMAKE_CXX_STANDARD 26) set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std:c++latest") set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std:c++latest") diff --git a/ImageViewer.qml b/ImageViewer.qml index 74c06e7..c5ed863 100644 --- a/ImageViewer.qml +++ b/ImageViewer.qml @@ -48,7 +48,7 @@ Page { height: flickable.contentHeight function updateImage() { - console.log("updateImage. visible: ", visible) + // console.log("updateImage. visible: ", visible) if (image.source == apiRoot + "/sensor/image") image.source = apiRoot + "/sensor/image2" else @@ -311,11 +311,11 @@ ApplicationWindow { Layout.minimumWidth: implicitWidth from: 10 - to: 30000000 + to: 94000000 stepSize: 100 editable: true - value: 3000000 + value: 68000 onValueChanged: writeParams() } @@ -550,7 +550,7 @@ ApplicationWindow { Layout.fillWidth: true - currentIndex: 0 + currentIndex: 1 Shortcut { sequence: "alt+1" @@ -585,6 +585,8 @@ ApplicationWindow { Layout.fillHeight: true Layout.fillWidth: true + property ListView iii: contentItem + Component.onCompleted: iii.maximumFlickVelocity = 10 * width // Layout.minimumWidth: mainWindowRoot.width * 0.8 currentIndex: tabBar.currentIndex @@ -593,19 +595,15 @@ 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) - } + + visible: SwipeView.isCurrentItem } QmlCustomPlot { id: pixelsQmlCustomPlot + visible: SwipeView.isCurrentItem + objectName: "pixelsCustomPlot" Label { @@ -628,6 +626,8 @@ ApplicationWindow { objectName: "profileCustomPlot" + visible: SwipeView.isCurrentItem + Label { anchors { top: parent.top @@ -5,7 +5,9 @@ #include <QQmlContext> #include <QTimer> #include <QtConcurrent/QtConcurrentRun> + #include "QmlCustomPlot.h" + #include <iostream> // #include <execution> @@ -46,7 +48,9 @@ int main( QVector<qreal> prev_y_profile; - for (int x = -640; x < 640; ++x) { + constexpr int img_width = 704; + for (int x = -img_width / 2; x < img_width / 2; ++x) + { double y = double(QRandomGenerator::global()->bounded(0, 80000)) / 100.; x_pixels << x; @@ -90,8 +94,8 @@ int main( manager, &QNetworkAccessManager::finished, [&](QNetworkReply *reply) { // qDebug() << "replyFinished"; if (reply->error()) { - qDebug() << "replyFinished:" << reply->errorString(); - qDebug() << "url was:" << reply->request().url(); + // qDebug() << "replyFinished:" << reply->errorString(); + // qDebug() << "url was:" << reply->request().url(); reply->deleteLater(); return; @@ -201,43 +205,27 @@ int main( prev_y_profile = y_pixels; } else if (reply->url().toString().endsWith("profile")) { - // qDebug() << "got profile"; auto json = QJsonDocument::fromJson(reply->readAll()).object(); auto jsonProfile = json["profile"].toObject(); auto jsonPointsMm = jsonProfile["pointsMm"].toArray(); - QList<qreal> x_profile(size_t(1280), 0.); - QList<qreal> y_profile(size_t(1280), 0.); - - static bool done{false}; - - if (!done) { - qDebug() << "got profile result:"; - qDebug() << jsonProfile; - } + QList<qreal> x_profile(size_t(img_width), 0.); + QList<qreal> y_profile(size_t(img_width), 0.); for (int i = 0; i < jsonPointsMm.count(); ++i) { - // qDebug() << jsonPointsMm.at(i); - // continue; const auto x = jsonPointsMm.at(i).toArray()[0].toDouble(); const auto z = jsonPointsMm.at(i).toArray()[1].toDouble(); if (qFuzzyIsNull(z) || std::isnan(z)) { - x_profile[i] = 0; + // x_profile[i] = 0; y_profile[i] = 0; continue; } x_profile[i] = x; y_profile[i] = z; - - if (!done) { - qDebug() << '\t' << x_profile[i] << y_profile[i]; - } } - done = true; - profileGraph->setData(x_profile, y_profile); // pixelsGraph->setData(x_profile, y_profile); |
