From c74d137e192cd9b2db450e58309293d21a240847 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Sun, 26 May 2019 22:26:59 +0000 Subject: [PATCH] AnchorVertex, AnchorData, QGraphicsAnchorLayout and QGraphicsAnchorLayoutPrivate cleanup Signed-off-by: Ivailo Monev --- cmake/KatieConfigVersion.cmake | 2 +- src/gui/animation/qabstractanimation.cpp | 2 +- src/gui/animation/qabstractanimation.h | 2 +- src/gui/animation/qsequentialanimationgroup.cpp | 3 +-- src/gui/graphicsview/qgraph_p.h | 1 - src/gui/graphicsview/qgraphicsanchorlayout_p.cpp | 1 + src/gui/graphicsview/qgraphicsanchorlayout_p.h | 31 ++++++++++++------------ 7 files changed, 20 insertions(+), 22 deletions(-) diff --git a/cmake/KatieConfigVersion.cmake b/cmake/KatieConfigVersion.cmake index b548533b4..2129ce4b5 100644 --- a/cmake/KatieConfigVersion.cmake +++ b/cmake/KatieConfigVersion.cmake @@ -3,6 +3,6 @@ set(KATIE_VERSION_MAJOR "@KATIE_MAJOR@") set(KATIE_VERSION_MINOR "@KATIE_MINOR@") set(KATIE_VERSION_PATCH "@KATIE_MICRO@") set(KATIE_VERSION "@KATIE_MAJOR@.@KATIE_MINOR@.@KATIE_MICRO@") -# purely for convenience bug reports and the like +# purely for convenience, bug reports and the like set(KATIE_VERSION_HEX "@KATIE_HEX@") set(KATIE_VERSION_GIT "@KATIE_GIT@") diff --git a/src/gui/animation/qabstractanimation.cpp b/src/gui/animation/qabstractanimation.cpp index 3cb9cde80..1c08f3fbf 100644 --- a/src/gui/animation/qabstractanimation.cpp +++ b/src/gui/animation/qabstractanimation.cpp @@ -892,7 +892,7 @@ void QAbstractAnimation::start(DeletionPolicy policy) Q_D(QAbstractAnimation); if (d->state == Running) return; - d->deleteWhenStopped = policy; + d->deleteWhenStopped = bool(policy); d->setState(Running); } diff --git a/src/gui/animation/qabstractanimation.h b/src/gui/animation/qabstractanimation.h index da61d7cad..8d5265836 100644 --- a/src/gui/animation/qabstractanimation.h +++ b/src/gui/animation/qabstractanimation.h @@ -81,7 +81,7 @@ public: enum DeletionPolicy { KeepWhenStopped = 0, - DeleteWhenStopped + DeleteWhenStopped = 1 }; QAbstractAnimation(QObject *parent = Q_NULLPTR); diff --git a/src/gui/animation/qsequentialanimationgroup.cpp b/src/gui/animation/qsequentialanimationgroup.cpp index fc59f0e75..330502839 100644 --- a/src/gui/animation/qsequentialanimationgroup.cpp +++ b/src/gui/animation/qsequentialanimationgroup.cpp @@ -567,8 +567,7 @@ void QSequentialAnimationGroupPrivate::animationRemoved(int index, QAbstractAnim // duration of the previous animations up to the current animation currentTime = 0; for (int i = 0; i < currentAnimationIndex; ++i) { - const int current = animationActualTotalDuration(i); - currentTime += current; + currentTime += animationActualTotalDuration(i); } if (currentIndex != -1) { diff --git a/src/gui/graphicsview/qgraph_p.h b/src/gui/graphicsview/qgraph_p.h index 850610785..4a10f1ec5 100644 --- a/src/gui/graphicsview/qgraph_p.h +++ b/src/gui/graphicsview/qgraph_p.h @@ -54,7 +54,6 @@ // #include -#include #include #include diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp index 1cfcf97e9..64656c0fe 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #ifdef QT_DEBUG #include diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.h b/src/gui/graphicsview/qgraphicsanchorlayout_p.h index 28a749866..8f2d8d7aa 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.h +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.h @@ -55,12 +55,13 @@ #include #include - #include "qgraphicslayout_p.h" #include "qgraphicsanchorlayout.h" #include "qgraph_p.h" #include "qsimplex_p.h" + #ifndef QT_NO_GRAPHICSVIEW + QT_BEGIN_NAMESPACE /* @@ -95,7 +96,7 @@ struct AnchorVertex { QGraphicsLayoutItem *m_item; Qt::AnchorPoint m_edge; - uint m_type : 1; + Type m_type; // Current distance from this vertex to the layout edge (Left or Top) // Value is calculated from the current anchors sizes. @@ -127,8 +128,8 @@ struct AnchorData : public QSimplexVariable { sizeAtMinimum(0), sizeAtPreferred(0), sizeAtMaximum(0), item(0), graphicsAnchor(0), type(Normal), isLayoutAnchor(false), - isCenterAnchor(false), orientation(0), - dependency(Independent) {} + isCenterAnchor(false), dependency(Independent), + orientation(0) {} virtual ~AnchorData(); virtual void updateChildrenSizes() {} @@ -171,11 +172,11 @@ struct AnchorData : public QSimplexVariable { QGraphicsLayoutItem *item; QGraphicsAnchor *graphicsAnchor; - uint type : 2; // either Normal, Sequential or Parallel - uint isLayoutAnchor : 1; // if this anchor is an internal layout anchor - uint isCenterAnchor : 1; - uint orientation : 1; - uint dependency : 2; // either Independent, Master or Slave + Type type; // either Normal, Sequential or Parallel + bool isLayoutAnchor; // if this anchor is an internal layout anchor + bool isCenterAnchor; + Dependency dependency; // either Independent, Master or Slave + uint orientation; }; #ifdef QT_DEBUG @@ -351,12 +352,10 @@ public: QSizePolicy::Policy sizePolicy; qreal preferredSize; - uint hasSize : 1; // if false, get size from style. + bool hasSize; // if false, get size from style. }; - - /*! \internal @@ -403,9 +402,9 @@ public: static Qt::AnchorPoint pickEdge(Qt::AnchorPoint edge, Orientation orientation) { - if (orientation == Vertical && int(edge) <= 2) + if (orientation == QGraphicsAnchorLayoutPrivate::Vertical && int(edge) <= 2) return (Qt::AnchorPoint)(edge + 3); - else if (orientation == Horizontal && int(edge) >= 3) { + else if (orientation == QGraphicsAnchorLayoutPrivate::Horizontal && int(edge) >= 3) { return (Qt::AnchorPoint)(edge - 3); } return edge; @@ -579,8 +578,8 @@ public: bool lastCalculationUsedSimplex[2]; #endif - uint calculateGraphCacheDirty : 1; - mutable uint styleInfoDirty : 1; + bool calculateGraphCacheDirty; + mutable bool styleInfoDirty; mutable QLayoutStyleInfo cachedStyleInfo; friend class QGraphicsAnchorPrivate; -- 2.11.0