Qt 4.8
qdeclarativepainteditem_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 QDECLARATIVEIMAGEITEM_H
43 #define QDECLARATIVEIMAGEITEM_H
44 
45 #include "qdeclarativeitem.h"
46 
48 
50 
51 QT_MODULE(Declarative)
52 
55 {
56  Q_OBJECT
57 
63 
64 
65 public:
68 
69  QSize contentsSize() const;
70  void setContentsSize(const QSize &);
71 
72  qreal contentsScale() const;
73  void setContentsScale(qreal);
74 
75  int pixelCacheSize() const;
76  void setPixelCacheSize(int pixels);
77 
78  bool smoothCache() const;
79  void setSmoothCache(bool on);
80 
81  QColor fillColor() const;
82  void setFillColor(const QColor&);
83 
84  void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *);
85 
86 protected:
88 
89  virtual void drawContents(QPainter *p, const QRect &) = 0;
90  virtual void geometryChanged(const QRectF &newGeometry,
91  const QRectF &oldGeometry);
92  virtual QVariant itemChange(GraphicsItemChange change,
93  const QVariant &value);
94 
95  void setCacheFrozen(bool);
96  QRectF boundingRect() const;
97 
98 Q_SIGNALS:
99  void fillColorChanged();
100  void contentsSizeChanged();
101  void contentsScaleChanged();
102 
103 protected Q_SLOTS:
104  void dirtyCache(const QRect &);
105  void clearCache();
106 
107 private:
110 };
111 
113 
115 
117 
118 #endif
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
QColor fillColor
The color to be used to fill the item prior to calling drawContents().
The QPainter class performs low-level painting on widgets and other paint devices.
Definition: qpainter.h:86
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
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
QScopedPointer< QGraphicsItemPrivate > d_ptr
#define QML_DECLARE_TYPE(TYPE)
Definition: qdeclarative.h:56
#define QT_BEGIN_HEADER
Definition: qglobal.h:136
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#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
QRectF boundingRect() const
The QDeclarativePaintedItem class is an abstract base class for QDeclarativeView items that want cach...
#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.
QVariant data(int key) const
Returns this item&#39;s custom data for the key key as a QVariant.
int pixelCacheSize
The maximum number of pixels of image cache to allow.
virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
This function is called to handle this item&#39;s changes in geometry from oldGeometry to newGeometry...
#define Q_OBJECT
Definition: qobjectdefs.h:157
#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...
virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *)
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
#define Q_AUTOTEST_EXPORT
Definition: qglobal.h:1510
QSize contentsSize
The size of the contents.
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
#define QT_END_HEADER
Definition: qglobal.h:137
The QStyleOptionGraphicsItem class is used to describe the parameters needed to draw a QGraphicsItem...
Definition: qstyleoption.h:867