QtBase  v6.3.1
qgridlayout.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the QtWidgets module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 3 requirements
23 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24 **
25 ** GNU General Public License Usage
26 ** Alternatively, this file may be used under the terms of the GNU
27 ** General Public License version 2.0 or (at your option) the GNU General
28 ** Public license version 3 or any later version approved by the KDE Free
29 ** Qt Foundation. The licenses are as published by the Free Software
30 ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31 ** included in the packaging of this file. Please review the following
32 ** information to ensure the GNU General Public License requirements will
33 ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34 ** https://www.gnu.org/licenses/gpl-3.0.html.
35 **
36 ** $QT_END_LICENSE$
37 **
38 ****************************************************************************/
39 
40 #ifndef QGRIDLAYOUT_H
41 #define QGRIDLAYOUT_H
42 
43 #include <QtWidgets/qtwidgetsglobal.h>
44 #include <QtWidgets/qlayout.h>
45 #ifdef QT_INCLUDE_COMPAT
46 #include <QtWidgets/qwidget.h>
47 #endif
48 
49 #include <limits.h>
50 
52 
53 
54 class QGridLayoutPrivate;
55 
56 class Q_WIDGETS_EXPORT QGridLayout : public QLayout
57 {
58  Q_OBJECT
59  Q_DECLARE_PRIVATE(QGridLayout)
60  QDOC_PROPERTY(int horizontalSpacing READ horizontalSpacing WRITE setHorizontalSpacing)
61  QDOC_PROPERTY(int verticalSpacing READ verticalSpacing WRITE setVerticalSpacing)
62 
63 public:
64  explicit QGridLayout(QWidget *parent = nullptr);
65  ~QGridLayout();
66 
67  QSize sizeHint() const override;
68  QSize minimumSize() const override;
69  QSize maximumSize() const override;
70 
71  void setHorizontalSpacing(int spacing);
72  int horizontalSpacing() const;
73  void setVerticalSpacing(int spacing);
74  int verticalSpacing() const;
75  void setSpacing(int spacing) override;
76  int spacing() const override;
77 
78  void setRowStretch(int row, int stretch);
79  void setColumnStretch(int column, int stretch);
80  int rowStretch(int row) const;
81  int columnStretch(int column) const;
82 
83  void setRowMinimumHeight(int row, int minSize);
84  void setColumnMinimumWidth(int column, int minSize);
85  int rowMinimumHeight(int row) const;
86  int columnMinimumWidth(int column) const;
87 
88  int columnCount() const;
89  int rowCount() const;
90 
91  QRect cellRect(int row, int column) const;
92 
93  bool hasHeightForWidth() const override;
94  int heightForWidth(int) const override;
95  int minimumHeightForWidth(int) const override;
96 
97  Qt::Orientations expandingDirections() const override;
98  void invalidate() override;
99 
100  inline void addWidget(QWidget *w) { QLayout::addWidget(w); }
101  void addWidget(QWidget *, int row, int column, Qt::Alignment = Qt::Alignment());
102  void addWidget(QWidget *, int row, int column, int rowSpan, int columnSpan, Qt::Alignment = Qt::Alignment());
103  void addLayout(QLayout *, int row, int column, Qt::Alignment = Qt::Alignment());
104  void addLayout(QLayout *, int row, int column, int rowSpan, int columnSpan, Qt::Alignment = Qt::Alignment());
105 
106  void setOriginCorner(Qt::Corner);
107  Qt::Corner originCorner() const;
108 
109  QLayoutItem *itemAt(int index) const override;
110  QLayoutItem *itemAtPosition(int row, int column) const;
111  QLayoutItem *takeAt(int index) override;
112  int count() const override;
113  void setGeometry(const QRect&) override;
114 
115  void addItem(QLayoutItem *item, int row, int column, int rowSpan = 1, int columnSpan = 1, Qt::Alignment = Qt::Alignment());
116 
117  void setDefaultPositioning(int n, Qt::Orientation orient);
118  void getItemPosition(int idx, int *row, int *column, int *rowSpan, int *columnSpan) const;
119 
120 protected:
121  void addItem(QLayoutItem *) override;
122 
123 private:
125 
126 };
127 
129 
130 #endif // QGRIDLAYOUT_H
FT_UInt idx
Definition: cffcmap.c:135
The QGridLayout class lays out widgets in a grid.
Definition: qgridlayout.h:57
void addWidget(QWidget *w)
Definition: qgridlayout.h:100
The QLayout class is the base class of geometry managers.
Definition: qlayout.h:62
void addWidget(QWidget *w)
Definition: qlayout.cpp:223
int spacing
the spacing between widgets inside the layout
Definition: qlayout.h:66
QSize maximumSize() const override
Definition: qlayout.cpp:960
virtual void setSpacing(int)
Definition: qlayout.cpp:303
virtual void addItem(QLayoutItem *)=0
virtual QLayoutItem * itemAt(int index) const =0
virtual QLayoutItem * takeAt(int index)=0
Qt::Orientations expandingDirections() const override
Definition: qlayout.cpp:977
QSize minimumSize() const override
Definition: qlayout.cpp:945
void invalidate() override
Definition: qlayout.cpp:506
virtual int count() const =0
virtual void setGeometry(const QRect &) override
Definition: qlayout.cpp:488
The QLayoutItem class provides an abstract item that a QLayout manipulates.
Definition: qlayoutitem.h:61
virtual bool hasHeightForWidth() const
virtual int heightForWidth(int) const
virtual int minimumHeightForWidth(int) const
virtual QSize sizeHint() const =0
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:59
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:55
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:133
qreal spacing
union Alignment_ Alignment
Corner
Definition: qnamespace.h:1287
Orientation
Definition: qnamespace.h:123
#define Q_DISABLE_COPY(Class)
Definition: qglobal.h:515
GLfloat GLfloat GLfloat w
[0]
GLuint index
[2]
GLfloat n
GLenum GLenum GLsizei void GLsizei void * column
Definition: qopenglext.h:2747
GLenum GLenum GLsizei void * row
Definition: qopenglext.h:2747
#define Q_OBJECT
Definition: qtmetamacros.h:158
#define QDOC_PROPERTY(text)
Definition: qtmetamacros.h:98
QGraphicsItem * item
const int rowCount
Definition: testtable1.cpp:31
const int columnCount
Definition: testtable2.cpp:31
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent