Qt 4.8
qgraphicslinearlayout.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 QGRAPHICSLINEARLAYOUT_H
43 #define QGRAPHICSLINEARLAYOUT_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:
63  virtual ~QGraphicsLinearLayout();
64 
65  void setOrientation(Qt::Orientation orientation);
66  Qt::Orientation orientation() const;
67 
68  inline void addItem(QGraphicsLayoutItem *item) { insertItem(-1, item); }
69  inline void addStretch(int stretch = 1) { insertStretch(-1, stretch); }
70 
71  void insertItem(int index, QGraphicsLayoutItem *item);
72  void insertStretch(int index, int stretch = 1);
73 
74  void removeItem(QGraphicsLayoutItem *item);
75  void removeAt(int index);
76 
77  void setSpacing(qreal spacing);
78  qreal spacing() const;
79  void setItemSpacing(int index, qreal spacing);
80  qreal itemSpacing(int index) const;
81 
82  void setStretchFactor(QGraphicsLayoutItem *item, int stretch);
83  int stretchFactor(QGraphicsLayoutItem *item) const;
84 
85  void setAlignment(QGraphicsLayoutItem *item, Qt::Alignment alignment);
86  Qt::Alignment alignment(QGraphicsLayoutItem *item) const;
87 
88  void setGeometry(const QRectF &rect);
89 
90  int count() const;
91  QGraphicsLayoutItem *itemAt(int index) const;
92 
93  void invalidate();
94  QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
95 
96 #if 0 // ###
97  Q5SizePolicy::ControlTypes controlTypes(LayoutSide side) const;
98 #endif
99 
100  void dump(int indent = 0) const;
101 
102 protected:
103 #if 0
104  QSize contentsSizeHint(Qt::SizeHint which, const QSize &constraint = QSize()) const;
105 #endif
106 
107 private:
110 };
111 
112 #endif
113 
115 
117 
118 #endif
119 
virtual void removeAt(int index)=0
This pure virtual function must be reimplemented in a subclass of QGraphicsLayout to remove the item ...
void addItem(QGraphicsLayoutItem *item)
This convenience function is equivalent to calling insertItem(-1, 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
void addStretch(int stretch=1)
This convenience function is equivalent to calling insertStretch(-1, stretch).
#define Q_GUI_EXPORT
Definition: qglobal.h:1450
#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
virtual void invalidate()
Clears any cached geometry and size hint information in the layout, and posts a LayoutRequest event t...
The QGraphicsLinearLayout class provides a horizontal or vertical layout for managing widgets in Grap...
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.
static QString dump(const QByteArray &)
quint16 index
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
#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...
Orientation
Definition: qnamespace.h:174
#define QT_END_HEADER
Definition: qglobal.h:137