QNativeGestureEvent Mac OSX TrackPad finger Capture Operation zoom Solved. :-)
Solved
General and Desktop
-
At top from my QWidget QAbstractScrollArea i put grabGesture ...
this->grabGesture(Qt::SwipeGesture,Qt::DontStartGestureOnChildren); this->grabMouse(); this->setContentsMargins(0,0,0,0); this->setAcceptDrops(true);
after from main event( QEvent * e) i ast all QNativeGestureEvent
#include <QInputEvent>
#include <QNativeGestureEvent>& QNativeGestureEvent give value() of the swiped distance and more info about pos on screen
From the inomming event that i see .. its possibel to rotate paint QWidget.../// mac trackpad https://support.apple.com/en-us/HT204895 bool DrawDoument::gestureNative( QNativeGestureEvent * e ) { QTextStream xcout(stdout, QIODevice::WriteOnly); QString dir; if ( e->value() < 0) { distanceswip = distanceswip - e->value(); setZoom( scaleFaktor - TRACKPADSTEEPS ); /// SCALING_STEEP = 0.075555555 dir = "zoom in"; } else { distanceswip = distanceswip + e->value(); setZoom( scaleFaktor + TRACKPADSTEEPS ); dir = "zoom out"; } xcout << "-----------------swip (" << e->value() << ")" << dir << "x" << POINT_TO_MM(distanceswip) <<"\r"; e->accept(); return true; } bool DrawDoument::event( QEvent * e) { if ( e->type() == QEvent::NativeGesture ) { return gestureNative(static_cast<QNativeGestureEvent*>(e)); } strak = strak + 0.11; /// visual sleep? const int xmac = e->type(); QTextStream xcout(stdout, QIODevice::WriteOnly); xcout << "E," <<strak << ":->" << __FUNCTION__ << " - " << xmac <<"\r"; return QAbstractScrollArea::event(e); }
-
Thanks for sharing your findings !