QColorDialog: Stop color picking when application is deactivated
Fixes: QTBUG-134143 Pick-to: 6.10 Change-Id: Ibfeff4f861ac5c63f4bdd85db40b25eee51c4d31 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
This commit is contained in:
parent
4e57583f33
commit
38ce4ad2f8
@ -500,6 +500,12 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void applicationStateChanged(Qt::ApplicationState state)
|
||||||
|
{
|
||||||
|
if (state != Qt::ApplicationActive)
|
||||||
|
m_dp->releaseColorPicking();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QColorDialogPrivate *m_dp;
|
QColorDialogPrivate *m_dp;
|
||||||
};
|
};
|
||||||
@ -1625,6 +1631,8 @@ void QColorDialogPrivate::pickScreenColor()
|
|||||||
if (!colorPickingEventFilter)
|
if (!colorPickingEventFilter)
|
||||||
colorPickingEventFilter = new QColorPickingEventFilter(this, q);
|
colorPickingEventFilter = new QColorPickingEventFilter(this, q);
|
||||||
q->installEventFilter(colorPickingEventFilter);
|
q->installEventFilter(colorPickingEventFilter);
|
||||||
|
QObject::connect(qApp, &QGuiApplication::applicationStateChanged,
|
||||||
|
colorPickingEventFilter, &QColorPickingEventFilter::applicationStateChanged);
|
||||||
// If user pushes Escape, the last color before picking will be restored.
|
// If user pushes Escape, the last color before picking will be restored.
|
||||||
beforeScreenColorPicking = cs->currentColor();
|
beforeScreenColorPicking = cs->currentColor();
|
||||||
#ifndef QT_NO_CURSOR
|
#ifndef QT_NO_CURSOR
|
||||||
@ -1671,6 +1679,8 @@ void QColorDialogPrivate::releaseColorPicking()
|
|||||||
Q_Q(QColorDialog);
|
Q_Q(QColorDialog);
|
||||||
cp->setCrossVisible(true);
|
cp->setCrossVisible(true);
|
||||||
q->removeEventFilter(colorPickingEventFilter);
|
q->removeEventFilter(colorPickingEventFilter);
|
||||||
|
QObject::disconnect(qApp, &QGuiApplication::applicationStateChanged,
|
||||||
|
colorPickingEventFilter, &QColorPickingEventFilter::applicationStateChanged);
|
||||||
q->releaseMouse();
|
q->releaseMouse();
|
||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WIN32
|
||||||
updateTimer->stop();
|
updateTimer->stop();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user