diff options
author | Jan-Arve Sæther <jan-arve.saether@nokia.com> | 2009-10-27 10:54:47 (GMT) |
---|---|---|
committer | Jan-Arve Sæther <jan-arve.saether@nokia.com> | 2009-10-27 10:54:47 (GMT) |
commit | 8a9ab43e572443eefbf19d59740fdc64d25d1005 (patch) | |
tree | aef9429f4e0e7d9d7b97c3951f11e2440348371b /src/gui/graphicsview/qgraphicsanchorlayout_p.h | |
parent | dd89851abe4b0d0a3c293b5cadace00eb3f75a47 (diff) | |
download | Qt-8a9ab43e572443eefbf19d59740fdc64d25d1005.zip Qt-8a9ab43e572443eefbf19d59740fdc64d25d1005.tar.gz Qt-8a9ab43e572443eefbf19d59740fdc64d25d1005.tar.bz2 |
Respect the per-item layoutSpacing() if the style uses that feature.
We move the QLayoutStyleInfo class out of the gridlayout engine to a
common header file so that anchor layout also can utilize it.
Due to that we now can have a per-item spacing we have to change the
'effectiveSpacing' argument of refreshSizeHints to just take a
QLayoutStyleInfo pointer that we will later query for the actual
spacing used.
Diffstat (limited to 'src/gui/graphicsview/qgraphicsanchorlayout_p.h')
-rw-r--r-- | src/gui/graphicsview/qgraphicsanchorlayout_p.h | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.h b/src/gui/graphicsview/qgraphicsanchorlayout_p.h index d45c004..9b7d41e 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.h +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.h @@ -159,7 +159,7 @@ struct AnchorData : public QSimplexVariable { type(Normal), hasSize(true), isLayoutAnchor(false) {} virtual void updateChildrenSizes() {} - virtual void refreshSizeHints(qreal effectiveSpacing); + virtual void refreshSizeHints(const QLayoutStyleInfo *styleInfo); virtual ~AnchorData() {} @@ -226,9 +226,9 @@ struct SequentialAnchorData : public AnchorData } virtual void updateChildrenSizes(); - virtual void refreshSizeHints(qreal effectiveSpacing); + virtual void refreshSizeHints(const QLayoutStyleInfo *styleInfo); - void refreshSizeHints_helper(qreal effectiveSpacing, bool refreshChildren = true); + void refreshSizeHints_helper(const QLayoutStyleInfo *styleInfo, bool refreshChildren = true); void setVertices(const QVector<AnchorVertex*> &vertices) { @@ -261,9 +261,9 @@ struct ParallelAnchorData : public AnchorData } virtual void updateChildrenSizes(); - virtual void refreshSizeHints(qreal effectiveSpacing); + virtual void refreshSizeHints(const QLayoutStyleInfo *styleInfo); - void refreshSizeHints_helper(qreal effectiveSpacing, bool refreshChildren = true); + void refreshSizeHints_helper(const QLayoutStyleInfo *styleInfo, bool refreshChildren = true); AnchorData* firstEdge; AnchorData* secondEdge; @@ -423,9 +423,8 @@ public: Qt::AnchorPoint &firstEdge, QGraphicsLayoutItem *&secondItem, Qt::AnchorPoint &secondEdge); - // for getting the actual spacing (will query the style if the - // spacing is not explicitly set). - qreal effectiveSpacing(Orientation orientation) const; + + QLayoutStyleInfo &styleInfo() const; // Activation methods void simplifyGraph(Orientation orientation); @@ -524,6 +523,8 @@ public: #endif uint calculateGraphCacheDirty : 1; + mutable uint styleInfoDirty : 1; + mutable QLayoutStyleInfo cachedStyleInfo; friend class QGraphicsAnchorPrivate; }; |