diff options
author | Stephan Binner <stephan.binner@basyskom.com> | 2017-02-28 20:24:27 +0100 |
---|---|---|
committer | Stephan Binner <stephan.binner@basyskom.com> | 2017-03-01 19:41:49 +0000 |
commit | e1b9ddc10552b061ef8b4d56a2e3fa7a5daa61bb (patch) | |
tree | 6e06ba5925f1ca27e18662be9954b91f1795c25b /src/widgets | |
parent | b41492d53e733e12351338e03ad471d39d81c0b1 (diff) |
Add feature.scroller
Change-Id: I5313e1f5091d5764994525dae138e288e5125c59
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/configure.json | 6 | ||||
-rw-r--r-- | src/widgets/itemviews/qabstractitemview.cpp | 6 | ||||
-rw-r--r-- | src/widgets/itemviews/qabstractitemview.h | 2 | ||||
-rw-r--r-- | src/widgets/styles/qpixmapstyle.cpp | 6 | ||||
-rw-r--r-- | src/widgets/util/qscroller.h | 2 | ||||
-rw-r--r-- | src/widgets/util/qscrollerproperties.h | 2 | ||||
-rw-r--r-- | src/widgets/util/util.pri | 22 |
7 files changed, 32 insertions, 14 deletions
diff --git a/src/widgets/configure.json b/src/widgets/configure.json index f27a23fd04..151935927a 100644 --- a/src/widgets/configure.json +++ b/src/widgets/configure.json @@ -324,6 +324,12 @@ "condition": "features.scrollbar", "output": [ "publicFeature", "feature" ] }, + "scroller": { + "label": "QScroller", + "purpose": "Enables kinetic scrolling for any scrolling widget or graphics item.", + "section": "Widgets", + "output": [ "publicFeature" ] + }, "graphicsview": { "label": "QGraphicsView", "purpose": "Provides a canvas/sprite framework.", diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index 6ecf5a664f..939e2a3d79 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -64,7 +64,7 @@ #ifndef QT_NO_ACCESSIBILITY #include <qaccessible.h> #endif -#ifndef QT_NO_GESTURES +#if QT_CONFIG(gestures) && QT_CONFIG(scroller) # include <qscroller.h> #endif @@ -196,7 +196,7 @@ void QAbstractItemViewPrivate::checkMouseMove(const QPersistentModelIndex &index } } -#ifndef QT_NO_GESTURES +#if QT_CONFIG(gestures) && QT_CONFIG(scroller) // stores and restores the selection and current item when flicking void QAbstractItemViewPrivate::_q_scrollerStateChanged() @@ -1736,7 +1736,7 @@ bool QAbstractItemView::viewportEvent(QEvent *event) break; case QEvent::ScrollPrepare: executeDelayedItemsLayout(); -#ifndef QT_NO_GESTURES +#if QT_CONFIG(gestures) && QT_CONFIG(scroller) connect(QScroller::scroller(d->viewport), SIGNAL(stateChanged(QScroller::State)), this, SLOT(_q_scrollerStateChanged()), Qt::UniqueConnection); #endif break; diff --git a/src/widgets/itemviews/qabstractitemview.h b/src/widgets/itemviews/qabstractitemview.h index 309b8c4d59..f315ea6e4c 100644 --- a/src/widgets/itemviews/qabstractitemview.h +++ b/src/widgets/itemviews/qabstractitemview.h @@ -367,7 +367,7 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_modelDestroyed()) Q_PRIVATE_SLOT(d_func(), void _q_layoutChanged()) Q_PRIVATE_SLOT(d_func(), void _q_headerDataChanged()) -#ifndef QT_NO_GESTURES +#if QT_CONFIG(gestures) && QT_CONFIG(scroller) Q_PRIVATE_SLOT(d_func(), void _q_scrollerStateChanged()) #endif diff --git a/src/widgets/styles/qpixmapstyle.cpp b/src/widgets/styles/qpixmapstyle.cpp index a947f5d079..3aec3cf991 100644 --- a/src/widgets/styles/qpixmapstyle.cpp +++ b/src/widgets/styles/qpixmapstyle.cpp @@ -60,7 +60,9 @@ #include <QAbstractScrollArea> #include <QScrollBar> +#if QT_CONFIG(scroller) #include <qscroller.h> +#endif QT_BEGIN_NAMESPACE @@ -194,7 +196,7 @@ void QPixmapStyle::polish(QWidget *widget) view->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); } #endif -#if QT_CONFIG(gestures) +#if QT_CONFIG(gestures) && QT_CONFIG(scroller) QScroller::grabGesture(scrollArea->viewport(), QScroller::LeftMouseButtonGesture); #endif } @@ -235,7 +237,7 @@ void QPixmapStyle::unpolish(QWidget *widget) if (qstrcmp(widget->metaObject()->className(),"QComboBoxPrivateContainer") == 0) widget->removeEventFilter(this); -#if QT_CONFIG(gestures) && QT_CONFIG(scrollarea) +#if QT_CONFIG(gestures) && QT_CONFIG(scrollarea) && QT_CONFIG(scroller) if (QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea*>(widget)) QScroller::ungrabGesture(scrollArea->viewport()); #endif diff --git a/src/widgets/util/qscroller.h b/src/widgets/util/qscroller.h index 561dcfaefc..ca8d059f50 100644 --- a/src/widgets/util/qscroller.h +++ b/src/widgets/util/qscroller.h @@ -45,6 +45,8 @@ #include <QtCore/QPointF> #include <QtWidgets/QScrollerProperties> +QT_REQUIRE_CONFIG(scroller); + QT_BEGIN_NAMESPACE diff --git a/src/widgets/util/qscrollerproperties.h b/src/widgets/util/qscrollerproperties.h index 4fdc9bd32f..2fc1a5dc18 100644 --- a/src/widgets/util/qscrollerproperties.h +++ b/src/widgets/util/qscrollerproperties.h @@ -45,6 +45,8 @@ #include <QtCore/QMetaType> #include <QtCore/QVariant> +QT_REQUIRE_CONFIG(scroller); + QT_BEGIN_NAMESPACE diff --git a/src/widgets/util/util.pri b/src/widgets/util/util.pri index cb19c1fc95..b9b62d9bb0 100644 --- a/src/widgets/util/util.pri +++ b/src/widgets/util/util.pri @@ -6,11 +6,6 @@ HEADERS += \ util/qcompleter.h \ util/qcompleter_p.h \ util/qsystemtrayicon_p.h \ - util/qscroller.h \ - util/qscroller_p.h \ - util/qscrollerproperties.h \ - util/qscrollerproperties_p.h \ - util/qflickgesture_p.h \ util/qundogroup.h \ util/qundostack.h \ util/qundostack_p.h \ @@ -20,13 +15,24 @@ SOURCES += \ util/qsystemtrayicon.cpp \ util/qcolormap.cpp \ util/qcompleter.cpp \ - util/qscroller.cpp \ - util/qscrollerproperties.cpp \ - util/qflickgesture.cpp \ util/qundogroup.cpp \ util/qundostack.cpp \ util/qundoview.cpp +qtConfig(scroller) { + HEADERS += \ + util/qscroller.h \ + util/qscroller_p.h \ + util/qscrollerproperties.h \ + util/qscrollerproperties_p.h \ + util/qflickgesture_p.h + + SOURCES += \ + util/qscroller.cpp \ + util/qscrollerproperties.cpp \ + util/qflickgesture.cpp \ +} + win32:!winrt { SOURCES += util/qsystemtrayicon_win.cpp } else: qtConfig(xcb) { |