From fddf76f2ac12f219b99a8b877844a473cce27542 Mon Sep 17 00:00:00 2001 From: MyoungSeok Song Date: Thu, 29 Aug 2013 13:53:59 -0700 Subject: QNX: add nativeResourceForScreen Implemented nativeResourceForScreen api to return QObject* which can be used to connect foreignWindowCreated, foreignWindowClosed signal in QQnxScreen. Usecase is to connect signal in custom QML component as below QObject * obs = interface->nativeResourceForScreen("QObject*", screen); connect(obs, SIGNAL(foreignWindowCreated(void*)), d, SLOT(newForeignWindowCreated(void*))); Change-Id: I512c3b6d188a2e90ef7b8e89c413ca420a29dd9b Reviewed-by: Kevin Krammer Reviewed-by: Fabian Bumberger Reviewed-by: Rafael Roquetto --- src/plugins/platforms/qnx/qqnxnativeinterface.cpp | 8 ++++++++ src/plugins/platforms/qnx/qqnxnativeinterface.h | 1 + 2 files changed, 9 insertions(+) (limited to 'src/plugins/platforms/qnx') diff --git a/src/plugins/platforms/qnx/qqnxnativeinterface.cpp b/src/plugins/platforms/qnx/qqnxnativeinterface.cpp index e147ca72e5..4dd3444832 100644 --- a/src/plugins/platforms/qnx/qqnxnativeinterface.cpp +++ b/src/plugins/platforms/qnx/qqnxnativeinterface.cpp @@ -62,4 +62,12 @@ void *QQnxNativeInterface::nativeResourceForWindow(const QByteArray &resource, Q return 0; } +void *QQnxNativeInterface::nativeResourceForScreen(const QByteArray &resource, QScreen *screen) +{ + if (resource == "QObject*" && screen) + return static_cast(static_cast(screen->handle())); + + return 0; +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/qnx/qqnxnativeinterface.h b/src/plugins/platforms/qnx/qqnxnativeinterface.h index d84df205e5..6692da2576 100644 --- a/src/plugins/platforms/qnx/qqnxnativeinterface.h +++ b/src/plugins/platforms/qnx/qqnxnativeinterface.h @@ -50,6 +50,7 @@ class QQnxNativeInterface : public QPlatformNativeInterface { public: void *nativeResourceForWindow(const QByteArray &resource, QWindow *window); + void *nativeResourceForScreen(const QByteArray &resource, QScreen *screen); }; QT_END_NAMESPACE -- cgit v1.2.3 From 30a4114e60ae493c79d3139b46916165978f7b24 Mon Sep 17 00:00:00 2001 From: MyoungSeok Song Date: Thu, 29 Aug 2013 13:42:03 -0700 Subject: QNX: new signals for foreign windows creation/closing Implement the foreignWindowCreated and foreignWindow closed signals, emitted when foreign windows are created and closed, respectively. Change-Id: I72dd5380e6061f191eb8362fda5dd8fb8e9ed06b Reviewed-by: Thomas McGuire Reviewed-by: Kevin Krammer Reviewed-by: Rafael Roquetto --- src/plugins/platforms/qnx/qqnxscreen.cpp | 5 ++++- src/plugins/platforms/qnx/qqnxscreen.h | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'src/plugins/platforms/qnx') diff --git a/src/plugins/platforms/qnx/qqnxscreen.cpp b/src/plugins/platforms/qnx/qqnxscreen.cpp index 84721c9c2a..855da13681 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.cpp +++ b/src/plugins/platforms/qnx/qqnxscreen.cpp @@ -562,8 +562,10 @@ void QQnxScreen::addUnderlayWindow(screen_window_t window) void QQnxScreen::removeOverlayOrUnderlayWindow(screen_window_t window) { const int numRemoved = m_overlays.removeAll(window) + m_underlays.removeAll(window); - if (numRemoved > 0) + if (numRemoved > 0) { updateHierarchy(); + Q_EMIT foreignWindowClosed(window); + } } void QQnxScreen::newWindowCreated(void *window) @@ -597,6 +599,7 @@ void QQnxScreen::newWindowCreated(void *window) addUnderlayWindow(windowHandle); else addOverlayWindow(windowHandle); + Q_EMIT foreignWindowCreated(windowHandle); } } } diff --git a/src/plugins/platforms/qnx/qqnxscreen.h b/src/plugins/platforms/qnx/qqnxscreen.h index 6e8c2c6a60..42c490d443 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.h +++ b/src/plugins/platforms/qnx/qqnxscreen.h @@ -98,6 +98,10 @@ public: QPlatformCursor *cursor() const; +Q_SIGNALS: + void foreignWindowCreated(void *window); + void foreignWindowClosed(void *window); + public Q_SLOTS: void setRotation(int rotation); void newWindowCreated(void *window); -- cgit v1.2.3