summaryrefslogtreecommitdiffstats
path: root/src/widgets/dialogs/qcolordialog_p.h
diff options
context:
space:
mode:
authorSérgio Martins <sergio.martins@kdab.com>2014-12-12 12:33:04 +0000
committerSérgio Martins <sergio.martins@kdab.com>2015-01-06 14:22:21 +0100
commit38a3158d2fe32dc55c6b6286fac58f782571294a (patch)
tree950ccb1fc456c6a4d8ba52e3b1310a8f983b3587 /src/widgets/dialogs/qcolordialog_p.h
parentb699ac070c01958cdc6599675f8335377ac45d3a (diff)
Windows: Fix QColorDialog's live updates while picking outside color
Microsoft's SetCapture() doesn't work on windows owned by other processes, so instead we use a timer. This is the same approach as used by qttools/src/pixeltool. The mouse move approach however is more elegant and doesn't hammer the CPU with QCursor::pos() calls when idle. For this reason the workaround is Q_OS_WIN only. Task-number: QTBUG-34538 Change-Id: I40a6f7df5bf2a3a29ade8fe4a92f5b5c4ece7efb Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Diffstat (limited to 'src/widgets/dialogs/qcolordialog_p.h')
-rw-r--r--src/widgets/dialogs/qcolordialog_p.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/widgets/dialogs/qcolordialog_p.h b/src/widgets/dialogs/qcolordialog_p.h
index af3ebe8925..2b501522f5 100644
--- a/src/widgets/dialogs/qcolordialog_p.h
+++ b/src/widgets/dialogs/qcolordialog_p.h
@@ -63,6 +63,7 @@ class QVBoxLayout;
class QPushButton;
class QWellArray;
class QColorPickingEventFilter;
+class QTimer;
class QColorDialogPrivate : public QDialogPrivate
{
@@ -75,7 +76,11 @@ public:
SetColorAll = ShowColor | SelectColor
};
- QColorDialogPrivate() : options(new QColorDialogOptions) {}
+ QColorDialogPrivate() : options(new QColorDialogOptions)
+#ifdef Q_OS_WIN
+ , updateTimer(0)
+#endif
+ {}
QPlatformColorDialogHelper *platformColorDialogHelper() const
{ return static_cast<QPlatformColorDialogHelper *>(platformHelper()); }
@@ -104,6 +109,8 @@ public:
void _q_newCustom(int, int);
void _q_newStandard(int, int);
void _q_pickScreenColor();
+ void _q_updateColorPicking();
+ void updateColorPicking(const QPoint &pos);
void releaseColorPicking();
bool handleColorPickingMouseMove(QMouseEvent *e);
bool handleColorPickingMouseButtonRelease(QMouseEvent *e);
@@ -136,6 +143,9 @@ public:
QPointer<QObject> receiverToDisconnectOnClose;
QByteArray memberToDisconnectOnClose;
+#ifdef Q_OS_WIN
+ QTimer *updateTimer;
+#endif
#ifdef Q_WS_MAC
void openCocoaColorPanel(const QColor &initial,