Qt 4.8
qsvgnode_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 QtSvg 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 QSVGNODE_P_H
43 #define QSVGNODE_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 "qsvgstyle_p.h"
57 
58 #ifndef QT_NO_SVG
59 
60 #include "QtCore/qstring.h"
61 #include "QtCore/qhash.h"
62 
64 
65 class QPainter;
66 class QSvgTinyDocument;
67 
68 class QSvgNode
69 {
70 public:
71  enum Type
72  {
73  DOC,
74  G,
78  ARC,
90  USE,
92  };
93  enum DisplayMode {
112  };
113 public:
115  virtual ~QSvgNode();
116  virtual void draw(QPainter *p, QSvgExtraStates &states) =0;
117 
118  QSvgNode *parent() const;
119 
120  void appendStyleProperty(QSvgStyleProperty *prop, const QString &id);
121  void applyStyle(QPainter *p, QSvgExtraStates &states) const;
122  void revertStyle(QPainter *p, QSvgExtraStates &states) const;
124  QSvgFillStyleProperty *styleProperty(const QString &id) const;
125 
126  QSvgTinyDocument *document() const;
127 
128  virtual Type type() const =0;
129  virtual QRectF bounds(QPainter *p, QSvgExtraStates &states) const;
130  virtual QRectF transformedBounds(QPainter *p, QSvgExtraStates &states) const;
131  QRectF transformedBounds() const;
132 
133  void setRequiredFeatures(const QStringList &lst);
134  const QStringList & requiredFeatures() const;
135 
136  void setRequiredExtensions(const QStringList &lst);
137  const QStringList & requiredExtensions() const;
138 
139  void setRequiredLanguages(const QStringList &lst);
140  const QStringList & requiredLanguages() const;
141 
142  void setRequiredFormats(const QStringList &lst);
143  const QStringList & requiredFormats() const;
144 
145  void setRequiredFonts(const QStringList &lst);
146  const QStringList & requiredFonts() const;
147 
148  void setVisible(bool visible);
149  bool isVisible() const;
150 
152  DisplayMode displayMode() const;
153 
154  QString nodeId() const;
155  void setNodeId(const QString &i);
156 
157  QString xmlClass() const;
158  void setXmlClass(const QString &str);
159 protected:
161 
162  static qreal strokeWidth(QPainter *p);
163 private:
165 
171 
172  bool m_visible;
173 
176 
179 
180  friend class QSvgTinyDocument;
181 };
182 
183 inline QSvgNode *QSvgNode::parent() const
184 {
185  return m_parent;
186 }
187 
188 inline bool QSvgNode::isVisible() const
189 {
190  return m_visible;
191 }
192 
193 inline QString QSvgNode::nodeId() const
194 {
195  return m_id;
196 }
197 
199 {
200  return m_class;
201 }
202 
204 
205 #endif // QT_NO_SVG
206 #endif // QSVGNODE_P_H
The QPainter class performs low-level painting on widgets and other paint devices.
Definition: qpainter.h:86
virtual Type type() const =0
double qreal
Definition: qglobal.h:1193
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
void appendStyleProperty(QSvgStyleProperty *prop, const QString &id)
Definition: qsvgnode.cpp:64
QSvgStyle m_style
Definition: qsvgnode_p.h:160
const QStringList & requiredFormats() const
Definition: qsvgnode.cpp:280
void setRequiredExtensions(const QStringList &lst)
Definition: qsvgnode.cpp:255
const QStringList & requiredExtensions() const
Definition: qsvgnode.cpp:260
QRectF transformedBounds() const
Definition: qsvgnode.cpp:204
QStringList m_requiredFormats
Definition: qsvgnode_p.h:169
void setXmlClass(const QString &str)
Definition: qsvgnode.cpp:320
DisplayMode m_displayMode
Definition: qsvgnode_p.h:177
void applyStyle(QPainter *p, QSvgExtraStates &states) const
Definition: qsvgnode.cpp:118
QSvgNode * parent() const
Definition: qsvgnode_p.h:183
The QString class provides a Unicode character string.
Definition: qstring.h:83
QSvgNode(QSvgNode *parent=0)
Definition: qsvgnode.cpp:52
QStringList m_requiredLanguages
Definition: qsvgnode_p.h:168
void setRequiredLanguages(const QStringList &lst)
Definition: qsvgnode.cpp:265
const QStringList & requiredFeatures() const
Definition: qsvgnode.cpp:250
virtual QRectF bounds(QPainter *p, QSvgExtraStates &states) const
Definition: qsvgnode.cpp:199
bool isVisible() const
Definition: qsvgnode_p.h:188
#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
Q_GUI_EXPORT EGLDisplay display()
Definition: qegl.cpp:589
QStringList m_requiredFeatures
Definition: qsvgnode_p.h:166
QSvgNode * m_parent
Definition: qsvgnode_p.h:164
DisplayMode displayMode() const
Definition: qsvgnode.cpp:330
bool m_visible
Definition: qsvgnode_p.h:172
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
void setRequiredFormats(const QStringList &lst)
Definition: qsvgnode.cpp:275
void setRequiredFeatures(const QStringList &lst)
Definition: qsvgnode.cpp:245
static qreal strokeWidth(QPainter *p)
Definition: qsvgnode.cpp:335
QString m_class
Definition: qsvgnode_p.h:175
QString xmlClass() const
Definition: qsvgnode_p.h:198
const QStringList & requiredFonts() const
Definition: qsvgnode.cpp:290
virtual ~QSvgNode()
Definition: qsvgnode.cpp:59
QSvgStyleProperty * styleProperty(QSvgStyleProperty::Type type) const
Definition: qsvgnode.cpp:128
QString nodeId() const
Definition: qsvgnode_p.h:193
QStringList m_requiredExtensions
Definition: qsvgnode_p.h:167
void setDisplayMode(DisplayMode display)
Definition: qsvgnode.cpp:325
const QStringList & requiredLanguages() const
Definition: qsvgnode.cpp:270
QStringList m_requiredFonts
Definition: qsvgnode_p.h:170
virtual void draw(QPainter *p, QSvgExtraStates &states)=0
void setVisible(bool visible)
Definition: qsvgnode.cpp:295
void setNodeId(const QString &i)
Definition: qsvgnode.cpp:315
QSvgTinyDocument * document() const
Definition: qsvgnode.cpp:233
void setRequiredFonts(const QStringList &lst)
Definition: qsvgnode.cpp:285
void revertStyle(QPainter *p, QSvgExtraStates &states) const
Definition: qsvgnode.cpp:123
QString m_id
Definition: qsvgnode_p.h:174
QRectF m_cachedBounds
Definition: qsvgnode_p.h:178