+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+ if (event->device()->type() == QInputDevice::DeviceType::TouchPad) {
+ return false;
+ }
+
+ const QEventPoint &touchPoint0 = touchPoints.first();
+ const QEventPoint &touchPoint1 = touchPoints.last();
+
+ if (!pinch_zoom_active_ ||
+ (event->touchPointStates() & QEventPoint::Pressed)) {
+ pinch_offset0_ = (view_.offset() + view_.scale() * touchPoint0.position().x()).convert_to<double>();
+ pinch_offset1_ = (view_.offset() + view_.scale() * touchPoint1.position().x()).convert_to<double>();
+ pinch_zoom_active_ = true;
+ }
+
+ double w = touchPoint1.position().x() - touchPoint0.position().x();
+ if (abs(w) >= 1.0) {
+ const double scale =
+ fabs((pinch_offset1_ - pinch_offset0_) / w);
+ double offset = pinch_offset0_ - touchPoint0.position().x() * scale;
+ if (scale > 0)
+ view_.set_scale_offset(scale, offset);
+ }
+#else