Qt 4.8
qgraphicsgridlayout.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtGui 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 Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #ifndef QGRAPHICSGRIDLAYOUT_H
43 #define QGRAPHICSGRIDLAYOUT_H
44 
45 #include <QtGui/qgraphicsitem.h>
46 #include <QtGui/qgraphicslayout.h>
47 
49 
51 
52 QT_MODULE(Gui)
53 
54 #if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
55 
57 
59 {
60 public:
62  virtual ~QGraphicsGridLayout();
63 
64  void addItem(QGraphicsLayoutItem *item, int row, int column, int rowSpan, int columnSpan,
65  Qt::Alignment alignment = 0);
66  inline void addItem(QGraphicsLayoutItem *item, int row, int column, Qt::Alignment alignment = 0);
67 
68  void setHorizontalSpacing(qreal spacing);
69  qreal horizontalSpacing() const;
70  void setVerticalSpacing(qreal spacing);
71  qreal verticalSpacing() const;
72  void setSpacing(qreal spacing);
73 
74  void setRowSpacing(int row, qreal spacing);
75  qreal rowSpacing(int row) const;
76  void setColumnSpacing(int column, qreal spacing);
77  qreal columnSpacing(int column) const;
78 
79  void setRowStretchFactor(int row, int stretch);
80  int rowStretchFactor(int row) const;
81  void setColumnStretchFactor(int column, int stretch);
82  int columnStretchFactor(int column) const;
83 
84  void setRowMinimumHeight(int row, qreal height);
85  qreal rowMinimumHeight(int row) const;
86  void setRowPreferredHeight(int row, qreal height);
87  qreal rowPreferredHeight(int row) const;
88  void setRowMaximumHeight(int row, qreal height);
89  qreal rowMaximumHeight(int row) const;
90  void setRowFixedHeight(int row, qreal height);
91 
92  void setColumnMinimumWidth(int column, qreal width);
93  qreal columnMinimumWidth(int column) const;
94  void setColumnPreferredWidth(int column, qreal width);
95  qreal columnPreferredWidth(int column) const;
96  void setColumnMaximumWidth(int column, qreal width);
97  qreal columnMaximumWidth(int column) const;
98  void setColumnFixedWidth(int column, qreal width);
99 
100  void setRowAlignment(int row, Qt::Alignment alignment);
101  Qt::Alignment rowAlignment(int row) const;
102  void setColumnAlignment(int column, Qt::Alignment alignment);
103  Qt::Alignment columnAlignment(int column) const;
104 
105  void setAlignment(QGraphicsLayoutItem *item, Qt::Alignment alignment);
106  Qt::Alignment alignment(QGraphicsLayoutItem *item) const;
107 
108  int rowCount() const;
109  int columnCount() const;
110 
111  QGraphicsLayoutItem *itemAt(int row, int column) const;
112 
113  // inherited from QGraphicsLayout
114  int count() const;
115  QGraphicsLayoutItem *itemAt(int index) const;
116  void removeAt(int index);
117  void removeItem(QGraphicsLayoutItem *item);
118 
119  void invalidate();
120 
121  // inherited from QGraphicsLayoutItem
122  void setGeometry(const QRectF &rect);
123  QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
124 
125  // ####
126  //QRect cellRect(int row, int column, int rowSpan = 1, int columnSpan = 1) const;
127  //QSizePolicy::ControlTypes controlTypes(LayoutSide side) const;
128 
129 private:
132 };
133 
134 inline void QGraphicsGridLayout::addItem(QGraphicsLayoutItem *aitem, int arow, int acolumn, Qt::Alignment aalignment)
135 { addItem(aitem, arow, acolumn, 1, 1, aalignment); }
136 
137 #endif
138 
140 
142 
143 #endif
144 
virtual void removeAt(int index)=0
This pure virtual function must be reimplemented in a subclass of QGraphicsLayout to remove the item ...
virtual void setGeometry(const QRectF &rect)
This virtual function sets the geometry of the QGraphicsLayoutItem to rect, which is in parent coordi...
double qreal
Definition: qglobal.h:1193
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
#define QT_MODULE(x)
Definition: qglobal.h:2783
#define QT_BEGIN_HEADER
Definition: qglobal.h:136
#define Q_GUI_EXPORT
Definition: qglobal.h:1450
The QGraphicsGridLayout class provides a grid layout for managing widgets in Graphics View...
#define Q_DISABLE_COPY(Class)
Disables the use of copy constructors and assignment operators for the given Class.
Definition: qglobal.h:2523
The QSizeF class defines the size of a two-dimensional object using floating point precision...
Definition: qsize.h:202
void addItem(QGraphicsLayoutItem *item, int row, int column, int rowSpan, int columnSpan, Qt::Alignment alignment=0)
Adds item to the grid on row and column.
virtual void invalidate()
Clears any cached geometry and size hint information in the layout, and posts a LayoutRequest event t...
virtual QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint=QSizeF()) const =0
This pure virtual function returns the size hint for which of the QGraphicsLayoutItem, using the width or height of constraint to constrain the output.
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
The QGraphicsLayoutItem class can be inherited to allow your custom items to be managed by layouts...
virtual int count() const =0
This pure virtual function must be reimplemented in a subclass of QGraphicsLayout to return the numbe...
SizeHint
Definition: qnamespace.h:1708
The QGraphicsLayout class provides the base class for all layouts in Graphics View.
quint16 index
#define Q_DECLARE_PRIVATE(Class)
Definition: qglobal.h:2467
virtual QGraphicsLayoutItem * itemAt(int i) const =0
This pure virtual function must be reimplemented in a subclass of QGraphicsLayout to return a pointer...
#define QT_END_HEADER
Definition: qglobal.h:137