QtGui/qgraphicsgridlayout.h Source File

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 
56 class QGraphicsGridLayoutPrivate;
57 
58 class Q_GUI_EXPORT QGraphicsGridLayout : public QGraphicsLayout
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:
130  Q_DISABLE_COPY(QGraphicsGridLayout)
131  Q_DECLARE_PRIVATE(QGraphicsGridLayout)
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 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint=QSizeF()) const =0
virtual void removeAt(int index)=0
#define QT_END_NAMESPACE
Definition: qglobal.h:128
virtual void invalidate()
#define QT_BEGIN_HEADER
Definition: qglobal.h:141
GLenum GLsizei width
Definition: GLee.h:873
GLenum GLenum GLvoid * row
Definition: GLee.h:893
SizeHint
Definition: qnamespace.h:1708
#define QT_BEGIN_NAMESPACE
Definition: qglobal.h:127
GLenum GLsizei GLsizei height
Definition: GLee.h:883
Definition: qsize.h:202
virtual int count() const =0
Definition: qrect.h:511
GLenum GLenum GLvoid GLvoid * column
Definition: GLee.h:893
virtual void setGeometry(const QRectF &rect)
void addItem(QGraphicsLayoutItem *item, int row, int column, int rowSpan, int columnSpan, Qt::Alignment alignment=0)
virtual QGraphicsLayoutItem * itemAt(int i) const =0
#define QT_END_HEADER
Definition: qglobal.h:142
GLuint index
Definition: GLee.h:1704