Qt 4.8
qdeclarativepositioners_p.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 QtDeclarative 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 QDECLARATIVELAYOUTS_H
43 #define QDECLARATIVELAYOUTS_H
44 
46 
47 #include <private/qdeclarativestate_p.h>
48 #include <private/qpodvector_p.h>
49 
50 #include <QtCore/QObject>
51 #include <QtCore/QString>
52 
54 
56 
57 QT_MODULE(Declarative)
59 
61 {
62  Q_OBJECT
63 
64  int spacing;
67 public:
68  enum PositionerType { None = 0x0, Horizontal = 0x1, Vertical = 0x2, Both = 0x3 };
71 
72  int spacing() const;
73  void setSpacing(int);
74 
75  QDeclarativeTransition *move() const;
76  void setMove(QDeclarativeTransition *);
77 
78  QDeclarativeTransition *add() const;
79  void setAdd(QDeclarativeTransition *);
80 
81 protected:
83  virtual void componentComplete();
85  void finishApplyTransitions();
86 
87 Q_SIGNALS:
88  void spacingChanged();
89  void moveChanged();
90  void addChanged();
91 
92 protected Q_SLOTS:
93  void prePositioning();
94  void graphicsWidgetGeometryChanged();
95 
96 protected:
97  virtual void doPositioning(QSizeF *contentSize)=0;
98  virtual void reportConflictingAnchors()=0;
100  public :
101  PositionedItem(QGraphicsObject *i) : item(i), isNew(false), isVisible(true) {}
102  bool operator==(const PositionedItem &other) const { return other.item == item; }
104  bool isNew;
105  bool isVisible;
106  };
107 
109  void positionX(int,const PositionedItem &target);
110  void positionY(int,const PositionedItem &target);
111 
112 private:
115 };
116 
118 {
119  Q_OBJECT
120 public:
122 protected:
123  virtual void doPositioning(QSizeF *contentSize);
124  virtual void reportConflictingAnchors();
125 private:
127 };
128 
130 {
131  Q_OBJECT
133 public:
135 
136  Qt::LayoutDirection layoutDirection() const;
137  void setLayoutDirection (Qt::LayoutDirection);
138  Qt::LayoutDirection effectiveLayoutDirection() const;
139 
140 Q_SIGNALS:
141  Q_REVISION(1) void layoutDirectionChanged();
142 
143 protected:
144  virtual void doPositioning(QSizeF *contentSize);
145  virtual void reportConflictingAnchors();
146 private:
148 };
149 
151 {
152  Q_OBJECT
153  int rows;
154  int columns;
157 public:
159 
160  int rows() const {return m_rows;}
161  void setRows(const int rows);
162 
163  int columns() const {return m_columns;}
164  void setColumns(const int columns);
165 
166  Q_ENUMS(Flow)
167  enum Flow { LeftToRight, TopToBottom };
168  Flow flow() const;
169  void setFlow(Flow);
170 
171  Qt::LayoutDirection layoutDirection() const;
172  void setLayoutDirection (Qt::LayoutDirection);
173  Qt::LayoutDirection effectiveLayoutDirection() const;
174 
175 Q_SIGNALS:
176  void rowsChanged();
177  void columnsChanged();
178  void flowChanged();
179  Q_REVISION(1) void layoutDirectionChanged();
180 
181 protected:
182  virtual void doPositioning(QSizeF *contentSize);
183  virtual void reportConflictingAnchors();
184 
185 private:
186  int m_rows;
190 };
191 
194 {
195  Q_OBJECT
198 public:
200 
201  Q_ENUMS(Flow)
202  enum Flow { LeftToRight, TopToBottom };
203  Flow flow() const;
204  void setFlow(Flow);
205 
206  Qt::LayoutDirection layoutDirection() const;
207  void setLayoutDirection (Qt::LayoutDirection);
208  Qt::LayoutDirection effectiveLayoutDirection() const;
209 Q_SIGNALS:
210  void flowChanged();
211  Q_REVISION(1) void layoutDirectionChanged();
212 
213 protected:
214  virtual void doPositioning(QSizeF *contentSize);
215  virtual void reportConflictingAnchors();
216 protected:
218 private:
221 };
222 
223 
225 
230 
232 
233 #endif
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
bool operator==(const PositionedItem &other) const
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
#define QT_MODULE(x)
Definition: qglobal.h:2783
QScopedPointer< QGraphicsItemPrivate > d_ptr
#define add(aName)
#define QML_DECLARE_TYPE(TYPE)
Definition: qdeclarative.h:56
#define QT_BEGIN_HEADER
Definition: qglobal.h:136
#define at(className, varName)
#define Q_DISABLE_COPY(Class)
Disables the use of copy constructors and assignment operators for the given Class.
Definition: qglobal.h:2523
GraphicsItemChange
This enum describes the state changes that are notified by QGraphicsItem::itemChange().
#define Q_SLOTS
Definition: qobjectdefs.h:71
#define Q_SIGNALS
Definition: qobjectdefs.h:72
The QSizeF class defines the size of a two-dimensional object using floating point precision...
Definition: qsize.h:202
#define Q_ENUMS(x)
Definition: qobjectdefs.h:84
Qt::LayoutDirection layoutDirection
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
The QDeclarativeItem class provides the most basic of all visual items in QML.
The QDeclarativeBasePositioner class provides a base for QDeclarativeGraphics layouts.
LayoutDirection
Definition: qnamespace.h:1580
static const char * data(const QByteArray &arr)
#define Q_DECLARATIVE_PRIVATE_EXPORT
#define Q_OBJECT
Definition: qobjectdefs.h:157
#define None
#define Q_DECLARE_PRIVATE_D(Dptr, Class)
Definition: qglobal.h:2472
virtual QVariant itemChange(GraphicsItemChange, const QVariant &)
Note that unlike QGraphicsItems, QDeclarativeItem::itemChange() is not called during initial widget p...
The Flow item arranges its children side by side, wrapping as necessary.
virtual void componentComplete()
#define Q_AUTOTEST_EXPORT
Definition: qglobal.h:1510
QPODVector< PositionedItem, 8 > positionedItems
Qt::LayoutDirection layoutDirection
#define class
The QGraphicsObject class provides a base class for all graphics items that require signals...
#define QT_END_HEADER
Definition: qglobal.h:137
#define private
Definition: qregion_qws.cpp:43
Qt::LayoutDirection layoutDirection