Commit a339e4a1 authored by Alessandro Portale's avatar Alessandro Portale Committed by Friedemann Kleint
Browse files

pixeltool: Show color under mouse in the window title


Hint which color will be picked when pressing 'c'.

Change-Id: If48392b288732b30d88bff18b3a3bbf5074947ed
Reviewed-by: default avatarFriedemann Kleint <Friedemann.Kleint@qt.io>
Showing with 4 additions and 3 deletions
......@@ -493,7 +493,7 @@ QSize QPixelTool::sizeHint() const
return m_initialSize;
}
static inline QString pixelToolTitle(QPoint pos)
static inline QString pixelToolTitle(QPoint pos, const QColor &currentColor)
{
if (QHighDpiScaling::isActive()) {
if (auto screen = QGuiApplication::screenAt(pos))
......@@ -501,7 +501,8 @@ static inline QString pixelToolTitle(QPoint pos)
}
return QCoreApplication::applicationName() + QLatin1String(" [")
+ QString::number(pos.x())
+ QLatin1String(", ") + QString::number(pos.y()) + QLatin1Char(']');
+ QLatin1String(", ") + QString::number(pos.y()) + QLatin1String("] ")
+ currentColor.name();
}
void QPixelTool::grabScreen()
......@@ -519,7 +520,7 @@ void QPixelTool::grabScreen()
return;
if (m_lastMousePos != mousePos)
setWindowTitle(pixelToolTitle(mousePos));
setWindowTitle(pixelToolTitle(mousePos, m_currentColor));
int w = int(width() / float(m_zoom));
int h = int(height() / float(m_zoom));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment