diff options
author | Jan Arve Saether <jan-arve.saether@digia.com> | 2014-01-02 17:44:34 +0100 |
---|---|---|
committer | Jan Arve Sæther <jan-arve.saether@theqtcompany.com> | 2014-12-01 14:37:02 +0100 |
commit | 7cea5949ca5c23a840978dcb80014085e467e9eb (patch) | |
tree | 289931e6189ed5b4f436f7a5cfd5a0da56cdbd07 /src/gui | |
parent | 9431321c653e4f387d7d27c410d22aabb2d042ef (diff) |
Don't rely on hasChanged() in ensureGeometries
It can be removed now because we now have a better caching
mechanism than before. It should therefore not be needed anymore.
Since nothing else calls hasChanged, we can finally get rid of it.
This simplifies the code and enables us to further improvements to the
code.
Change-Id: I51afe5a97311e3e361ae8b491ecbcd21bbedacd1
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/util/qabstractlayoutstyleinfo.cpp | 7 | ||||
-rw-r--r-- | src/gui/util/qabstractlayoutstyleinfo_p.h | 21 | ||||
-rw-r--r-- | src/gui/util/qgridlayoutengine.cpp | 2 |
3 files changed, 7 insertions, 23 deletions
diff --git a/src/gui/util/qabstractlayoutstyleinfo.cpp b/src/gui/util/qabstractlayoutstyleinfo.cpp index 4338a0ccbf..af4ad0470b 100644 --- a/src/gui/util/qabstractlayoutstyleinfo.cpp +++ b/src/gui/util/qabstractlayoutstyleinfo.cpp @@ -35,11 +35,4 @@ QT_BEGIN_NAMESPACE -bool QAbstractLayoutStyleInfo::hasChanged() const -{ - if (m_changed == Unknown) - m_changed = hasChangedCore() ? Changed : Unchanged; - return m_changed == Changed; -} - QT_END_NAMESPACE diff --git a/src/gui/util/qabstractlayoutstyleinfo_p.h b/src/gui/util/qabstractlayoutstyleinfo_p.h index 3479c47c4e..d64cb94aa4 100644 --- a/src/gui/util/qabstractlayoutstyleinfo_p.h +++ b/src/gui/util/qabstractlayoutstyleinfo_p.h @@ -53,13 +53,8 @@ QT_BEGIN_NAMESPACE class Q_GUI_EXPORT QAbstractLayoutStyleInfo { public: - typedef enum { - Unknown = 0, - Changed, - Unchanged - } ChangedState; - QAbstractLayoutStyleInfo() : m_isWindow(false), m_changed(Changed) {} + QAbstractLayoutStyleInfo() : m_isWindow(false) {} virtual ~QAbstractLayoutStyleInfo() {} virtual qreal combinedLayoutSpacing(QLayoutPolicy::ControlTypes /*controls1*/, QLayoutPolicy::ControlTypes /*controls2*/, Qt::Orientation /*orientation*/) const { @@ -74,15 +69,9 @@ public: virtual qreal spacing(Qt::Orientation orientation) const = 0; - virtual bool hasChangedCore() const = 0; + virtual bool hasChangedCore() const { return false; } // ### Remove when usage is gone from subclasses - void updateChanged(ChangedState change) { - m_changed = change; - } - - bool hasChanged() const; - - virtual void invalidate() { updateChanged(Changed);} + virtual void invalidate() { } virtual qreal windowMargin(Qt::Orientation orientation) const = 0; @@ -92,7 +81,9 @@ public: protected: unsigned m_isWindow : 1; - mutable unsigned m_changed : 2; + mutable unsigned m_hSpacingState: 2; + mutable unsigned m_vSpacingState: 2; + mutable qreal m_spacing[2]; }; QT_END_NAMESPACE diff --git a/src/gui/util/qgridlayoutengine.cpp b/src/gui/util/qgridlayoutengine.cpp index 65f2297fce..43d1ed3b6c 100644 --- a/src/gui/util/qgridlayoutengine.cpp +++ b/src/gui/util/qgridlayoutengine.cpp @@ -1590,7 +1590,7 @@ Qt::Orientation QGridLayoutEngine::constraintOrientation() const void QGridLayoutEngine::ensureGeometries(const QSizeF &size, const QAbstractLayoutStyleInfo *styleInfo) const { - if (!styleInfo->hasChanged() && q_cachedSize == size) + if (q_cachedSize == size) return; q_cachedSize = size; |