mirror of https://github.com/procxx/kepka.git
				
				
				
			added photo switch by scroll gestures for os x in mediaview
This commit is contained in:
		
							parent
							
								
									dec5db074c
								
							
						
					
					
						commit
						7c20e4773d
					
				|  | @ -1194,6 +1194,23 @@ bool MediaView::event(QEvent *e) { | |||
| 				return true; | ||||
| 			} | ||||
| 		} | ||||
| 	} else if (e->type() == QEvent::Wheel) { | ||||
| 		QWheelEvent *ev = static_cast<QWheelEvent*>(e); | ||||
| 		if (ev->phase() == Qt::ScrollBegin) { | ||||
| 			_accumScroll = ev->angleDelta(); | ||||
| 			LOG(("Scrolling begin: %1 sum %2").arg(ev->angleDelta().x()).arg(_accumScroll.x())); | ||||
| 		} else { | ||||
| 			_accumScroll += ev->angleDelta(); | ||||
| 			if (ev->phase() == Qt::ScrollEnd) { | ||||
| 				LOG(("Scrolling end: %1 sum %2").arg(ev->angleDelta().x()).arg(_accumScroll.x())); | ||||
| 				if (ev->orientation() == Qt::Horizontal) { | ||||
| 					if (_accumScroll.x() * _accumScroll.x() > _accumScroll.y() * _accumScroll.y() && _accumScroll.x() != 0) { | ||||
| 						moveToPhoto(_accumScroll.x() > 0 ? -1 : 1); | ||||
| 					} | ||||
| 					_accumScroll = QPoint(); | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| 	return QWidget::event(e); | ||||
| } | ||||
|  |  | |||
|  | @ -135,6 +135,7 @@ private: | |||
| 	bool _touchPress, _touchMove, _touchRightButton; | ||||
| 	QTimer _touchTimer; | ||||
| 	QPoint _touchStart; | ||||
| 	QPoint _accumScroll; | ||||
| 
 | ||||
| 	QString _saveMsgFilename; | ||||
| 	uint64 _saveMsgStarted; | ||||
|  |  | |||
|  | @ -1248,7 +1248,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) | |||
| #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8 | ||||
|         if (QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_8) { | ||||
|             // On 10.8 and above, MayBegin is likely to happen.  We treat it the same as an actual begin. | ||||
|             if (phase == NSEventPhaseMayBegin) | ||||
| 			if (phase == NSEventPhaseMayBegin || phase == NSEventPhaseBegan) | ||||
|                 ph = Qt::ScrollBegin; | ||||
|         } else | ||||
| #endif | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue