iOS: Add ability to get the UIView for a QWindow through QPlatformNativeInterface

Change-Id: Iab2742bbaa97ff345871ad07ef0162b12248506a
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
This commit is contained in:
Tor Arne Vestbø 2012-11-04 21:59:00 +01:00
parent 422eed16eb
commit a685df0584
2 changed files with 25 additions and 1 deletions

View File

@ -43,10 +43,11 @@
#define QPLATFORMINTEGRATION_UIKIT_H
#include <qpa/qplatformintegration.h>
#include <qpa/qplatformnativeinterface.h>
QT_BEGIN_NAMESPACE
class QIOSIntegration : public QPlatformIntegration
class QIOSIntegration : public QPlatformIntegration, public QPlatformNativeInterface
{
public:
QIOSIntegration();
@ -59,6 +60,9 @@ public:
QPlatformFontDatabase *fontDatabase() const;
QAbstractEventDispatcher *guiThreadEventDispatcher() const;
QPlatformNativeInterface *nativeInterface() const;
void *nativeResourceForWindow(const QByteArray &resource, QWindow *window);
private:
QPlatformFontDatabase *m_fontDatabase;

View File

@ -90,4 +90,24 @@ QPlatformFontDatabase * QIOSIntegration::fontDatabase() const
return m_fontDatabase;
}
QPlatformNativeInterface *QIOSIntegration::nativeInterface() const
{
return const_cast<QIOSIntegration *>(this);
}
void *QIOSIntegration::nativeResourceForWindow(const QByteArray &resource, QWindow *window)
{
if (!window || !window->handle())
return 0;
QByteArray lowerCaseResource = resource.toLower();
QIOSWindow *platformWindow = static_cast<QIOSWindow *>(window->handle());
if (lowerCaseResource == "uiview")
return platformWindow->nativeView();
return 0;
}
QT_END_NAMESPACE