1 // Commit: ac5c099cc3c5b8c7eec7a49fdeb8a21037230350
2 /****************************************************************************
4 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
5 ** All rights reserved.
6 ** Contact: Nokia Corporation (qt-info@nokia.com)
8 ** This file is part of the QtDeclarative module of the Qt Toolkit.
10 ** $QT_BEGIN_LICENSE:LGPL$
11 ** No Commercial Usage
12 ** This file contains pre-release code and may not be distributed.
13 ** You may use this file in accordance with the terms and conditions
14 ** contained in the Technology Preview License Agreement accompanying
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.
25 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights. These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
41 ****************************************************************************/
43 #ifndef QSGPAINTEDITEM_P_H
44 #define QSGPAINTEDITEM_P_H
52 class QSGPaintedItemPrivate;
53 class Q_DECLARATIVE_EXPORT QSGPaintedItem : public QSGItem
58 Q_PROPERTY(QSize contentsSize READ contentsSize WRITE setContentsSize NOTIFY contentsSizeChanged)
59 Q_PROPERTY(QColor fillColor READ fillColor WRITE setFillColor NOTIFY fillColorChanged)
60 Q_PROPERTY(int pixelCacheSize READ pixelCacheSize WRITE setPixelCacheSize)
61 Q_PROPERTY(bool smoothCache READ smoothCache WRITE setSmoothCache)
62 Q_PROPERTY(qreal contentsScale READ contentsScale WRITE setContentsScale NOTIFY contentsScaleChanged)
63 Q_PROPERTY(RenderTarget renderTarget READ renderTarget WRITE setRenderTarget NOTIFY renderTargetChanged)
65 QSGPaintedItem(QSGItem *parent = 0);
66 virtual ~QSGPaintedItem();
73 void update(const QRect &rect = QRect());
75 bool opaquePainting() const;
76 void setOpaquePainting(bool opaque);
78 QSize contentsSize() const;
79 void setContentsSize(const QSize &);
80 void resetContentsSize();
82 qreal contentsScale() const;
83 void setContentsScale(qreal);
85 int pixelCacheSize() const;
86 void setPixelCacheSize(int pixels);
88 bool smoothCache() const;
89 void setSmoothCache(bool on);
91 QColor fillColor() const;
92 void setFillColor(const QColor&);
94 RenderTarget renderTarget() const;
95 void setRenderTarget(RenderTarget target);
97 virtual void paint(QPainter *painter) = 0;
100 void fillColorChanged();
101 void contentsSizeChanged();
102 void contentsScaleChanged();
103 void renderTargetChanged();
106 QSGPaintedItem(QSGPaintedItemPrivate &dd, QSGItem *parent = 0);
107 virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
108 virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *);
111 Q_DISABLE_COPY(QSGPaintedItem);
112 Q_DECLARE_PRIVATE(QSGPaintedItem);
119 #endif // QSGPAINTEDITEM_P_H