diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2019-04-16 16:32:08 +0200 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@qt.io> | 2019-04-16 16:32:08 +0200 |
commit | 6630937e63ae5797487b86743a7733c8ae5cc42c (patch) | |
tree | 3d53dacf6430f9099e1fb20835881205de674961 /src/widgets/util | |
parent | 37ed6dae00640f9cc980ffda05347c12a7eb5d7e (diff) | |
parent | c7af193d2e49e9f10b86262e63d8d13abf72b5cf (diff) |
Merge commit 'dev' into 'wip/cmake-merge'
Change-Id: I176c40d031be26a1dd1cf08843e448a660598783
Diffstat (limited to 'src/widgets/util')
-rw-r--r-- | src/widgets/util/qcompleter_p.h | 3 | ||||
-rw-r--r-- | src/widgets/util/qflickgesture.cpp | 2 | ||||
-rw-r--r-- | src/widgets/util/qflickgesture_p.h | 5 | ||||
-rw-r--r-- | src/widgets/util/qscroller.cpp | 38 | ||||
-rw-r--r-- | src/widgets/util/qscroller_p.h | 6 | ||||
-rw-r--r-- | src/widgets/util/qsystemtrayicon.cpp | 2 | ||||
-rw-r--r-- | src/widgets/util/qundogroup.cpp | 2 | ||||
-rw-r--r-- | src/widgets/util/qundostack.cpp | 12 | ||||
-rw-r--r-- | src/widgets/util/qundostack_p.h | 4 | ||||
-rw-r--r-- | src/widgets/util/qundoview.cpp | 2 |
10 files changed, 35 insertions, 41 deletions
diff --git a/src/widgets/util/qcompleter_p.h b/src/widgets/util/qcompleter_p.h index 765363744b..a52e63a6e2 100644 --- a/src/widgets/util/qcompleter_p.h +++ b/src/widgets/util/qcompleter_p.h @@ -75,7 +75,7 @@ class QCompleterPrivate : public QObjectPrivate public: QCompleterPrivate(); ~QCompleterPrivate() { delete popup; } - void init(QAbstractItemModel *model = 0); + void init(QAbstractItemModel *model = nullptr); QPointer<QWidget> widget; QCompletionModel *proxy; @@ -194,6 +194,7 @@ private: const QIndexMapper& iv, QMatchData* m); }; +// ### Qt6: QStyledItemDelegate class QCompleterItemDelegate : public QItemDelegate { public: diff --git a/src/widgets/util/qflickgesture.cpp b/src/widgets/util/qflickgesture.cpp index b59fe0d504..a8b2a00a80 100644 --- a/src/widgets/util/qflickgesture.cpp +++ b/src/widgets/util/qflickgesture.cpp @@ -130,8 +130,6 @@ private: , mouseEventSource(Qt::MouseEventNotSynthesized) { } - static PressDelayHandler *inst; - public: enum { UngrabMouseBefore = 1, diff --git a/src/widgets/util/qflickgesture_p.h b/src/widgets/util/qflickgesture_p.h index 74a0f2a0f3..0b47516047 100644 --- a/src/widgets/util/qflickgesture_p.h +++ b/src/widgets/util/qflickgesture_p.h @@ -71,14 +71,12 @@ class Q_WIDGETS_EXPORT QFlickGesture : public QGesture Q_DECLARE_PRIVATE(QFlickGesture) public: - QFlickGesture(QObject *receiver, Qt::MouseButton button, QObject *parent = 0); + QFlickGesture(QObject *receiver, Qt::MouseButton button, QObject *parent = nullptr); ~QFlickGesture(); friend class QFlickGestureRecognizer; }; -class PressDelayHandler; - class QFlickGesturePrivate : public QGesturePrivate { Q_DECLARE_PUBLIC(QFlickGesture) @@ -89,7 +87,6 @@ public: QScroller *receiverScroller; Qt::MouseButton button; // NoButton == Touch bool macIgnoreWheel; - static PressDelayHandler *pressDelayHandler; }; class QFlickGestureRecognizer : public QGestureRecognizer diff --git a/src/widgets/util/qscroller.cpp b/src/widgets/util/qscroller.cpp index 28504f5631..1e84237253 100644 --- a/src/widgets/util/qscroller.cpp +++ b/src/widgets/util/qscroller.cpp @@ -191,7 +191,7 @@ static qreal progressForValue(const QEasingCurve &curve, qreal value) } -#ifndef QT_NO_ANIMATION +#if QT_CONFIG(animation) class QScrollTimer : public QAbstractAnimation { public: @@ -230,7 +230,7 @@ private: bool ignoreUpdate; int skip; }; -#endif // QT_NO_ANIMATION +#endif // animation /*! \class QScroller @@ -249,18 +249,11 @@ private: scrolling speed and takes care of updates. QScroller can be triggered by a flick gesture - \code - QWidget *w = ...; - QScroller::grabGesture(w, QScroller::LeftMouseButtonGesture); - \endcode + \snippet code/src_widgets_util_qscroller.cpp 0 or directly like this: - \code - QWidget *w = ...; - QScroller *scroller = QScroller::scroller(w); - scroller->scrollTo(QPointF(100, 100)); - \endcode + \snippet code/src_widgets_util_qscroller.cpp 1 The scrolled QObjects receive a QScrollPrepareEvent whenever the scroller needs to update its geometry information and a QScrollEvent whenever the content of the object should @@ -495,6 +488,7 @@ QScroller::QScroller(QObject *target) : d_ptr(new QScrollerPrivate(this, target)) { Q_ASSERT(target); // you can't create a scroller without a target in any normal way + setParent(target); Q_D(QScroller); d->init(); } @@ -896,7 +890,7 @@ QScrollerPrivate::QScrollerPrivate(QScroller *q, QObject *_target) , snapIntervalX(0.0) , snapFirstY(-1.0) , snapIntervalY(0.0) -#ifndef QT_NO_ANIMATION +#if QT_CONFIG(animation) , scrollTimer(new QScrollTimer(this)) #endif , q_ptr(q) @@ -938,7 +932,7 @@ const char *QScrollerPrivate::inputName(QScroller::Input input) void QScrollerPrivate::targetDestroyed() { -#ifndef QT_NO_ANIMATION +#if QT_CONFIG(animation) scrollTimer->stop(); #endif delete q_ptr; @@ -966,7 +960,7 @@ void QScrollerPrivate::timerTick() } } -#ifndef QT_NO_ANIMATION +#if QT_CONFIG(animation) scrollTimer->stop(); #endif } @@ -1690,7 +1684,7 @@ void QScrollerPrivate::setState(QScroller::State newstate) switch (newstate) { case QScroller::Inactive: -#ifndef QT_NO_ANIMATION +#if QT_CONFIG(animation) scrollTimer->stop(); #endif @@ -1702,7 +1696,7 @@ void QScrollerPrivate::setState(QScroller::State newstate) break; case QScroller::Pressed: -#ifndef QT_NO_ANIMATION +#if QT_CONFIG(animation) scrollTimer->stop(); #endif @@ -1712,14 +1706,14 @@ void QScrollerPrivate::setState(QScroller::State newstate) case QScroller::Dragging: dragDistance = QPointF(0, 0); -#ifndef QT_NO_ANIMATION +#if QT_CONFIG(animation) if (state == QScroller::Pressed) scrollTimer->start(); #endif break; case QScroller::Scrolling: -#ifndef QT_NO_ANIMATION +#if QT_CONFIG(animation) scrollTimer->start(); #endif break; @@ -1732,10 +1726,12 @@ void QScrollerPrivate::setState(QScroller::State newstate) sendEvent(target, &se); firstScroll = true; } - if (state == QScroller::Dragging || state == QScroller::Scrolling) - qt_activeScrollers()->push_back(q); - else + if (state == QScroller::Dragging || state == QScroller::Scrolling) { + if (!qt_activeScrollers()->contains(q)) + qt_activeScrollers()->push_back(q); + } else { qt_activeScrollers()->removeOne(q); + } emit q->stateChanged(state); } diff --git a/src/widgets/util/qscroller_p.h b/src/widgets/util/qscroller_p.h index 5e0c359514..13e2032a5c 100644 --- a/src/widgets/util/qscroller_p.h +++ b/src/widgets/util/qscroller_p.h @@ -64,7 +64,9 @@ #include <qscroller.h> #include <qscrollerproperties.h> #include <private/qscrollerproperties_p.h> +#if QT_CONFIG(animation) #include <QAbstractAnimation> +#endif QT_BEGIN_NAMESPACE @@ -72,7 +74,7 @@ QT_BEGIN_NAMESPACE class QFlickGestureRecognizer; #endif -#ifndef QT_NO_ANIMATION +#if QT_CONFIG(animation) class QScrollTimer; #endif class QScrollerPrivate : public QObject @@ -196,7 +198,7 @@ public: QElapsedTimer monotonicTimer; QPointF releaseVelocity; // the starting velocity of the scrolling state -#ifndef QT_NO_ANIMATION +#if QT_CONFIG(animation) QScrollTimer *scrollTimer; #endif diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp index d15f5e5955..a38a50d3df 100644 --- a/src/widgets/util/qsystemtrayicon.cpp +++ b/src/widgets/util/qsystemtrayicon.cpp @@ -574,7 +574,7 @@ QBalloonTip::QBalloonTip(const QIcon &icon, const QString &title, layout->addWidget(msgLabel, 1, 0, 1, 3); #endif layout->setSizeConstraint(QLayout::SetFixedSize); - layout->setMargin(3); + layout->setContentsMargins(3, 3, 3, 3); setLayout(layout); QPalette pal = palette(); diff --git a/src/widgets/util/qundogroup.cpp b/src/widgets/util/qundogroup.cpp index f9605c7a2f..9bd63d4232 100644 --- a/src/widgets/util/qundogroup.cpp +++ b/src/widgets/util/qundogroup.cpp @@ -242,7 +242,7 @@ void QUndoGroup::setActiveStack(QUndoStack *stack) Returns the active stack of this group. If none of the stacks are active, or if the group is empty, this function - returns 0. + returns \nullptr. \sa setActiveStack(), QUndoStack::setActive() */ diff --git a/src/widgets/util/qundostack.cpp b/src/widgets/util/qundostack.cpp index e928b9fe37..8788c42252 100644 --- a/src/widgets/util/qundostack.cpp +++ b/src/widgets/util/qundostack.cpp @@ -102,9 +102,9 @@ QT_BEGIN_NAMESPACE /*! Constructs a QUndoCommand object with the given \a parent and \a text. - If \a parent is not 0, this command is appended to parent's child list. - The parent command then owns this command and will delete it in its - destructor. + If \a parent is not \nullptr, this command is appended to parent's + child list. The parent command then owns this command and will delete + it in its destructor. \sa ~QUndoCommand() */ @@ -118,9 +118,9 @@ QUndoCommand::QUndoCommand(const QString &text, QUndoCommand *parent) /*! Constructs a QUndoCommand object with parent \a parent. - If \a parent is not 0, this command is appended to parent's child list. - The parent command then owns this command and will delete it in its - destructor. + If \a parent is not \nullptr, this command is appended to parent's + child list. The parent command then owns this command and will delete + it in its destructor. \sa ~QUndoCommand() */ diff --git a/src/widgets/util/qundostack_p.h b/src/widgets/util/qundostack_p.h index 04bc381114..05c9e0d27e 100644 --- a/src/widgets/util/qundostack_p.h +++ b/src/widgets/util/qundostack_p.h @@ -80,7 +80,7 @@ class QUndoStackPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QUndoStack) public: - QUndoStackPrivate() : index(0), clean_index(0), group(0), undo_limit(0) {} + QUndoStackPrivate() : index(0), clean_index(0), group(nullptr), undo_limit(0) {} QList<QUndoCommand*> command_list; QList<QUndoCommand*> macro_stack; @@ -98,7 +98,7 @@ class QUndoAction : public QAction { Q_OBJECT public: - explicit QUndoAction(const QString &prefix, QObject *parent = 0); + explicit QUndoAction(const QString &prefix, QObject *parent = nullptr); void setTextFormat(const QString &textFormat, const QString &defaultText); public Q_SLOTS: void setPrefixedText(const QString &text); diff --git a/src/widgets/util/qundoview.cpp b/src/widgets/util/qundoview.cpp index 31f6c0dff2..c862cbcea5 100644 --- a/src/widgets/util/qundoview.cpp +++ b/src/widgets/util/qundoview.cpp @@ -412,7 +412,7 @@ void QUndoView::setGroup(QUndoGroup *group) /*! Returns the group displayed by this view. - If the view is not looking at group, this function returns 0. + If the view is not looking at group, this function returns \nullptr. \sa setGroup(), setStack() */ |