File indexing completed on 2025-01-18 10:09:35
0001
0002
0003
0004 #ifndef QGRIDLAYOUT_H
0005 #define QGRIDLAYOUT_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 QGridLayoutPrivate;
0019
0020 class Q_WIDGETS_EXPORT QGridLayout : public QLayout
0021 {
0022 Q_OBJECT
0023 Q_DECLARE_PRIVATE(QGridLayout)
0024 QDOC_PROPERTY(int horizontalSpacing READ horizontalSpacing WRITE setHorizontalSpacing)
0025 QDOC_PROPERTY(int verticalSpacing READ verticalSpacing WRITE setVerticalSpacing)
0026
0027 public:
0028 explicit QGridLayout(QWidget *parent = nullptr);
0029 ~QGridLayout();
0030
0031 QSize sizeHint() const override;
0032 QSize minimumSize() const override;
0033 QSize maximumSize() const override;
0034
0035 void setHorizontalSpacing(int spacing);
0036 int horizontalSpacing() const;
0037 void setVerticalSpacing(int spacing);
0038 int verticalSpacing() const;
0039 void setSpacing(int spacing) override;
0040 int spacing() const override;
0041
0042 void setRowStretch(int row, int stretch);
0043 void setColumnStretch(int column, int stretch);
0044 int rowStretch(int row) const;
0045 int columnStretch(int column) const;
0046
0047 void setRowMinimumHeight(int row, int minSize);
0048 void setColumnMinimumWidth(int column, int minSize);
0049 int rowMinimumHeight(int row) const;
0050 int columnMinimumWidth(int column) const;
0051
0052 int columnCount() const;
0053 int rowCount() const;
0054
0055 QRect cellRect(int row, int column) const;
0056
0057 bool hasHeightForWidth() const override;
0058 int heightForWidth(int) const override;
0059 int minimumHeightForWidth(int) const override;
0060
0061 Qt::Orientations expandingDirections() const override;
0062 void invalidate() override;
0063
0064 inline void addWidget(QWidget *w) { QLayout::addWidget(w); }
0065 void addWidget(QWidget *, int row, int column, Qt::Alignment = Qt::Alignment());
0066 void addWidget(QWidget *, int row, int column, int rowSpan, int columnSpan, Qt::Alignment = Qt::Alignment());
0067 void addLayout(QLayout *, int row, int column, Qt::Alignment = Qt::Alignment());
0068 void addLayout(QLayout *, int row, int column, int rowSpan, int columnSpan, Qt::Alignment = Qt::Alignment());
0069
0070 void setOriginCorner(Qt::Corner);
0071 Qt::Corner originCorner() const;
0072
0073 QLayoutItem *itemAt(int index) const override;
0074 QLayoutItem *itemAtPosition(int row, int column) const;
0075 QLayoutItem *takeAt(int index) override;
0076 int count() const override;
0077 void setGeometry(const QRect&) override;
0078
0079 void addItem(QLayoutItem *item, int row, int column, int rowSpan = 1, int columnSpan = 1, Qt::Alignment = Qt::Alignment());
0080
0081 void setDefaultPositioning(int n, Qt::Orientation orient);
0082 void getItemPosition(int idx, int *row, int *column, int *rowSpan, int *columnSpan) const;
0083
0084 protected:
0085 void addItem(QLayoutItem *) override;
0086
0087 private:
0088 Q_DISABLE_COPY(QGridLayout)
0089
0090 };
0091
0092 QT_END_NAMESPACE
0093
0094 #endif