iOS: send mouse events (from touch events) from EAGLView
Change-Id: Ia6c955f2c5bcde8e41d5908bfb8fd52bd449b3ec Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
This commit is contained in:
parent
ea1e5ccd62
commit
0dbee6a5e1
@ -47,6 +47,7 @@
|
|||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
class QIOSContext;
|
class QIOSContext;
|
||||||
|
class QIOSWindow;
|
||||||
|
|
||||||
@interface EAGLView : UIView <UIKeyInput>
|
@interface EAGLView : UIView <UIKeyInput>
|
||||||
{
|
{
|
||||||
@ -57,8 +58,10 @@ class QIOSContext;
|
|||||||
UIKeyboardType keyboardType;
|
UIKeyboardType keyboardType;
|
||||||
UIReturnKeyType returnKeyType;
|
UIReturnKeyType returnKeyType;
|
||||||
BOOL secureTextEntry;
|
BOOL secureTextEntry;
|
||||||
|
QIOSWindow *m_qioswindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (id)initWithQIOSWindow:(QIOSWindow *)qioswindow;
|
||||||
- (void)sendMouseEventForTouches:(NSSet *)touches withEvent:(UIEvent *)event fakeButtons:(Qt::MouseButtons)buttons;
|
- (void)sendMouseEventForTouches:(NSSet *)touches withEvent:(UIEvent *)event fakeButtons:(Qt::MouseButtons)buttons;
|
||||||
|
|
||||||
@property(nonatomic) UITextAutocapitalizationType autocapitalizationType;
|
@property(nonatomic) UITextAutocapitalizationType autocapitalizationType;
|
||||||
|
@ -58,6 +58,14 @@
|
|||||||
return [CAEAGLLayer class];
|
return [CAEAGLLayer class];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-(id)initWithQIOSWindow:(QIOSWindow *)qioswindow
|
||||||
|
{
|
||||||
|
if (self = [super init]) {
|
||||||
|
m_qioswindow = qioswindow;
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
- (id)initWithFrame:(CGRect)frame
|
- (id)initWithFrame:(CGRect)frame
|
||||||
{
|
{
|
||||||
if ((self = [super initWithFrame:frame])) {
|
if ((self = [super initWithFrame:frame])) {
|
||||||
@ -83,22 +91,13 @@
|
|||||||
|
|
||||||
- (void)sendMouseEventForTouches:(NSSet *)touches withEvent:(UIEvent *)event fakeButtons:(Qt::MouseButtons)buttons
|
- (void)sendMouseEventForTouches:(NSSet *)touches withEvent:(UIEvent *)event fakeButtons:(Qt::MouseButtons)buttons
|
||||||
{
|
{
|
||||||
Q_UNUSED(touches);
|
|
||||||
Q_UNUSED(event);
|
|
||||||
Q_UNUSED(buttons);
|
|
||||||
|
|
||||||
// FIXME: Reintroduce relation to UIWindow
|
|
||||||
qDebug() << __FUNCTION__ << "not implemented";
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
UITouch *touch = [touches anyObject];
|
UITouch *touch = [touches anyObject];
|
||||||
CGPoint locationInView = [touch locationInView:self];
|
CGPoint locationInView = [touch locationInView:self];
|
||||||
CGFloat scaleFactor = [self contentScaleFactor];
|
CGFloat scaleFactor = [self contentScaleFactor];
|
||||||
QPoint p(locationInView.x * scaleFactor, locationInView.y * scaleFactor);
|
QPoint p(locationInView.x * scaleFactor, locationInView.y * scaleFactor);
|
||||||
|
|
||||||
// TODO handle global touch point? for status bar?
|
// TODO handle global touch point? for status bar?
|
||||||
QWindowSystemInterface::handleMouseEvent(m_window->window(), (ulong)(event.timestamp*1000), p, p, buttons);
|
QWindowSystemInterface::handleMouseEvent(m_qioswindow->window(), (ulong)(event.timestamp*1000), p, p, buttons);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
|
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
|
||||||
@ -169,7 +168,7 @@ QT_BEGIN_NAMESPACE
|
|||||||
|
|
||||||
QIOSWindow::QIOSWindow(QWindow *window)
|
QIOSWindow::QIOSWindow(QWindow *window)
|
||||||
: QPlatformWindow(window)
|
: QPlatformWindow(window)
|
||||||
, m_view([[EAGLView alloc] init])
|
, m_view([[EAGLView alloc] initWithQIOSWindow:this])
|
||||||
{
|
{
|
||||||
UIApplication *uiApplication = [UIApplication sharedApplication];
|
UIApplication *uiApplication = [UIApplication sharedApplication];
|
||||||
if (uiApplication) {
|
if (uiApplication) {
|
||||||
|
Loading…
Reference in New Issue
Block a user