summaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
authorNikita Kostovsky <nikita@kostovsky.me>2025-11-08 10:16:07 +0100
committerNikita Kostovsky <nikita@kostovsky.me>2025-11-08 10:16:07 +0100
commitc12766412cfbdbbe16b7d75ae2d82c1550a346ef (patch)
tree18afea741eafdc62e06a807d8421c0a0b48ea1de /main.cpp
parentc6b3b137e464cd2e16c046ca34be3c9e6e6fa1c9 (diff)
add sensor rect
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp17
1 files changed, 15 insertions, 2 deletions
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<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