]> git.sesse.net Git - nageru/commitdiff
Implement the coordinate display in the analyzer.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 13 May 2017 08:50:28 +0000 (10:50 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 13 May 2017 09:03:31 +0000 (11:03 +0200)
analyzer.cpp
ui_analyzer.ui

index 90d61ac9f740c1d1fce61ae4b03d73554a579331..7e1b4c6971a215edf1bc284f8415b58a7d0b4630 100644 (file)
@@ -227,12 +227,16 @@ bool Analyzer::eventFilter(QObject *watched, QEvent *event)
                        int y = lrint(mouse_event->y() * double(pixmap->height()) / ui->grabbed_frame_label->height());
                        x = std::min(x, pixmap->width() - 1);
                        y = std::min(y, pixmap->height() - 1);
+
+                       char buf[256];
+                       snprintf(buf, sizeof(buf), "Selected coordinate (x,y): (%d,%d)", x, y);
+                       ui->coord_label->setText(buf);
+
                        QRgb pixel = grabbed_image.pixel(x, y);
                        ui->red_label->setText(QString::fromStdString(to_string(qRed(pixel))));
                        ui->green_label->setText(QString::fromStdString(to_string(qGreen(pixel))));
                        ui->blue_label->setText(QString::fromStdString(to_string(qBlue(pixel))));
 
-                       char buf[256];
                        snprintf(buf, sizeof(buf), "#%02x%02x%02x", qRed(pixel), qGreen(pixel), qBlue(pixel));
                        ui->hex_label->setText(buf);
                }
index eba57ca3786df74e34721e7519414f986ee907a6..15e8e793fb2d8f3ad38ae4ce53102869f89f31ae 100644 (file)
       <item>
        <widget class="QLabel" name="coord_label">
         <property name="text">
-         <string>Selected coordinate (x,y): (123,456)</string>
+         <string>Selected coordinate (x,y): (none)</string>
         </property>
         <property name="alignment">
          <set>Qt::AlignCenter</set>