Qt 4.8
qgraphicsanchorlayout.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 QGRAPHICSANCHORLAYOUT_H
43 #define QGRAPHICSANCHORLAYOUT_H
44 
45 #include <QtGui/qgraphicsitem.h>
46 #include <QtGui/qgraphicslayout.h>
47 
48 
50 
52 
53 QT_MODULE(Gui)
54 
55 #if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
56 
60 
62 {
63  Q_OBJECT
66 public:
67  void setSpacing(qreal spacing);
68  void unsetSpacing();
69  qreal spacing() const;
70  void setSizePolicy(QSizePolicy::Policy policy);
71  QSizePolicy::Policy sizePolicy() const;
72  ~QGraphicsAnchor();
73 private:
75 
77 
79  friend struct AnchorData;
80 };
81 
83 {
84 public:
86  virtual ~QGraphicsAnchorLayout();
87 
88  QGraphicsAnchor *addAnchor(QGraphicsLayoutItem *firstItem, Qt::AnchorPoint firstEdge,
89  QGraphicsLayoutItem *secondItem, Qt::AnchorPoint secondEdge);
90  QGraphicsAnchor *anchor(QGraphicsLayoutItem *firstItem, Qt::AnchorPoint firstEdge,
91  QGraphicsLayoutItem *secondItem, Qt::AnchorPoint secondEdge);
92 
93  void addCornerAnchors(QGraphicsLayoutItem *firstItem, Qt::Corner firstCorner,
94  QGraphicsLayoutItem *secondItem, Qt::Corner secondCorner);
95 
96  void addAnchors(QGraphicsLayoutItem *firstItem,
97  QGraphicsLayoutItem *secondItem,
98  Qt::Orientations orientations = Qt::Horizontal | Qt::Vertical);
99 
100  void setHorizontalSpacing(qreal spacing);
101  void setVerticalSpacing(qreal spacing);
102  void setSpacing(qreal spacing);
103  qreal horizontalSpacing() const;
104  qreal verticalSpacing() const;
105 
106  void removeAt(int index);
107  void setGeometry(const QRectF &rect);
108  int count() const;
109  QGraphicsLayoutItem *itemAt(int index) const;
110 
111  void invalidate();
112 protected:
113  QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
114 
115 private:
118 
120 };
121 
122 #endif
123 
125 
127 
128 #endif
Represents an edge (anchor) in the internal graph.
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 QGraphicsAnchor class represents an anchor between two items in a QGraphicsAnchorLayout.
#define Q_DISABLE_COPY(Class)
Disables the use of copy constructors and assignment operators for the given Class.
Definition: qglobal.h:2523
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
The QSizeF class defines the size of a two-dimensional object using floating point precision...
Definition: qsize.h:202
AnchorPoint
Definition: qnamespace.h:1586
#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...
#define Q_OBJECT
Definition: qobjectdefs.h:157
The QGraphicsAnchorLayout class provides a layout where one can anchor widgets together in Graphics V...
Corner
Definition: qnamespace.h:1456
SizeHint
Definition: qnamespace.h:1708
QSizePolicy::Policy sizePolicy
the size policy for the QGraphicsAnchor.
The QGraphicsLayout class provides the base class for all layouts in Graphics View.
quint16 index
#define Q_DECLARE_PRIVATE(Class)
Definition: qglobal.h:2467
qreal spacing
the preferred space between items in the QGraphicsAnchorLayout.
#define class
#define QT_END_HEADER
Definition: qglobal.h:137
QGraphicsAnchorLayout private methods and attributes.