diff options
author | Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com> | 2015-12-16 15:55:12 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com> | 2015-12-17 17:14:34 +0000 |
commit | 420438b5d304f815b65510fa8678beb08bcc4fd2 (patch) | |
tree | 30e87ff53de8d827bc0f43c13054c5972c10dec1 /src/plugins/platforms/xcb | |
parent | a1bb00becec04bfb4d775cd8056b6894f4eef198 (diff) |
iOS: Implement support for QApplication::beep()
Vibrates the device or plays an alert sound on devices
that do not support vibration.
The other implementations of beep() have been moved to
QPlatformIntegration as a proper API instead of having
them as invokables in QPlatformNativeInterface.
Change-Id: Ic597dbef04b46d49862b070e78ddfc0d763829a2
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: Kai Uwe Broulik <kde@privat.broulik.de>
Diffstat (limited to 'src/plugins/platforms/xcb')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbintegration.cpp | 13 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbintegration.h | 2 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbnativeinterface.cpp | 12 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbnativeinterface.h | 1 |
4 files changed, 15 insertions, 13 deletions
diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 19e8b1de7d..c42ea627a8 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -454,4 +454,17 @@ void QXcbIntegration::sync() } } +// For QApplication::beep() +void QXcbIntegration::beep() const +{ + QScreen *priScreen = QGuiApplication::primaryScreen(); + if (!priScreen) + return; + QPlatformScreen *screen = priScreen->handle(); + if (!screen) + return; + xcb_connection_t *connection = static_cast<QXcbScreen *>(screen)->xcb_connection(); + xcb_bell(connection, 0); +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/xcb/qxcbintegration.h b/src/plugins/platforms/xcb/qxcbintegration.h index 4e2a3c2bbd..f833015596 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.h +++ b/src/plugins/platforms/xcb/qxcbintegration.h @@ -104,6 +104,8 @@ public: void sync() Q_DECL_OVERRIDE; + void beep() const Q_DECL_OVERRIDE; + static QXcbIntegration *instance() { return m_instance; } private: diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp index 8a47fe1b43..1403cee622 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -92,18 +92,6 @@ QXcbNativeInterface::QXcbNativeInterface() : { } -void QXcbNativeInterface::beep() // For QApplication::beep() -{ - QScreen *priScreen = QGuiApplication::primaryScreen(); - if (!priScreen) - return; - QPlatformScreen *screen = priScreen->handle(); - if (!screen) - return; - xcb_connection_t *connection = static_cast<QXcbScreen *>(screen)->xcb_connection(); - xcb_bell(connection, 0); -} - static inline QXcbSystemTrayTracker *systemTrayTracker(const QScreen *s) { if (!s) diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.h b/src/plugins/platforms/xcb/qxcbnativeinterface.h index c823b474ab..fdda10e307 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.h +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.h @@ -108,7 +108,6 @@ public: static void setAppTime(QScreen *screen, xcb_timestamp_t time); static void setAppUserTime(QScreen *screen, xcb_timestamp_t time); - Q_INVOKABLE void beep(); Q_INVOKABLE bool systemTrayAvailable(const QScreen *screen) const; Q_INVOKABLE void setParentRelativeBackPixmap(QWindow *window); Q_INVOKABLE bool systrayVisualHasAlphaChannel(); |