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