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
10QT_REQUIRE_CONFIG(graphicsview);
11
12QT_BEGIN_NAMESPACE
13
14class QGraphicsLayoutPrivate;
15class QGraphicsLayoutItem;
16class QGraphicsWidget;
17
18class Q_WIDGETS_EXPORT QGraphicsLayout : public QGraphicsLayoutItem
19{
20public:
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();
40protected:
41 QGraphicsLayout(QGraphicsLayoutPrivate &, QGraphicsLayoutItem *);
42 void addChildLayoutItem(QGraphicsLayoutItem *layoutItem);
43
44private:
45 Q_DISABLE_COPY(QGraphicsLayout)
46 Q_DECLARE_PRIVATE(QGraphicsLayout)
47 friend class QGraphicsWidget;
48};
49
50#ifndef Q_QDOC
51Q_DECLARE_INTERFACE(QGraphicsLayout, "org.qt-project.Qt.QGraphicsLayout")
52#endif
53
54QT_END_NAMESPACE
55
56#endif
57

source code of qtbase/src/widgets/graphicsview/qgraphicslayout.h