QGraphicsAnchorLayout: move some private classes to a namespace with Q

Avoids polluting the global namespace

Change-Id: Ie01831ddac5446fdbdeefffd15468b5ca22d5e7b
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
bb10
Thiago Macieira 2018-07-31 12:39:13 -07:00 committed by David Faure
parent 5dd9616f6d
commit 6228c0528c
3 changed files with 9 additions and 3 deletions

View File

@ -70,7 +70,6 @@ private:
Q_DECLARE_PRIVATE(QGraphicsAnchor)
friend class QGraphicsAnchorLayoutPrivate;
friend struct AnchorData;
};
class Q_WIDGETS_EXPORT QGraphicsAnchorLayout : public QGraphicsLayout

View File

@ -167,7 +167,7 @@ AnchorData::~AnchorData()
if (graphicsAnchor) {
// Remove reference to ourself to avoid double removal in
// QGraphicsAnchorPrivate dtor.
graphicsAnchor->d_func()->data = 0;
QGraphicsAnchorPrivate::get(graphicsAnchor)->data = nullptr;
delete graphicsAnchor;
}
@ -215,7 +215,7 @@ void AnchorData::refreshSizeHints(const QLayoutStyleInfo *styleInfo)
} else {
// It is a user-created anchor, fetch size information from the associated QGraphicsAnchor
Q_ASSERT(graphicsAnchor);
QGraphicsAnchorPrivate *anchorPrivate = graphicsAnchor->d_func();
QGraphicsAnchorPrivate *anchorPrivate = QGraphicsAnchorPrivate::get(graphicsAnchor);
// Policy, min and max sizes are straightforward
policy = anchorPrivate->sizePolicy;

View File

@ -73,6 +73,7 @@ QT_BEGIN_NAMESPACE
respectively.
*/
namespace QtGraphicsAnchorLayout {
/*!
\internal
@ -326,6 +327,9 @@ public:
QSet<AnchorData *> positives;
QSet<AnchorData *> negatives;
};
} // namespace QtGraphicsAnchorLayout
using namespace QtGraphicsAnchorLayout;
Q_DECLARE_TYPEINFO(GraphPath, Q_MOVABLE_TYPE);
class QGraphicsAnchorLayoutPrivate;
@ -346,6 +350,9 @@ public:
void setSizePolicy(QSizePolicy::Policy policy);
static QGraphicsAnchorPrivate *get(QGraphicsAnchor *q)
{ return q->d_func(); }
QGraphicsAnchorLayoutPrivate *layoutPrivate;
AnchorData *data;