diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2017-06-08 09:11:39 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2017-06-08 09:11:39 +0200 |
commit | 38be5b605a844693bb93d24fab8c721bec273003 (patch) | |
tree | bd8f5271078bca73acb1c33d7ee6f6f5a02b6a59 /src/quicktemplates2 | |
parent | 20d141034b48ae73eee70743dc410d35491cd00f (diff) | |
parent | a5f8ceee8547c3447675d1c4e70f5706bbd2bd99 (diff) |
Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
src/imports/controls/doc/src/qtquickcontrols2-index.qdoc
src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc
src/quicktemplates2/qquickapplicationwindow.cpp
src/quicktemplates2/qquickmenu.cpp
src/quicktemplates2/qquickmenu_p.h
src/quicktemplates2/qquickpopup.cpp
tests/auto/auto.pro
Change-Id: I856a022d38abd84763127539f46ef032ddc53c3d
Diffstat (limited to 'src/quicktemplates2')
28 files changed, 121 insertions, 12 deletions
diff --git a/src/quicktemplates2/configure.json b/src/quicktemplates2/configure.json index 45899e1f..030e668b 100644 --- a/src/quicktemplates2/configure.json +++ b/src/quicktemplates2/configure.json @@ -7,6 +7,12 @@ "purpose": "Provides support for hover effects.", "section": "Quick Templates 2", "output": [ "privateFeature" ] + }, + "quicktemplates2-multitouch": { + "label": "Multi-touch support", + "purpose": "Provides support for multi-touch.", + "section": "Quick Templates 2", + "output": [ "privateFeature" ] } }, @@ -14,7 +20,8 @@ { "section": "Qt Quick Templates 2", "entries": [ - "quicktemplates2-hover" + "quicktemplates2-hover", + "quicktemplates2-multitouch" ] } ] diff --git a/src/quicktemplates2/qquickapplicationwindow.cpp b/src/quicktemplates2/qquickapplicationwindow.cpp index ff062259..a6523553 100644 --- a/src/quicktemplates2/qquickapplicationwindow.cpp +++ b/src/quicktemplates2/qquickapplicationwindow.cpp @@ -36,7 +36,7 @@ #include "qquickapplicationwindow_p.h" #include "qquickoverlay_p.h" -#include "qquickpopup_p.h" +#include "qquickpopup_p_p.h" #include "qquickcontrol_p_p.h" #include "qquicktextarea_p.h" #include "qquicktextfield_p.h" @@ -179,6 +179,8 @@ public: void _q_updateActiveFocus(); void setActiveFocusControl(QQuickItem *item); + static void contentData_append(QQmlListProperty<QObject> *prop, QObject *obj); + bool complete; QQuickItem *background; QQuickItem *contentItem; @@ -268,7 +270,6 @@ void QQuickApplicationWindowPrivate::updateFont(const QFont &f) QQuickControlPrivate::updateFontRecur(q->QQuickWindow::contentItem(), f); - // TODO: internal QQuickPopupManager that provides reliable access to all QQuickPopup instances const QList<QQuickPopup *> popups = q->findChildren<QQuickPopup *>(); for (QQuickPopup *popup : popups) QQuickControlPrivate::get(static_cast<QQuickControl *>(popup->popupItem()))->inheritFont(f); @@ -340,6 +341,15 @@ void QQuickApplicationWindowPrivate::setActiveFocusControl(QQuickItem *control) } } +void QQuickApplicationWindowPrivate::contentData_append(QQmlListProperty<QObject> *prop, QObject *obj) +{ + QQuickItemPrivate::data_append(prop, obj); + + // associate "top-level" popups with the window as soon as they are added to the default property + if (QQuickPopup *popup = qobject_cast<QQuickPopup *>(obj)) + QQuickPopupPrivate::get(popup)->setWindow(static_cast<QQuickApplicationWindow *>(prop->data)); +} + QQuickApplicationWindow::QQuickApplicationWindow(QWindow *parent) : QQuickWindowQmlImpl(parent), d_ptr(new QQuickApplicationWindowPrivate) { @@ -539,7 +549,11 @@ void QQuickApplicationWindow::setFooter(QQuickItem *footer) */ QQmlListProperty<QObject> QQuickApplicationWindow::contentData() { - return QQuickItemPrivate::get(contentItem())->data(); + return QQmlListProperty<QObject>(contentItem(), this, + QQuickApplicationWindowPrivate::contentData_append, + QQuickItemPrivate::data_count, + QQuickItemPrivate::data_at, + QQuickItemPrivate::data_clear); } /*! @@ -670,7 +684,6 @@ void QQuickApplicationWindow::resetFont() setFont(QFont()); } - /*! \qmlproperty Locale QtQuick.Controls::ApplicationWindow::locale diff --git a/src/quicktemplates2/qquickcontrol.cpp b/src/quicktemplates2/qquickcontrol.cpp index 06f8c8a2..dca50244 100644 --- a/src/quicktemplates2/qquickcontrol.cpp +++ b/src/quicktemplates2/qquickcontrol.cpp @@ -144,6 +144,7 @@ QQuickControlPrivate::~QQuickControlPrivate() #endif } +#if QT_CONFIG(quicktemplates2_multitouch) bool QQuickControlPrivate::acceptTouch(const QTouchEvent::TouchPoint &point) { if (point.id() == touchId) @@ -156,6 +157,7 @@ bool QQuickControlPrivate::acceptTouch(const QTouchEvent::TouchPoint &point) return false; } +#endif void QQuickControlPrivate::handlePress(const QPointF &) { @@ -1474,6 +1476,7 @@ void QQuickControl::mouseUngrabEvent() d->handleUngrab(); } +#if QT_CONFIG(quicktemplates2_multitouch) void QQuickControl::touchEvent(QTouchEvent *event) { Q_D(QQuickControl); @@ -1528,6 +1531,7 @@ void QQuickControl::touchUngrabEvent() Q_D(QQuickControl); d->handleUngrab(); } +#endif #if QT_CONFIG(wheelevent) void QQuickControl::wheelEvent(QWheelEvent *event) diff --git a/src/quicktemplates2/qquickcontrol_p.h b/src/quicktemplates2/qquickcontrol_p.h index 5207d46c..eaf00ced 100644 --- a/src/quicktemplates2/qquickcontrol_p.h +++ b/src/quicktemplates2/qquickcontrol_p.h @@ -193,8 +193,10 @@ protected: void mouseMoveEvent(QMouseEvent *event) override; void mouseReleaseEvent(QMouseEvent *event) override; void mouseUngrabEvent() override; +#if QT_CONFIG(quicktemplates2_multitouch) void touchEvent(QTouchEvent *event) override; void touchUngrabEvent() override; +#endif #if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent *event) override; #endif diff --git a/src/quicktemplates2/qquickcontrol_p_p.h b/src/quicktemplates2/qquickcontrol_p_p.h index 54346016..e990e44f 100644 --- a/src/quicktemplates2/qquickcontrol_p_p.h +++ b/src/quicktemplates2/qquickcontrol_p_p.h @@ -76,7 +76,9 @@ public: return control->d_func(); } +#if QT_CONFIG(quicktemplates2_multitouch) virtual bool acceptTouch(const QTouchEvent::TouchPoint &point); +#endif virtual void handlePress(const QPointF &point); virtual void handleMove(const QPointF &point); virtual void handleRelease(const QPointF &point); diff --git a/src/quicktemplates2/qquickdial.cpp b/src/quicktemplates2/qquickdial.cpp index 7e740ade..bdbfb22d 100644 --- a/src/quicktemplates2/qquickdial.cpp +++ b/src/quicktemplates2/qquickdial.cpp @@ -666,6 +666,7 @@ void QQuickDial::mouseMoveEvent(QMouseEvent *event) QQuickControl::mouseMoveEvent(event); } +#if QT_CONFIG(quicktemplates2_multitouch) void QQuickDial::touchEvent(QTouchEvent *event) { Q_D(QQuickDial); @@ -702,6 +703,7 @@ void QQuickDial::touchEvent(QTouchEvent *event) break; } } +#endif #if QT_CONFIG(wheelevent) void QQuickDial::wheelEvent(QWheelEvent *event) diff --git a/src/quicktemplates2/qquickdial_p.h b/src/quicktemplates2/qquickdial_p.h index 1a6d70fd..959cb154 100644 --- a/src/quicktemplates2/qquickdial_p.h +++ b/src/quicktemplates2/qquickdial_p.h @@ -136,7 +136,9 @@ protected: void keyReleaseEvent(QKeyEvent *event) override; void mousePressEvent(QMouseEvent *event) override; void mouseMoveEvent(QMouseEvent *event) override; +#if QT_CONFIG(quicktemplates2_multitouch) void touchEvent(QTouchEvent *event) override; +#endif #if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent *event) override; #endif diff --git a/src/quicktemplates2/qquickdrawer.cpp b/src/quicktemplates2/qquickdrawer.cpp index 8159f05e..66c84ea2 100644 --- a/src/quicktemplates2/qquickdrawer.cpp +++ b/src/quicktemplates2/qquickdrawer.cpp @@ -278,6 +278,7 @@ bool QQuickDrawerPrivate::startDrag(QEvent *event) } break; +#if QT_CONFIG(quicktemplates2_multitouch) case QEvent::TouchBegin: case QEvent::TouchUpdate: for (const QTouchEvent::TouchPoint &point : static_cast<QTouchEvent *>(event)->touchPoints()) { @@ -288,6 +289,7 @@ bool QQuickDrawerPrivate::startDrag(QEvent *event) } } break; +#endif default: break; @@ -340,6 +342,7 @@ bool QQuickDrawerPrivate::grabMouse(QQuickItem *item, QMouseEvent *event) return overThreshold; } +#if QT_CONFIG(quicktemplates2_multitouch) bool QQuickDrawerPrivate::grabTouch(QQuickItem *item, QTouchEvent *event) { Q_Q(QQuickDrawer); @@ -385,6 +388,7 @@ bool QQuickDrawerPrivate::grabTouch(QQuickItem *item, QTouchEvent *event) return overThreshold; } +#endif static const qreal openCloseVelocityThreshold = 300; @@ -672,8 +676,10 @@ bool QQuickDrawer::childMouseEventFilter(QQuickItem *child, QEvent *event) { Q_D(QQuickDrawer); switch (event->type()) { +#if QT_CONFIG(quicktemplates2_multitouch) case QEvent::TouchUpdate: return d->grabTouch(child, static_cast<QTouchEvent *>(event)); +#endif case QEvent::MouseMove: return d->grabMouse(child, static_cast<QMouseEvent *>(event)); case QEvent::MouseButtonPress: @@ -695,8 +701,10 @@ bool QQuickDrawer::overlayEvent(QQuickItem *item, QEvent *event) { Q_D(QQuickDrawer); switch (event->type()) { +#if QT_CONFIG(quicktemplates2_multitouch) case QEvent::TouchUpdate: return d->grabTouch(item, static_cast<QTouchEvent *>(event)); +#endif case QEvent::MouseMove: return d->grabMouse(item, static_cast<QMouseEvent *>(event)); default: @@ -705,11 +713,13 @@ bool QQuickDrawer::overlayEvent(QQuickItem *item, QEvent *event) return QQuickPopup::overlayEvent(item, event); } +#if QT_CONFIG(quicktemplates2_multitouch) void QQuickDrawer::touchEvent(QTouchEvent *event) { Q_D(QQuickDrawer); d->grabTouch(d->popupItem, event); } +#endif void QQuickDrawer::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) { diff --git a/src/quicktemplates2/qquickdrawer_p.h b/src/quicktemplates2/qquickdrawer_p.h index 9ab1c4ef..3ec007df 100644 --- a/src/quicktemplates2/qquickdrawer_p.h +++ b/src/quicktemplates2/qquickdrawer_p.h @@ -88,7 +88,9 @@ protected: bool childMouseEventFilter(QQuickItem *child, QEvent *event) override; void mouseMoveEvent(QMouseEvent *event) override; bool overlayEvent(QQuickItem *item, QEvent *event) override; +#if QT_CONFIG(quicktemplates2_multitouch) void touchEvent(QTouchEvent *event) override; +#endif void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override; diff --git a/src/quicktemplates2/qquickdrawer_p_p.h b/src/quicktemplates2/qquickdrawer_p_p.h index 110aa350..92de9010 100644 --- a/src/quicktemplates2/qquickdrawer_p_p.h +++ b/src/quicktemplates2/qquickdrawer_p_p.h @@ -74,7 +74,9 @@ public: bool startDrag(QEvent *event); bool grabMouse(QQuickItem *item, QMouseEvent *event); +#if QT_CONFIG(quicktemplates2_multitouch) bool grabTouch(QQuickItem *item, QTouchEvent *event); +#endif bool handlePress(QQuickItem* item, const QPointF &point, ulong timestamp) override; bool handleMove(QQuickItem* item, const QPointF &point, ulong timestamp) override; diff --git a/src/quicktemplates2/qquickmenu.cpp b/src/quicktemplates2/qquickmenu.cpp index 781bd6da..fa6b88ef 100644 --- a/src/quicktemplates2/qquickmenu.cpp +++ b/src/quicktemplates2/qquickmenu.cpp @@ -806,6 +806,11 @@ void QQuickMenu::keyReleaseEvent(QKeyEvent *event) item->forceActiveFocus(); } +QFont QQuickMenu::defaultFont() const +{ + return QQuickControlPrivate::themeFont(QPlatformTheme::MenuFont); +} + QPalette QQuickMenu::defaultPalette() const { return QQuickControlPrivate::themePalette(QPlatformTheme::MenuPalette); diff --git a/src/quicktemplates2/qquickmenu_p.h b/src/quicktemplates2/qquickmenu_p.h index 5dffa898..04186f1a 100644 --- a/src/quicktemplates2/qquickmenu_p.h +++ b/src/quicktemplates2/qquickmenu_p.h @@ -101,6 +101,7 @@ Q_SIGNALS: Q_REVISION(3) void delegateChanged(); protected: + QFont defaultFont() const override; QPalette defaultPalette() const override; #if QT_CONFIG(accessibility) diff --git a/src/quicktemplates2/qquickoverlay.cpp b/src/quicktemplates2/qquickoverlay.cpp index 15104808..a4aaa60d 100644 --- a/src/quicktemplates2/qquickoverlay.cpp +++ b/src/quicktemplates2/qquickoverlay.cpp @@ -276,6 +276,7 @@ bool QQuickOverlayPrivate::handleMouseEvent(QQuickItem *source, QMouseEvent *eve return false; } +#if QT_CONFIG(quicktemplates2_multitouch) bool QQuickOverlayPrivate::handleTouchEvent(QQuickItem *source, QTouchEvent *event, QQuickPopup *target) { bool handled = false; @@ -309,6 +310,7 @@ bool QQuickOverlayPrivate::handleTouchEvent(QQuickItem *source, QTouchEvent *eve return handled; } +#endif void QQuickOverlayPrivate::addPopup(QQuickPopup *popup) { @@ -475,11 +477,13 @@ void QQuickOverlay::mouseReleaseEvent(QMouseEvent *event) d->handleMouseEvent(this, event); } +#if QT_CONFIG(quicktemplates2_multitouch) void QQuickOverlay::touchEvent(QTouchEvent *event) { Q_D(QQuickOverlay); d->handleTouchEvent(this, event); } +#endif #if QT_CONFIG(wheelevent) void QQuickOverlay::wheelEvent(QWheelEvent *event) @@ -516,10 +520,12 @@ bool QQuickOverlay::childMouseEventFilter(QQuickItem *item, QEvent *event) // does not have background dimming. if (item == p->dimmer || !p->popupItem->isAncestorOf(item)) { switch (event->type()) { +#if QT_CONFIG(quicktemplates2_multitouch) case QEvent::TouchBegin: case QEvent::TouchUpdate: case QEvent::TouchEnd: return d->handleTouchEvent(item, static_cast<QTouchEvent *>(event), popup); +#endif case QEvent::MouseButtonPress: case QEvent::MouseMove: @@ -541,6 +547,7 @@ bool QQuickOverlay::eventFilter(QObject *object, QEvent *event) return false; switch (event->type()) { +#if QT_CONFIG(quicktemplates2_multitouch) case QEvent::TouchBegin: case QEvent::TouchUpdate: case QEvent::TouchEnd: @@ -567,10 +574,13 @@ bool QQuickOverlay::eventFilter(QObject *object, QEvent *event) // touch events, to be able to close non-modal popups on release outside. event->accept(); return true; +#endif case QEvent::MouseButtonPress: +#if QT_CONFIG(quicktemplates2_multitouch) // do not emit pressed() twice when mouse events have been synthesized from touch events if (static_cast<QMouseEvent *>(event)->source() == Qt::MouseEventNotSynthesized) +#endif emit pressed(); QQuickWindowPrivate::get(d->window)->handleMouseEvent(static_cast<QMouseEvent *>(event)); @@ -583,8 +593,10 @@ bool QQuickOverlay::eventFilter(QObject *object, QEvent *event) return true; case QEvent::MouseButtonRelease: +#if QT_CONFIG(quicktemplates2_multitouch) // do not emit released() twice when mouse events have been synthesized from touch events if (static_cast<QMouseEvent *>(event)->source() == Qt::MouseEventNotSynthesized) +#endif emit released(); // allow non-modal popups to close on mouse release outside diff --git a/src/quicktemplates2/qquickoverlay_p.h b/src/quicktemplates2/qquickoverlay_p.h index 7d1ff143..ba61c9c9 100644 --- a/src/quicktemplates2/qquickoverlay_p.h +++ b/src/quicktemplates2/qquickoverlay_p.h @@ -87,7 +87,9 @@ protected: void mousePressEvent(QMouseEvent *event) override; void mouseMoveEvent(QMouseEvent *event) override; void mouseReleaseEvent(QMouseEvent *event) override; +#if QT_CONFIG(quicktemplates2_multitouch) void touchEvent(QTouchEvent *event) override; +#endif #if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent *event) override; #endif diff --git a/src/quicktemplates2/qquickoverlay_p_p.h b/src/quicktemplates2/qquickoverlay_p_p.h index 38284332..05177a49 100644 --- a/src/quicktemplates2/qquickoverlay_p_p.h +++ b/src/quicktemplates2/qquickoverlay_p_p.h @@ -76,7 +76,9 @@ public: bool handleRelease(QQuickItem *source, QEvent *event, QQuickPopup *target); bool handleMouseEvent(QQuickItem *source, QMouseEvent *event, QQuickPopup *target = nullptr); +#if QT_CONFIG(quicktemplates2_multitouch) bool handleTouchEvent(QQuickItem *source, QTouchEvent *event, QQuickPopup *target = nullptr); +#endif void addPopup(QQuickPopup *popup); void removePopup(QQuickPopup *popup); diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp index 840b9f19..9e0015fa 100644 --- a/src/quicktemplates2/qquickpopup.cpp +++ b/src/quicktemplates2/qquickpopup.cpp @@ -299,6 +299,7 @@ bool QQuickPopupPrivate::contains(const QPointF &scenePos) const return popupItem->contains(popupItem->mapFromScene(scenePos)); } +#if QT_CONFIG(quicktemplates2_multitouch) bool QQuickPopupPrivate::acceptTouch(const QTouchEvent::TouchPoint &point) { if (point.id() == touchId) @@ -311,6 +312,7 @@ bool QQuickPopupPrivate::acceptTouch(const QTouchEvent::TouchPoint &point) return false; } +#endif bool QQuickPopupPrivate::blockInput(QQuickItem *item, const QPointF &point) const { @@ -373,6 +375,7 @@ bool QQuickPopupPrivate::handleMouseEvent(QQuickItem *item, QMouseEvent *event) } } +#if QT_CONFIG(quicktemplates2_multitouch) bool QQuickPopupPrivate::handleTouchEvent(QQuickItem *item, QTouchEvent *event) { switch (event->type()) { @@ -418,6 +421,7 @@ bool QQuickPopupPrivate::handleTouchEvent(QQuickItem *item, QTouchEvent *event) return false; } +#endif bool QQuickPopupPrivate::prepareEnterTransition() { @@ -566,13 +570,20 @@ void QQuickPopupPrivate::setWindow(QQuickWindow *newWindow) QQuickOverlayPrivate::get(overlay)->removePopup(q); } + window = newWindow; + if (newWindow) { QQuickOverlay *overlay = QQuickOverlay::overlay(newWindow); if (overlay) QQuickOverlayPrivate::get(overlay)->addPopup(q); + + QQuickControlPrivate *p = QQuickControlPrivate::get(popupItem); + p->resolveFont(); + p->resolvePalette(); + if (QQuickApplicationWindow *appWindow = qobject_cast<QQuickApplicationWindow *>(newWindow)) + p->updateLocale(appWindow->locale(), false); // explicit=false } - window = newWindow; emit q->windowChanged(newWindow); if (complete && visible && window) @@ -1440,12 +1451,6 @@ void QQuickPopup::setParentItem(QQuickItem *parent) if (parent) { QObjectPrivate::connect(parent, &QQuickItem::windowChanged, d, &QQuickPopupPrivate::setWindow); QQuickItemPrivate::get(d->parentItem)->addItemChangeListener(d, QQuickItemPrivate::Destroyed); - - QQuickControlPrivate *p = QQuickControlPrivate::get(d->popupItem); - p->resolveFont(); - p->resolvePalette(); - if (QQuickApplicationWindow *window = qobject_cast<QQuickApplicationWindow *>(parent->window())) - p->updateLocale(window->locale(), false); // explicit=false } else { close(); } @@ -2053,10 +2058,12 @@ bool QQuickPopup::overlayEvent(QQuickItem *item, QEvent *event) event->accept(); return d->modal; +#if QT_CONFIG(quicktemplates2_multitouch) case QEvent::TouchBegin: case QEvent::TouchUpdate: case QEvent::TouchEnd: return d->handleTouchEvent(item, static_cast<QTouchEvent *>(event)); +#endif case QEvent::MouseButtonPress: case QEvent::MouseButtonRelease: @@ -2067,6 +2074,7 @@ bool QQuickPopup::overlayEvent(QQuickItem *item, QEvent *event) } } +#if QT_CONFIG(quicktemplates2_multitouch) void QQuickPopup::touchEvent(QTouchEvent *event) { Q_D(QQuickPopup); @@ -2078,6 +2086,7 @@ void QQuickPopup::touchUngrabEvent() Q_D(QQuickPopup); d->handleUngrab(); } +#endif #if QT_CONFIG(wheelevent) void QQuickPopup::wheelEvent(QWheelEvent *event) diff --git a/src/quicktemplates2/qquickpopup_p.h b/src/quicktemplates2/qquickpopup_p.h index 065647d5..bf41e7d0 100644 --- a/src/quicktemplates2/qquickpopup_p.h +++ b/src/quicktemplates2/qquickpopup_p.h @@ -362,8 +362,10 @@ protected: virtual void mouseDoubleClickEvent(QMouseEvent *event); virtual void mouseUngrabEvent(); virtual bool overlayEvent(QQuickItem *item, QEvent *event); +#if QT_CONFIG(quicktemplates2_multitouch) virtual void touchEvent(QTouchEvent *event); virtual void touchUngrabEvent(); +#endif #if QT_CONFIG(wheelevent) virtual void wheelEvent(QWheelEvent *event); #endif diff --git a/src/quicktemplates2/qquickpopup_p_p.h b/src/quicktemplates2/qquickpopup_p_p.h index fa79003e..857bb6ae 100644 --- a/src/quicktemplates2/qquickpopup_p_p.h +++ b/src/quicktemplates2/qquickpopup_p_p.h @@ -99,7 +99,9 @@ public: bool contains(const QPointF &scenePos) const; +#if QT_CONFIG(quicktemplates2_multitouch) virtual bool acceptTouch(const QTouchEvent::TouchPoint &point); +#endif virtual bool blockInput(QQuickItem *item, const QPointF &point) const; virtual bool handlePress(QQuickItem* item, const QPointF &point, ulong timestamp); @@ -108,7 +110,9 @@ public: virtual void handleUngrab(); bool handleMouseEvent(QQuickItem *item, QMouseEvent *event); +#if QT_CONFIG(quicktemplates2_multitouch) bool handleTouchEvent(QQuickItem *item, QTouchEvent *event); +#endif virtual void reposition(); virtual void resizeOverlay(); diff --git a/src/quicktemplates2/qquickpopupitem.cpp b/src/quicktemplates2/qquickpopupitem.cpp index 8251ad2f..27b800f0 100644 --- a/src/quicktemplates2/qquickpopupitem.cpp +++ b/src/quicktemplates2/qquickpopupitem.cpp @@ -89,6 +89,8 @@ void QQuickPopupItemPrivate::resolveFont() { if (QQuickApplicationWindow *window = qobject_cast<QQuickApplicationWindow *>(popup->window())) inheritFont(window->font()); + else + inheritFont(themeFont(QPlatformTheme::SystemFont)); } void QQuickPopupItemPrivate::resolvePalette() @@ -237,6 +239,7 @@ void QQuickPopupItem::mouseUngrabEvent() d->popup->mouseUngrabEvent(); } +#if QT_CONFIG(quicktemplates2_multitouch) void QQuickPopupItem::touchEvent(QTouchEvent *event) { Q_D(QQuickPopupItem); @@ -248,6 +251,7 @@ void QQuickPopupItem::touchUngrabEvent() Q_D(QQuickPopupItem); d->popup->touchUngrabEvent(); } +#endif #if QT_CONFIG(wheelevent) void QQuickPopupItem::wheelEvent(QWheelEvent *event) diff --git a/src/quicktemplates2/qquickpopupitem_p_p.h b/src/quicktemplates2/qquickpopupitem_p_p.h index 00ccd78f..97f6415f 100644 --- a/src/quicktemplates2/qquickpopupitem_p_p.h +++ b/src/quicktemplates2/qquickpopupitem_p_p.h @@ -79,8 +79,10 @@ protected: void mouseReleaseEvent(QMouseEvent *event) override; void mouseDoubleClickEvent(QMouseEvent *event) override; void mouseUngrabEvent() override; +#if QT_CONFIG(quicktemplates2_multitouch) void touchEvent(QTouchEvent *event) override; void touchUngrabEvent() override; +#endif #if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent *event) override; #endif diff --git a/src/quicktemplates2/qquickrangeslider.cpp b/src/quicktemplates2/qquickrangeslider.cpp index 83317902..c1cf13db 100644 --- a/src/quicktemplates2/qquickrangeslider.cpp +++ b/src/quicktemplates2/qquickrangeslider.cpp @@ -328,7 +328,9 @@ public: QQuickRangeSliderNode *pressedNode(int touchId = -1) const; +#if QT_CONFIG(quicktemplates2_multitouch) bool acceptTouch(const QTouchEvent::TouchPoint &point) override; +#endif void handlePress(const QPointF &point) override; void handleMove(const QPointF &point) override; void handleRelease(const QPointF &point) override; @@ -397,6 +399,7 @@ QQuickRangeSliderNode *QQuickRangeSliderPrivate::pressedNode(int touchId) const return nullptr; } +#if QT_CONFIG(quicktemplates2_multitouch) bool QQuickRangeSliderPrivate::acceptTouch(const QTouchEvent::TouchPoint &point) { int firstId = QQuickRangeSliderNodePrivate::get(first)->touchId; @@ -409,6 +412,7 @@ bool QQuickRangeSliderPrivate::acceptTouch(const QTouchEvent::TouchPoint &point) return false; } +#endif void QQuickRangeSliderPrivate::handlePress(const QPointF &point) { @@ -1018,6 +1022,7 @@ void QQuickRangeSlider::mouseMoveEvent(QMouseEvent *event) QQuickControl::mouseMoveEvent(event); } +#if QT_CONFIG(quicktemplates2_multitouch) void QQuickRangeSlider::touchEvent(QTouchEvent *event) { Q_D(QQuickRangeSlider); @@ -1055,6 +1060,7 @@ void QQuickRangeSlider::touchEvent(QTouchEvent *event) break; } } +#endif void QQuickRangeSlider::mirrorChange() { diff --git a/src/quicktemplates2/qquickrangeslider_p.h b/src/quicktemplates2/qquickrangeslider_p.h index 3d4ebb2b..82d61b37 100644 --- a/src/quicktemplates2/qquickrangeslider_p.h +++ b/src/quicktemplates2/qquickrangeslider_p.h @@ -122,7 +122,9 @@ protected: void keyReleaseEvent(QKeyEvent *event) override; void mousePressEvent(QMouseEvent *event) override; void mouseMoveEvent(QMouseEvent *event) override; +#if QT_CONFIG(quicktemplates2_multitouch) void touchEvent(QTouchEvent *event) override; +#endif void mirrorChange() override; void componentComplete() override; diff --git a/src/quicktemplates2/qquickslider.cpp b/src/quicktemplates2/qquickslider.cpp index e54e95cd..b5bf5e52 100644 --- a/src/quicktemplates2/qquickslider.cpp +++ b/src/quicktemplates2/qquickslider.cpp @@ -665,6 +665,7 @@ void QQuickSlider::mouseMoveEvent(QMouseEvent *event) QQuickControl::mouseMoveEvent(event); } +#if QT_CONFIG(quicktemplates2_multitouch) void QQuickSlider::touchEvent(QTouchEvent *event) { Q_D(QQuickSlider); @@ -702,6 +703,7 @@ void QQuickSlider::touchEvent(QTouchEvent *event) break; } } +#endif #if QT_CONFIG(wheelevent) void QQuickSlider::wheelEvent(QWheelEvent *event) diff --git a/src/quicktemplates2/qquickslider_p.h b/src/quicktemplates2/qquickslider_p.h index cb441ddd..21a880f5 100644 --- a/src/quicktemplates2/qquickslider_p.h +++ b/src/quicktemplates2/qquickslider_p.h @@ -139,7 +139,9 @@ protected: void keyReleaseEvent(QKeyEvent *event) override; void mousePressEvent(QMouseEvent *event) override; void mouseMoveEvent(QMouseEvent *event) override; +#if QT_CONFIG(quicktemplates2_multitouch) void touchEvent(QTouchEvent *event) override; +#endif #if QT_CONFIG(wheelevent) void wheelEvent(QWheelEvent *event) override; #endif diff --git a/src/quicktemplates2/qquickswitch.cpp b/src/quicktemplates2/qquickswitch.cpp index ae447de8..da1f0408 100644 --- a/src/quicktemplates2/qquickswitch.cpp +++ b/src/quicktemplates2/qquickswitch.cpp @@ -187,6 +187,7 @@ void QQuickSwitch::mouseMoveEvent(QMouseEvent *event) QQuickAbstractButton::mouseMoveEvent(event); } +#if QT_CONFIG(quicktemplates2_multitouch) void QQuickSwitch::touchEvent(QTouchEvent *event) { Q_D(QQuickSwitch); @@ -200,6 +201,7 @@ void QQuickSwitch::touchEvent(QTouchEvent *event) } QQuickAbstractButton::touchEvent(event); } +#endif void QQuickSwitch::mirrorChange() { diff --git a/src/quicktemplates2/qquickswitch_p.h b/src/quicktemplates2/qquickswitch_p.h index ebcfea53..0faaf114 100644 --- a/src/quicktemplates2/qquickswitch_p.h +++ b/src/quicktemplates2/qquickswitch_p.h @@ -74,7 +74,9 @@ Q_SIGNALS: protected: void mouseMoveEvent(QMouseEvent *event) override; +#if QT_CONFIG(quicktemplates2_multitouch) void touchEvent(QTouchEvent *event) override; +#endif void mirrorChange() override; diff --git a/src/quicktemplates2/qquickswitchdelegate.cpp b/src/quicktemplates2/qquickswitchdelegate.cpp index 9bce76db..d8ce8096 100644 --- a/src/quicktemplates2/qquickswitchdelegate.cpp +++ b/src/quicktemplates2/qquickswitchdelegate.cpp @@ -184,6 +184,7 @@ void QQuickSwitchDelegate::mouseMoveEvent(QMouseEvent *event) QQuickItemDelegate::mouseMoveEvent(event); } +#if QT_CONFIG(quicktemplates2_multitouch) void QQuickSwitchDelegate::touchEvent(QTouchEvent *event) { Q_D(QQuickSwitchDelegate); @@ -197,6 +198,7 @@ void QQuickSwitchDelegate::touchEvent(QTouchEvent *event) } QQuickItemDelegate::touchEvent(event); } +#endif QFont QQuickSwitchDelegate::defaultFont() const { diff --git a/src/quicktemplates2/qquickswitchdelegate_p.h b/src/quicktemplates2/qquickswitchdelegate_p.h index e3e0804a..973ec21d 100644 --- a/src/quicktemplates2/qquickswitchdelegate_p.h +++ b/src/quicktemplates2/qquickswitchdelegate_p.h @@ -74,7 +74,9 @@ Q_SIGNALS: protected: void mouseMoveEvent(QMouseEvent *event) override; +#if QT_CONFIG(quicktemplates2_multitouch) void touchEvent(QTouchEvent *event) override; +#endif QFont defaultFont() const override; void mirrorChange() override; |