Cocoa platform plugin: Implement multitouch support.
Change-Id: Ic4b5bc4e48bd1e70cffedf15530b8a933037de66 Reviewed-on: http://codereview.qt-project.org/5153 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@nokia.com>
This commit is contained in:
parent
a201004830
commit
dc91f2f29b
@ -18,6 +18,7 @@ OBJECTIVE_SOURCES += main.mm \
|
||||
qcocoamenu.mm \
|
||||
qmenu_mac.mm \
|
||||
qcocoahelpers.mm \
|
||||
qmultitouch_mac.mm \
|
||||
|
||||
HEADERS += qcocoaintegration.h \
|
||||
qcocoabackingstore.h \
|
||||
@ -34,6 +35,7 @@ HEADERS += qcocoaintegration.h \
|
||||
qcocoamenu.h \
|
||||
qmenu_mac.h \
|
||||
qcocoahelpers.h \
|
||||
qmultitouch_mac_p.h \
|
||||
|
||||
RESOURCES += qcocoaresources.qrc
|
||||
|
||||
|
@ -90,6 +90,9 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw)
|
||||
|
||||
m_contentView = [[QNSView alloc] initWithQWindow:tlw];
|
||||
|
||||
// Accept touch events by default.
|
||||
[m_contentView setAcceptsTouchEvents:YES];
|
||||
|
||||
setGeometry(tlw->geometry());
|
||||
|
||||
[m_nsWindow setContentView:m_contentView];
|
||||
|
@ -43,6 +43,7 @@
|
||||
|
||||
#include "qnsview.h"
|
||||
#include "qcocoahelpers.h"
|
||||
#include "qmultitouch_mac_p.h"
|
||||
|
||||
#include <QtGui/QWindowSystemInterface>
|
||||
#include <QtCore/QDebug>
|
||||
@ -229,6 +230,34 @@
|
||||
[self handleMouseEvent:theEvent];
|
||||
}
|
||||
|
||||
- (void)touchesBeganWithEvent:(NSEvent *)event;
|
||||
{
|
||||
const NSTimeInterval timestamp = [event timestamp];
|
||||
const QList<QWindowSystemInterface::TouchPoint> points = QCocoaTouch::getCurrentTouchPointList(event, /*acceptSingleTouch= ### true or false?*/false);
|
||||
QWindowSystemInterface::handleTouchEvent(m_window, timestamp * 1000, QEvent::TouchBegin, QTouchEvent::TouchPad, points);
|
||||
}
|
||||
|
||||
- (void)touchesMovedWithEvent:(NSEvent *)event;
|
||||
{
|
||||
const NSTimeInterval timestamp = [event timestamp];
|
||||
const QList<QWindowSystemInterface::TouchPoint> points = QCocoaTouch::getCurrentTouchPointList(event, /*acceptSingleTouch= ### true or false?*/false);
|
||||
QWindowSystemInterface::handleTouchEvent(m_window, timestamp * 1000, QEvent::TouchUpdate, QTouchEvent::TouchPad, points);
|
||||
}
|
||||
|
||||
- (void)touchesEndedWithEvent:(NSEvent *)event;
|
||||
{
|
||||
const NSTimeInterval timestamp = [event timestamp];
|
||||
const QList<QWindowSystemInterface::TouchPoint> points = QCocoaTouch::getCurrentTouchPointList(event, /*acceptSingleTouch= ### true or false?*/false);
|
||||
QWindowSystemInterface::handleTouchEvent(m_window, timestamp * 1000, QEvent::TouchEnd, QTouchEvent::TouchPad, points);
|
||||
}
|
||||
|
||||
- (void)touchesCancelledWithEvent:(NSEvent *)event;
|
||||
{
|
||||
const NSTimeInterval timestamp = [event timestamp];
|
||||
const QList<QWindowSystemInterface::TouchPoint> points = QCocoaTouch::getCurrentTouchPointList(event, /*acceptSingleTouch= ### true or false?*/false);
|
||||
QWindowSystemInterface::handleTouchEvent(m_window, timestamp * 1000, QEvent::TouchEnd, QTouchEvent::TouchPad, points);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_WHEELEVENT
|
||||
- (void)scrollWheel:(NSEvent *)theEvent
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user