| 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 QGRAPHICSLAYOUT_H |
| 5 | #define QGRAPHICSLAYOUT_H |
| 6 | |
| 7 | #include <QtWidgets/qtwidgetsglobal.h> |
| 8 | #include <QtWidgets/qgraphicslayoutitem.h> |
| 9 | |
| 10 | QT_REQUIRE_CONFIG(graphicsview); |
| 11 | |
| 12 | QT_BEGIN_NAMESPACE |
| 13 | |
| 14 | class QGraphicsLayoutPrivate; |
| 15 | class QGraphicsLayoutItem; |
| 16 | class QGraphicsWidget; |
| 17 | |
| 18 | class Q_WIDGETS_EXPORT QGraphicsLayout : public QGraphicsLayoutItem |
| 19 | { |
| 20 | public: |
| 21 | QGraphicsLayout(QGraphicsLayoutItem *parent = nullptr); |
| 22 | ~QGraphicsLayout(); |
| 23 | |
| 24 | void setContentsMargins(qreal left, qreal top, qreal right, qreal bottom); |
| 25 | void getContentsMargins(qreal *left, qreal *top, qreal *right, qreal *bottom) const override; |
| 26 | |
| 27 | void activate(); |
| 28 | bool isActivated() const; |
| 29 | virtual void invalidate(); |
| 30 | virtual void updateGeometry() override; |
| 31 | |
| 32 | virtual void widgetEvent(QEvent *e); |
| 33 | |
| 34 | virtual int count() const = 0; |
| 35 | virtual QGraphicsLayoutItem *itemAt(int i) const = 0; |
| 36 | virtual void removeAt(int index) = 0; |
| 37 | |
| 38 | static void setInstantInvalidatePropagation(bool enable); |
| 39 | static bool instantInvalidatePropagation(); |
| 40 | protected: |
| 41 | QGraphicsLayout(QGraphicsLayoutPrivate &, QGraphicsLayoutItem *); |
| 42 | void addChildLayoutItem(QGraphicsLayoutItem *layoutItem); |
| 43 | |
| 44 | private: |
| 45 | Q_DISABLE_COPY(QGraphicsLayout) |
| 46 | Q_DECLARE_PRIVATE(QGraphicsLayout) |
| 47 | friend class QGraphicsWidget; |
| 48 | }; |
| 49 | |
| 50 | #ifndef Q_QDOC |
| 51 | Q_DECLARE_INTERFACE(QGraphicsLayout, "org.qt-project.Qt.QGraphicsLayout") |
| 52 | #endif |
| 53 | |
| 54 | QT_END_NAMESPACE |
| 55 | |
| 56 | #endif |
| 57 |
