From c12766412cfbdbbe16b7d75ae2d82c1550a346ef Mon Sep 17 00:00:00 2001 From: Nikita Kostovsky Date: Sat, 8 Nov 2025 10:16:07 +0100 Subject: add sensor rect --- main.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index 328b75c..4633272 100644 --- a/main.cpp +++ b/main.cpp @@ -15,7 +15,7 @@ int main( int argc, char *argv[]) { - qputenv("QT_SCALE_FACTOR", "1.5"); + // qputenv("QT_SCALE_FACTOR", "1.5"); QApplication app(argc, argv); qDebug() << qgetenv("QT_QUICK_CONTROLS_MATERIAL_VARIANT"); @@ -49,6 +49,8 @@ int main( QVector prev_y_profile; constexpr int img_width = 704; + constexpr int img_height = 544; + for (int x = -img_width / 2; x < img_width / 2; ++x) { double y = double(QRandomGenerator::global()->bounded(0, 80000)) / 100.; @@ -58,6 +60,17 @@ int main( } prev_y_profile = y_pixels; + const auto sensorRect = new QCPItemRect{pixelsPlot}; + sensorRect->setPen(QPen{QColor{Qt::green}, 1}); + const auto srt = QCPItemPosition::ptPlotCoords; + sensorRect->topLeft->setType(srt); + sensorRect->topLeft->setCoords(QPointF{-img_width / 2, img_height}); + sensorRect->bottomRight->setType(srt); + sensorRect->bottomRight->setCoords(QPointF{img_width / 2, 0}); + sensorRect->setBrush(QColor(255, 0, 0, 18)); + sensorRect->setVisible(true); + sensorRect->setSelectable(false); + auto pixelsGraph = pixelsPlot->addGraph(); pixelsGraph->setPen(QPen(QBrush(Qt::red), 2)); pixelsGraph->setLineStyle(QCPGraph::lsNone); @@ -178,7 +191,7 @@ int main( qWarning() << "no pixelsCustomPlot"; } else { // qDebug() << "set lines. count is" << lines.count(); - pixelsCustomPlot->setLines(lines); + // pixelsCustomPlot->setLines(lines); } // 6 780 -- cgit v1.2.3-70-g09d2