| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QGRAPHICSLAYOUTITEM_P_H |
| 5 | #define QGRAPHICSLAYOUTITEM_P_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists for the convenience |
| 12 | // of other Qt classes. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include <QtWidgets/private/qtwidgetsglobal_p.h> |
| 19 | #include <QtCore/QSizeF> |
| 20 | #include <QtWidgets/QSizePolicy> |
| 21 | |
| 22 | QT_REQUIRE_CONFIG(graphicsview); |
| 23 | |
| 24 | QT_BEGIN_NAMESPACE |
| 25 | |
| 26 | class QGraphicsLayoutItem; |
| 27 | class Q_AUTOTEST_EXPORT QGraphicsLayoutItemPrivate |
| 28 | { |
| 29 | Q_DECLARE_PUBLIC(QGraphicsLayoutItem) |
| 30 | public: |
| 31 | virtual ~QGraphicsLayoutItemPrivate(); |
| 32 | QGraphicsLayoutItemPrivate(QGraphicsLayoutItem *parent, bool isLayout); |
| 33 | static QGraphicsLayoutItemPrivate *get(QGraphicsLayoutItem *q) { return q->d_func();} |
| 34 | static const QGraphicsLayoutItemPrivate *get(const QGraphicsLayoutItem *q) { return q->d_func();} |
| 35 | |
| 36 | void init(); |
| 37 | QSizeF *effectiveSizeHints(const QSizeF &constraint) const; |
| 38 | QGraphicsItem *parentItem() const; |
| 39 | void ensureUserSizeHints(); |
| 40 | void setSize(Qt::SizeHint which, const QSizeF &size); |
| 41 | enum SizeComponent { Width, Height }; |
| 42 | void setSizeComponent(Qt::SizeHint which, SizeComponent component, qreal value); |
| 43 | |
| 44 | bool hasHeightForWidth() const; |
| 45 | bool hasWidthForHeight() const; |
| 46 | |
| 47 | QSizePolicy sizePolicy; |
| 48 | QGraphicsLayoutItem *parent; |
| 49 | |
| 50 | QSizeF *userSizeHints; |
| 51 | mutable QSizeF cachedSizeHints[Qt::NSizeHints]; |
| 52 | mutable QSizeF cachedConstraint; |
| 53 | mutable QSizeF cachedSizeHintsWithConstraints[Qt::NSizeHints]; |
| 54 | |
| 55 | mutable quint32 sizeHintCacheDirty : 1; |
| 56 | mutable quint32 sizeHintWithConstraintCacheDirty : 1; |
| 57 | quint32 isLayout : 1; |
| 58 | quint32 ownedByLayout : 1; |
| 59 | |
| 60 | QGraphicsLayoutItem *q_ptr; |
| 61 | QRectF geom; |
| 62 | QGraphicsItem *graphicsItem; |
| 63 | }; |
| 64 | |
| 65 | QT_END_NAMESPACE |
| 66 | |
| 67 | #endif //QGRAPHICSLAYOUTITEM_P_H |
| 68 | |
| 69 |
