Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qboxlayout.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 QBOXLAYOUT_H
5#define QBOXLAYOUT_H
6
7#include <QtWidgets/qtwidgetsglobal.h>
8#include <QtWidgets/qlayout.h>
9#ifdef QT_INCLUDE_COMPAT
10#include <QtWidgets/qwidget.h>
11#endif
12
13#include <limits.h>
14
16
17
19
20class Q_WIDGETS_EXPORT QBoxLayout : public QLayout
21{
23 Q_DECLARE_PRIVATE(QBoxLayout)
24public:
25 enum Direction { LeftToRight, RightToLeft, TopToBottom, BottomToTop,
26 Down = TopToBottom, Up = BottomToTop };
27
28 explicit QBoxLayout(Direction, QWidget *parent = nullptr);
29
31
32 Direction direction() const;
33 void setDirection(Direction);
34
35 void addSpacing(int size);
36 void addStretch(int stretch = 0);
37 void addSpacerItem(QSpacerItem *spacerItem);
38 void addWidget(QWidget *, int stretch = 0, Qt::Alignment alignment = Qt::Alignment());
39 void addLayout(QLayout *layout, int stretch = 0);
40 void addStrut(int);
41 void addItem(QLayoutItem *) override;
42
43 void insertSpacing(int index, int size);
44 void insertStretch(int index, int stretch = 0);
45 void insertSpacerItem(int index, QSpacerItem *spacerItem);
46 void insertWidget(int index, QWidget *widget, int stretch = 0, Qt::Alignment alignment = Qt::Alignment());
47 void insertLayout(int index, QLayout *layout, int stretch = 0);
48 void insertItem(int index, QLayoutItem *);
49
50 int spacing() const override;
51 void setSpacing(int spacing) override;
52
53 bool setStretchFactor(QWidget *w, int stretch);
54 bool setStretchFactor(QLayout *l, int stretch);
55 void setStretch(int index, int stretch);
56 int stretch(int index) const;
57
58 QSize sizeHint() const override;
59 QSize minimumSize() const override;
60 QSize maximumSize() const override;
61
62 bool hasHeightForWidth() const override;
63 int heightForWidth(int) const override;
64 int minimumHeightForWidth(int) const override;
65
66 Qt::Orientations expandingDirections() const override;
67 void invalidate() override;
68 QLayoutItem *itemAt(int) const override;
69 QLayoutItem *takeAt(int) override;
70 int count() const override;
71 void setGeometry(const QRect&) override;
72
73private:
74 Q_DISABLE_COPY(QBoxLayout)
75};
76
77class Q_WIDGETS_EXPORT QHBoxLayout : public QBoxLayout
78{
80public:
82 explicit QHBoxLayout(QWidget *parent);
84
85
86private:
87 Q_DISABLE_COPY(QHBoxLayout)
88};
89
90class Q_WIDGETS_EXPORT QVBoxLayout : public QBoxLayout
91{
93public:
95 explicit QVBoxLayout(QWidget *parent);
97
98
99private:
100 Q_DISABLE_COPY(QVBoxLayout)
101};
102
104
105#endif // QBOXLAYOUT_H
The QBoxLayout class lines up child widgets horizontally or vertically.
Definition qboxlayout.h:21
Direction
This type is used to determine the direction of a box layout.
Definition qboxlayout.h:25
The QHBoxLayout class lines up widgets horizontally.
Definition qboxlayout.h:78
The QLayoutItem class provides an abstract item that a QLayout manipulates.
Definition qlayoutitem.h:25
virtual bool hasHeightForWidth() const
Returns true if this layout's preferred height depends on its width; otherwise returns false.
virtual int heightForWidth(int) const
Returns the preferred height for this layout item, given the width, which is not used in this default...
virtual int minimumHeightForWidth(int) const
Returns the minimum height this widget needs for the given width, w.
virtual QSize sizeHint() const =0
Implemented in subclasses to return the preferred size of this item.
The QLayout class is the base class of geometry managers.
Definition qlayout.h:26
void addWidget(QWidget *w)
Adds widget w to this layout in a manner specific to the layout.
Definition qlayout.cpp:186
int spacing
the spacing between widgets inside the layout
Definition qlayout.h:30
QSize maximumSize() const override
Returns the maximum size of this layout.
Definition qlayout.cpp:926
virtual void setSpacing(int)
Definition qlayout.cpp:266
virtual void addItem(QLayoutItem *)=0
Implemented in subclasses to add an item.
virtual QLayoutItem * itemAt(int index) const =0
Must be implemented in subclasses to return the layout item at index.
virtual QLayoutItem * takeAt(int index)=0
Must be implemented in subclasses to remove the layout item at index from the layout,...
Qt::Orientations expandingDirections() const override
Returns whether this layout can make use of more space than sizeHint().
Definition qlayout.cpp:943
QSize minimumSize() const override
Returns the minimum size of this layout.
Definition qlayout.cpp:911
void invalidate() override
\reimp
Definition qlayout.cpp:469
virtual int count() const =0
Must be implemented in subclasses to return the number of items in the layout.
virtual void setGeometry(const QRect &) override
\reimp
Definition qlayout.cpp:451
\inmodule QtCore\reentrant
Definition qrect.h:30
\inmodule QtCore
Definition qsize.h:25
The QSpacerItem class provides blank space in a layout.
Definition qlayoutitem.h:57
The QVBoxLayout class lines up widgets vertically.
Definition qboxlayout.h:91
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
QOpenGLWidget * widget
[1]
qreal spacing
uint alignment
direction
Combined button and popup list for selecting options.
GLfloat GLfloat GLfloat w
[0]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint index
[2]
#define Q_OBJECT
QVBoxLayout * layout
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent