iOS: add UIView category to get the QWindow it represents
Adding a simple way to get the QWindow pointer from any UIView makes writing code where you only have UIView pointers a bit easier. Perhaps we should also investigate if it is worthwhile to make this category public to the application, to further enhance working in a mixed environment. Change-Id: Ic263003dc7683a8d976024cbbbc2558e8472a790 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>bb10
parent
bbb8db9bdb
commit
646b1fd2b6
|
|
@ -49,6 +49,10 @@
|
|||
class QIOSContext;
|
||||
class QIOSWindow;
|
||||
|
||||
@interface UIView (QIOS)
|
||||
@property(readonly) QWindow *qwindow;
|
||||
@end
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QIOSWindow : public QPlatformWindow
|
||||
|
|
|
|||
|
|
@ -209,6 +209,17 @@
|
|||
|
||||
@end
|
||||
|
||||
@implementation UIView (QIOS)
|
||||
|
||||
- (QWindow *)qwindow
|
||||
{
|
||||
if ([self isKindOfClass:[EAGLView class]])
|
||||
return static_cast<EAGLView *>(self)->m_qioswindow->window();
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QIOSWindow::QIOSWindow(QWindow *window)
|
||||
|
|
|
|||
Loading…
Reference in New Issue