diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2013-04-10 14:43:07 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-04-19 20:10:46 +0200 |
commit | 155ff13bb6340101f8dcc28b5c48105dca9403cb (patch) | |
tree | e03991327de2e2c1a4d9971c79a90eac00df5ef7 /src/plugins/platforms/xcb | |
parent | da01deb0ac01b37656e021b9d5d696c5de7b0afb (diff) |
Implement QApplication::beep().
Invoke slot "beep" on QPlatformNativeInterface. Implement for
Windows and X11.
Task-number: QTBUG-30416
Change-Id: I2be651165b899e5147818a012001d354827bb090
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Diffstat (limited to 'src/plugins/platforms/xcb')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbnativeinterface.cpp | 14 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbnativeinterface.h | 3 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp index 08e72ed5ce..6241898462 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -57,6 +57,10 @@ #include "qglxintegration.h" #endif +#ifndef XCB_USE_XLIB +# include <stdio.h> +#endif + QT_BEGIN_NAMESPACE class QXcbResourceMap : public QMap<QByteArray, QXcbNativeInterface::ResourceType> @@ -84,6 +88,16 @@ QXcbNativeInterface::QXcbNativeInterface() : { } +void QXcbNativeInterface::beep() // For QApplication::beep() +{ +#ifdef XCB_USE_XLIB + ::Display *display = (::Display *)nativeResourceForScreen(QByteArrayLiteral("display"), QGuiApplication::primaryScreen()); + XBell(display, 0); +#else + fputc(7, stdout); +#endif +} + void *QXcbNativeInterface::nativeResourceForContext(const QByteArray &resourceString, QOpenGLContext *context) { QByteArray lowerCaseResource = resourceString.toLower(); diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.h b/src/plugins/platforms/xcb/qxcbnativeinterface.h index 75d42ac6b0..db0fa3e2ca 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.h +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.h @@ -53,6 +53,7 @@ class QXcbConnection; class QXcbNativeInterface : public QPlatformNativeInterface { + Q_OBJECT public: enum ResourceType { Display, @@ -89,6 +90,8 @@ public: static void *eglContextForContext(QOpenGLContext *context); static void *glxContextForContext(QOpenGLContext *context); + Q_INVOKABLE void beep(); + private: const QByteArray m_genericEventFilterType; |