Qt 4.8
qdeclarativeanchors_p_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 QDECLARATIVEANCHORS_P_H
43 #define QDECLARATIVEANCHORS_P_H
44 
45 //
46 // W A R N I N G
47 // -------------
48 //
49 // This file is not part of the Qt API. It exists purely as an
50 // implementation detail. This header file may change from version to
51 // version without notice, or even be removed.
52 //
53 // We mean it.
54 //
55 
56 #include "private/qdeclarativeanchors_p.h"
57 #include "private/qdeclarativeitemchangelistener_p.h"
58 #include <private/qobject_p.h>
59 
61 
63 {
64 public:
66 
67  enum AnchorLine {
68  Invalid = 0x0,
69  Left = 0x01,
70  Right = 0x02,
71  Top = 0x04,
72  Bottom = 0x08,
73  HCenter = 0x10,
74  VCenter = 0x20,
75  Baseline = 0x40,
78  };
79 
82 };
83 
85 {
86  return a.item == b.item && a.anchorLine == b.anchorLine;
87 }
88 
90 {
92 public:
94  : componentComplete(true), updatingMe(false), updatingHorizontalAnchor(0),
95  updatingVerticalAnchor(0), updatingFill(0), updatingCenterIn(0), item(i), usedAnchors(0), fill(0),
96  centerIn(0), leftMargin(0), rightMargin(0), topMargin(0), bottomMargin(0),
97  margins(0), vCenterOffset(0), hCenterOffset(0), baselineOffset(0)
98  {
99  }
100 
101  void clearItem(QGraphicsObject *);
102 
103  void addDepend(QGraphicsObject *);
104  void remDepend(QGraphicsObject *);
105  bool isItemComplete() const;
106 
108  bool updatingMe:1;
113 
114  void setItemHeight(qreal);
115  void setItemWidth(qreal);
116  void setItemX(qreal);
117  void setItemY(qreal);
118  void setItemPos(const QPointF &);
119  void setItemSize(const QSizeF &);
120 
121  void updateOnComplete();
122  void updateMe();
123 
124  // QDeclarativeItemGeometryListener interface
125  void itemGeometryChanged(QDeclarativeItem *, const QRectF &, const QRectF &);
126  void _q_widgetDestroyed(QObject *);
127  void _q_widgetGeometryChanged();
129 
130  bool checkHValid() const;
131  bool checkVValid() const;
132  bool checkHAnchorValid(QDeclarativeAnchorLine anchor) const;
133  bool checkVAnchorValid(QDeclarativeAnchorLine anchor) const;
134  bool calcStretch(const QDeclarativeAnchorLine &edge1, const QDeclarativeAnchorLine &edge2, qreal offset1, qreal offset2, QDeclarativeAnchorLine::AnchorLine line, qreal &stretch);
135 
136  bool isMirrored() const;
137  void updateHorizontalAnchors();
138  void updateVerticalAnchors();
139  void fillChanged();
140  void centerInChanged();
141 
143  QDeclarativeAnchors::Anchors usedAnchors;
144 
147 
155 
164 };
165 
167 
169 
170 #endif
double qreal
Definition: qglobal.h:1193
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
QDeclarativeAnchorsPrivate(QGraphicsObject *i)
QDeclarativeAnchorsPrivate * anchorPrivate()
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
long ASN1_INTEGER_get ASN1_INTEGER * a
bool operator==(const QDeclarativeAnchorLine &a, const QDeclarativeAnchorLine &b)
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
#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 QDeclarativeItem class provides the most basic of all visual items in QML.
QDeclarativeAnchors::Anchors usedAnchors
unsigned int uint
Definition: qglobal.h:996
#define Q_DECLARE_METATYPE(TYPE)
This macro makes the type Type known to QMetaType as long as it provides a public default constructor...
Definition: qmetatype.h:265
#define Q_DECLARE_PUBLIC(Class)
Definition: qglobal.h:2477
The QGraphicsObject class provides a base class for all graphics items that require signals...