File indexing completed on 2026-07-26 09:22:37
0001
0002
0003
0004
0005 #ifndef QBOXLAYOUT_H
0006 #define QBOXLAYOUT_H
0007
0008 #include <QtWidgets/qtwidgetsglobal.h>
0009 #include <QtWidgets/qlayout.h>
0010 #ifdef QT_INCLUDE_COMPAT
0011 #include <QtWidgets/qwidget.h>
0012 #endif
0013
0014 #include <limits.h>
0015
0016 QT_BEGIN_NAMESPACE
0017
0018
0019 class QBoxLayoutPrivate;
0020
0021 class Q_WIDGETS_EXPORT QBoxLayout : public QLayout
0022 {
0023 Q_OBJECT
0024 Q_DECLARE_PRIVATE(QBoxLayout)
0025 public:
0026 enum Direction { LeftToRight, RightToLeft, TopToBottom, BottomToTop,
0027 Down = TopToBottom, Up = BottomToTop };
0028
0029 explicit QBoxLayout(Direction, QWidget *parent = nullptr);
0030
0031 ~QBoxLayout();
0032
0033 Direction direction() const;
0034 void setDirection(Direction);
0035
0036 void addSpacing(int size);
0037 void addStretch(int stretch = 0);
0038 void addSpacerItem(QSpacerItem *spacerItem);
0039 void addWidget(QWidget *, int stretch = 0, Qt::Alignment alignment = Qt::Alignment());
0040 void addLayout(QLayout *layout, int stretch = 0);
0041 void addStrut(int);
0042 void addItem(QLayoutItem *) override;
0043
0044 void insertSpacing(int index, int size);
0045 void insertStretch(int index, int stretch = 0);
0046 void insertSpacerItem(int index, QSpacerItem *spacerItem);
0047 void insertWidget(int index, QWidget *widget, int stretch = 0, Qt::Alignment alignment = Qt::Alignment());
0048 void insertLayout(int index, QLayout *layout, int stretch = 0);
0049 void insertItem(int index, QLayoutItem *);
0050
0051 int spacing() const override;
0052 void setSpacing(int spacing) override;
0053
0054 bool setStretchFactor(QWidget *w, int stretch);
0055 bool setStretchFactor(QLayout *l, int stretch);
0056 void setStretch(int index, int stretch);
0057 int stretch(int index) const;
0058
0059 QSize sizeHint() const override;
0060 QSize minimumSize() const override;
0061 QSize maximumSize() const override;
0062
0063 bool hasHeightForWidth() const override;
0064 int heightForWidth(int) const override;
0065 int minimumHeightForWidth(int) const override;
0066
0067 Qt::Orientations expandingDirections() const override;
0068 void invalidate() override;
0069 QLayoutItem *itemAt(int) const override;
0070 QLayoutItem *takeAt(int) override;
0071 int count() const override;
0072 void setGeometry(const QRect&) override;
0073
0074 private:
0075 Q_DISABLE_COPY(QBoxLayout)
0076 };
0077
0078 class Q_WIDGETS_EXPORT QHBoxLayout : public QBoxLayout
0079 {
0080 Q_OBJECT
0081 public:
0082 QHBoxLayout();
0083 explicit QHBoxLayout(QWidget *parent);
0084 ~QHBoxLayout();
0085
0086
0087 private:
0088 Q_DISABLE_COPY(QHBoxLayout)
0089 };
0090
0091 class Q_WIDGETS_EXPORT QVBoxLayout : public QBoxLayout
0092 {
0093 Q_OBJECT
0094 public:
0095 QVBoxLayout();
0096 explicit QVBoxLayout(QWidget *parent);
0097 ~QVBoxLayout();
0098
0099
0100 private:
0101 Q_DISABLE_COPY(QVBoxLayout)
0102 };
0103
0104 QT_END_NAMESPACE
0105
0106 #endif