summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qwindow.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2013-04-10 13:55:50 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-04-19 20:10:46 +0200
commitda01deb0ac01b37656e021b9d5d696c5de7b0afb (patch)
tree6a689d5cddc689bc83c6a74c8dc5ef0f48359b64 /src/gui/kernel/qwindow.cpp
parent926086b9e37d45d09d5ce7d632a07583b40a8f70 (diff)
Implement alertion state for windows.
Add QWindow::alert() and QPlatformWindow::setAlertState(). Add logic to clear alertion state when the window becomes active. The platform plugins then only need to implement a setter and a cheap getter and need not handle activation. Prototypically implement X11 and Windows. Task-number: QTBUG-30416 Change-Id: Ia70c4722d812462a21f4034b7d52735c9f2bc49c Reviewed-by: Jerome Pasion <jerome.pasion@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Diffstat (limited to 'src/gui/kernel/qwindow.cpp')
-rw-r--r--src/gui/kernel/qwindow.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 2307df37ac..8c9bc575bd 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -58,6 +58,7 @@
#include <private/qevent_p.h>
+#include <QtCore/QTimer>
#include <QtCore/QDebug>
#include <QStyleHints>
@@ -2150,6 +2151,33 @@ QWindow *QWindow::fromWinId(WId id)
return window;
}
+/*!
+ Causes an alert to be shown for \a msec miliseconds. If \a msec is \c 0 (the
+ default), then the alert is shown indefinitely until the window becomes
+ active again.
+
+ In alert state, the window indicates that it demands attention, for example by
+ flashing or bouncing the taskbar entry.
+
+ \since 5.1
+*/
+
+void QWindow::alert(int msec)
+{
+ Q_D(QWindow);
+ if (!d->platformWindow || d->platformWindow->isAlertState())
+ return;
+ d->platformWindow->setAlertState(true);
+ if (d->platformWindow->isAlertState() && msec)
+ QTimer::singleShot(msec, this, SLOT(_q_clearAlert()));
+}
+
+void QWindowPrivate::_q_clearAlert()
+{
+ if (platformWindow && platformWindow->isAlertState())
+ platformWindow->setAlertState(false);
+}
+
#ifndef QT_NO_CURSOR
/*!
\brief set the cursor shape for this window
@@ -2233,3 +2261,5 @@ void QWindowPrivate::applyCursor()
#endif // QT_NO_CURSOR
QT_END_NAMESPACE
+
+#include "moc_qwindow.cpp"