Add switch button to enable trackpad gesture

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3291 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
scorpio810
2014-08-29 02:33:38 +00:00
parent d8217a7328
commit 2e6af1b2e9
4 changed files with 30 additions and 15 deletions

View File

@@ -579,31 +579,34 @@ void DiagramView::mouseReleaseEvent(QMouseEvent *e) {
else QGraphicsView::mouseReleaseEvent(e);
}
/**
* @brief DiagramView::gestures
* @return
*/
bool DiagramView::gestures() const {
return(QETApp::settings().value("diagramview/gestures", true).toBool());
}
/**
Manage wheel event of mouse
@param e QWheelEvent
*/
void DiagramView::wheelEvent(QWheelEvent *e) {
//Zoom and scrolling
if (e->buttons() != Qt::MidButton) {
#if defined(__APPLE__) && defined(__MACH__)
QAbstractScrollArea::wheelEvent(e);
}
#else
if (!(e -> modifiers() & Qt::ControlModifier)) {
if (e->buttons() != Qt::MidButton & !gestures ()) {
if (!(e -> modifiers() & Qt::ControlModifier )) {
if (e -> delta() > 0){
zoomIn();
}
else{
zoomOut();
}
}
else {
QAbstractScrollArea::wheelEvent(e);
}
}
#endif
}
} else {
QAbstractScrollArea::wheelEvent(e);
}
}