Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qgraphicslinearlayout.h
Go to the documentation of this file.
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 QGRAPHICSLINEARLAYOUT_H
5#define QGRAPHICSLINEARLAYOUT_H
6
7#include <QtWidgets/qtwidgetsglobal.h>
8#include <QtWidgets/qgraphicsitem.h>
9#include <QtWidgets/qgraphicslayout.h>
10
11QT_REQUIRE_CONFIG(graphicsview);
12
14
16
17class Q_WIDGETS_EXPORT QGraphicsLinearLayout : public QGraphicsLayout
18{
19public:
21 QGraphicsLinearLayout(Qt::Orientation orientation, QGraphicsLayoutItem *parent = nullptr);
22 virtual ~QGraphicsLinearLayout();
23
24 void setOrientation(Qt::Orientation orientation);
25 Qt::Orientation orientation() const;
26
27 inline void addItem(QGraphicsLayoutItem *item) { insertItem(-1, item); }
28 inline void addStretch(int stretch = 1) { insertStretch(-1, stretch); }
29
30 void insertItem(int index, QGraphicsLayoutItem *item);
31 void insertStretch(int index, int stretch = 1);
32
33 void removeItem(QGraphicsLayoutItem *item);
34 void removeAt(int index) override;
35
36 void setSpacing(qreal spacing);
37 qreal spacing() const;
38 void setItemSpacing(int index, qreal spacing);
39 qreal itemSpacing(int index) const;
40
41 void setStretchFactor(QGraphicsLayoutItem *item, int stretch);
42 int stretchFactor(QGraphicsLayoutItem *item) const;
43
44 void setAlignment(QGraphicsLayoutItem *item, Qt::Alignment alignment);
45 Qt::Alignment alignment(QGraphicsLayoutItem *item) const;
46
47 void setGeometry(const QRectF &rect) override;
48
49 int count() const override;
50 QGraphicsLayoutItem *itemAt(int index) const override;
51
52 void invalidate() override;
53 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const override;
54
55#if 0 // ###
56 Q5SizePolicy::ControlTypes controlTypes(LayoutSide side) const;
57#endif
58
59 void dump(int indent = 0) const;
60
61protected:
62#if 0
63 QSize contentsSizeHint(Qt::SizeHint which, const QSize &constraint = QSize()) const;
64#endif
65
66private:
67 Q_DISABLE_COPY(QGraphicsLinearLayout)
68 Q_DECLARE_PRIVATE(QGraphicsLinearLayout)
69};
70
72
73#endif
The QGraphicsLayoutItem class can be inherited to allow your custom items to be managed by layouts.
The QGraphicsLayout class provides the base class for all layouts in Graphics View.
The QGraphicsLinearLayout class provides a horizontal or vertical layout for managing widgets in Grap...
void addStretch(int stretch=1)
This convenience function is equivalent to calling insertStretch(-1, stretch).
void addItem(QGraphicsLayoutItem *item)
This convenience function is equivalent to calling insertItem(-1, item).
\inmodule QtCore\reentrant
Definition qrect.h:484
\inmodule QtCore
Definition qsize.h:208
\inmodule QtCore
Definition qsize.h:25
qreal spacing
rect
[4]
uint alignment
Combined button and popup list for selecting options.
Orientation
Definition qnamespace.h:98
GLuint index
[2]
GLenum GLenum GLsizei count
static QString dump(const QByteArray &)
#define QT_REQUIRE_CONFIG(feature)
double qreal
Definition qtypes.h:187
label setAlignment(Qt::AlignLeft|Qt::AlignTop)
[0]
QGraphicsItem * item