diff options
| author | Nikita Kostovsky <nikita@kostovsky.me> | 2025-11-08 10:16:07 +0100 |
|---|---|---|
| committer | Nikita Kostovsky <nikita@kostovsky.me> | 2025-11-08 10:16:07 +0100 |
| commit | c12766412cfbdbbe16b7d75ae2d82c1550a346ef (patch) | |
| tree | 18afea741eafdc62e06a807d8421c0a0b48ea1de /main.cpp | |
| parent | c6b3b137e464cd2e16c046ca34be3c9e6e6fa1c9 (diff) | |
add sensor rect
Diffstat (limited to 'main.cpp')
| -rw-r--r-- | main.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -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<qreal> 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 |
