Rename Qt Quick-specific classes to QQuick*
[profile/ivi/qtdeclarative.git] / src / declarative / items / qquickpainteditem.cpp
similarity index 74%
rename from src/declarative/items/qsgpainteditem.cpp
rename to src/declarative/items/qquickpainteditem.cpp
index 16c3b3d..5e5eb79 100644 (file)
 **
 ****************************************************************************/
 
-#include "qsgpainteditem.h"
-#include <private/qsgpainteditem_p.h>
-#include <private/qsgpainternode_p.h>
+#include "qquickpainteditem.h"
+#include <private/qquickpainteditem_p.h>
 
+#include <private/qsgpainternode_p.h>
 #include <private/qsgcontext_p.h>
 #include <private/qsgadaptationlayer_p.h>
+
 #include <qmath.h>
 
 QT_BEGIN_NAMESPACE
 
 /*!
-    \class QSGPaintedItem
-    \brief The QSGPaintedItem class provides a way to use the QPainter API in the
+    \class QQuickPaintedItem
+    \brief The QQuickPaintedItem class provides a way to use the QPainter API in the
     QML Scene Graph.
 
     \inmodule QtDeclarative
 
-    The QSGPaintedItem makes it possible to use the QPainter API with the QML Scene Graph.
+    The QQuickPaintedItem makes it possible to use the QPainter API with the QML Scene Graph.
     It sets up a textured rectangle in the Scene Graph and uses a QPainter to paint
     onto the texture. The render target can be either a QImage or a QOpenGLFramebufferObject.
     When the render target is a QImage, QPainter first renders into the image then
@@ -66,19 +67,19 @@ QT_BEGIN_NAMESPACE
 
     To enable QPainter to do anti-aliased rendering, use setAntialiasing().
 
-    QSGPaintedItem is meant to make it easier to port old code that is using the
+    QQuickPaintedItem is meant to make it easier to port old code that is using the
     QPainter API to the QML Scene Graph API and it should be used only for that purpose.
 
-    To write your own painted item, you first create a subclass of QSGPaintedItem, and then
+    To write your own painted item, you first create a subclass of QQuickPaintedItem, and then
     start by implementing its only pure virtual public function: paint(), which implements
     the actual painting. To get the size of the area painted by the item, use
     contentsBoundingRect().
 */
 
 /*!
-    \enum QSGPaintedItem::RenderTarget
+    \enum QQuickPaintedItem::RenderTarget
 
-    This enum describes QSGPaintedItem's render targets. The render target is the
+    This enum describes QQuickPaintedItem's render targets. The render target is the
     surface QPainter paints onto before the item is rendered on screen.
 
     \value Image The default; QPainter paints into a QImage using the raster paint engine.
@@ -95,13 +96,13 @@ QT_BEGIN_NAMESPACE
 */
 
 /*!
-    \enum QSGPaintedItem::PerformanceHint
+    \enum QQuickPaintedItem::PerformanceHint
 
     This enum describes flags that you can enable to improve rendering
-    performance in QSGPaintedItem. By default, none of these flags are set.
+    performance in QQuickPaintedItem. By default, none of these flags are set.
 
     \value FastFBOResizing If your item gets resized often and you are using the
-    QSGPaintedItem::FramebufferObject render target, set this flag to true to reduce the
+    QQuickPaintedItem::FramebufferObject render target, set this flag to true to reduce the
     item resizing time at the cost of using more graphics memory. Resizing a Framebuffer object
     is a costly operation, by enabling this property the Framebuffer Object will use a texture
     larger than the actual size of the item to avoid as much as possible resizing it.
@@ -110,11 +111,11 @@ QT_BEGIN_NAMESPACE
 /*!
     \internal
 */
-QSGPaintedItemPrivate::QSGPaintedItemPrivate()
-    : QSGItemPrivate()
+QQuickPaintedItemPrivate::QQuickPaintedItemPrivate()
+    : QQuickItemPrivate()
     , contentsScale(1.0)
     , fillColor(Qt::transparent)
-    , renderTarget(QSGPaintedItem::Image)
+    , renderTarget(QQuickPaintedItem::Image)
     , performanceHints(0)
     , geometryDirty(false)
     , contentsDirty(false)
@@ -125,10 +126,10 @@ QSGPaintedItemPrivate::QSGPaintedItemPrivate()
 }
 
 /*!
-    Constructs a QSGPaintedItem with the given \a parent item.
+    Constructs a QQuickPaintedItem with the given \a parent item.
  */
-QSGPaintedItem::QSGPaintedItem(QSGItem *parent)
-    : QSGItem(*(new QSGPaintedItemPrivate), parent)
+QQuickPaintedItem::QQuickPaintedItem(QQuickItem *parent)
+    : QQuickItem(*(new QQuickPaintedItemPrivate), parent)
 {
     setFlag(ItemHasContents);
 }
@@ -136,16 +137,16 @@ QSGPaintedItem::QSGPaintedItem(QSGItem *parent)
 /*!
     \internal
 */
-QSGPaintedItem::QSGPaintedItem(QSGPaintedItemPrivate &dd, QSGItem *parent)
-    : QSGItem(dd, parent)
+QQuickPaintedItem::QQuickPaintedItem(QQuickPaintedItemPrivate &dd, QQuickItem *parent)
+    : QQuickItem(dd, parent)
 {
     setFlag(ItemHasContents);
 }
 
 /*!
-    Destroys the QSGPaintedItem.
+    Destroys the QQuickPaintedItem.
 */
-QSGPaintedItem::~QSGPaintedItem()
+QQuickPaintedItem::~QQuickPaintedItem()
 {
 }
 
@@ -161,16 +162,16 @@ QSGPaintedItem::~QSGPaintedItem()
 
     \sa paint()
 */
-void QSGPaintedItem::update(const QRect &rect)
+void QQuickPaintedItem::update(const QRect &rect)
 {
-    Q_D(QSGPaintedItem);
+    Q_D(QQuickPaintedItem);
     d->contentsDirty = true;
 
     if (rect.isNull() && !d->dirtyRect.isNull())
         d->dirtyRect = contentsBoundingRect().toAlignedRect();
     else
         d->dirtyRect |= (contentsBoundingRect() & rect).toAlignedRect();
-    QSGItem::update();
+    QQuickItem::update();
 }
 
 /*!
@@ -180,9 +181,9 @@ void QSGPaintedItem::update(const QRect &rect)
 
     \sa setOpaquePainting()
 */
-bool QSGPaintedItem::opaquePainting() const
+bool QQuickPaintedItem::opaquePainting() const
 {
-    Q_D(const QSGPaintedItem);
+    Q_D(const QQuickPaintedItem);
     return d->opaquePainting;
 }
 
@@ -196,15 +197,15 @@ bool QSGPaintedItem::opaquePainting() const
 
     \sa opaquePainting()
 */
-void QSGPaintedItem::setOpaquePainting(bool opaque)
+void QQuickPaintedItem::setOpaquePainting(bool opaque)
 {
-    Q_D(QSGPaintedItem);
+    Q_D(QQuickPaintedItem);
 
     if (d->opaquePainting == opaque)
         return;
 
     d->opaquePainting = opaque;
-    QSGItem::update();
+    QQuickItem::update();
 }
 
 /*!
@@ -214,9 +215,9 @@ void QSGPaintedItem::setOpaquePainting(bool opaque)
 
     \sa setAntialiasing()
 */
-bool QSGPaintedItem::antialiasing() const
+bool QQuickPaintedItem::antialiasing() const
 {
-    Q_D(const QSGPaintedItem);
+    Q_D(const QQuickPaintedItem);
     return d->antialiasing;
 }
 
@@ -227,9 +228,9 @@ bool QSGPaintedItem::antialiasing() const
 
     \sa antialiasing()
 */
-void QSGPaintedItem::setAntialiasing(bool enable)
+void QQuickPaintedItem::setAntialiasing(bool enable)
 {
-    Q_D(QSGPaintedItem);
+    Q_D(QQuickPaintedItem);
 
     if (d->antialiasing == enable)
         return;
@@ -245,9 +246,9 @@ void QSGPaintedItem::setAntialiasing(bool enable)
 
     \sa setMipmap()
 */
-bool QSGPaintedItem::mipmap() const
+bool QQuickPaintedItem::mipmap() const
 {
-    Q_D(const QSGPaintedItem);
+    Q_D(const QQuickPaintedItem);
     return d->mipmap;
 }
 
@@ -261,9 +262,9 @@ bool QSGPaintedItem::mipmap() const
 
     \sa mipmap()
 */
-void QSGPaintedItem::setMipmap(bool enable)
+void QQuickPaintedItem::setMipmap(bool enable)
 {
-    Q_D(QSGPaintedItem);
+    Q_D(QQuickPaintedItem);
 
     if (d->mipmap == enable)
         return;
@@ -279,9 +280,9 @@ void QSGPaintedItem::setMipmap(bool enable)
 
     \sa setPerformanceHint(), setPerformanceHints()
 */
-QSGPaintedItem::PerformanceHints QSGPaintedItem::performanceHints() const
+QQuickPaintedItem::PerformanceHints QQuickPaintedItem::performanceHints() const
 {
-    Q_D(const QSGPaintedItem);
+    Q_D(const QQuickPaintedItem);
     return d->performanceHints;
 }
 
@@ -293,9 +294,9 @@ QSGPaintedItem::PerformanceHints QSGPaintedItem::performanceHints() const
 
     \sa setPerformanceHints(), performanceHints()
 */
-void QSGPaintedItem::setPerformanceHint(QSGPaintedItem::PerformanceHint hint, bool enabled)
+void QQuickPaintedItem::setPerformanceHint(QQuickPaintedItem::PerformanceHint hint, bool enabled)
 {
-    Q_D(QSGPaintedItem);
+    Q_D(QQuickPaintedItem);
     PerformanceHints oldHints = d->performanceHints;
     if (enabled)
         d->performanceHints |= hint;
@@ -312,9 +313,9 @@ void QSGPaintedItem::setPerformanceHint(QSGPaintedItem::PerformanceHint hint, bo
 
     \sa setPerformanceHint(), performanceHints()
 */
-void QSGPaintedItem::setPerformanceHints(QSGPaintedItem::PerformanceHints hints)
+void QQuickPaintedItem::setPerformanceHints(QQuickPaintedItem::PerformanceHints hints)
 {
-    Q_D(QSGPaintedItem);
+    Q_D(QQuickPaintedItem);
     if (d->performanceHints == hints)
         return;
     d->performanceHints = hints;
@@ -330,11 +331,11 @@ void QSGPaintedItem::setPerformanceHints(QSGPaintedItem::PerformanceHints hints)
 
     Use this function to know the area painted by the item.
 
-    \sa QSGItem::width(), QSGItem::height(), contentsSize(), contentsScale()
+    \sa QQuickItem::width(), QQuickItem::height(), contentsSize(), contentsScale()
 */
-QRectF QSGPaintedItem::contentsBoundingRect() const
+QRectF QQuickPaintedItem::contentsBoundingRect() const
 {
-    Q_D(const QSGPaintedItem);
+    Q_D(const QQuickPaintedItem);
 
     qreal w = d->width;
     QSizeF sz = d->contentsSize * d->contentsScale;
@@ -348,22 +349,22 @@ QRectF QSGPaintedItem::contentsBoundingRect() const
 }
 
 /*!
-    \property QSGPaintedItem::contentsSize
+    \property QQuickPaintedItem::contentsSize
     \brief The size of the contents
 
     The contents size is the size of the item in regards to how it is painted
     using the paint() function.  This is distinct from the size of the
     item in regards to height() and width().
 */
-QSize QSGPaintedItem::contentsSize() const
+QSize QQuickPaintedItem::contentsSize() const
 {
-    Q_D(const QSGPaintedItem);
+    Q_D(const QQuickPaintedItem);
     return d->contentsSize;
 }
 
-void QSGPaintedItem::setContentsSize(const QSize &size)
+void QQuickPaintedItem::setContentsSize(const QSize &size)
 {
-    Q_D(QSGPaintedItem);
+    Q_D(QQuickPaintedItem);
 
     if (d->contentsSize == size)
         return;
@@ -375,13 +376,13 @@ void QSGPaintedItem::setContentsSize(const QSize &size)
 /*!
     This convenience function is equivalent to calling setContentsSize(QSize()).
 */
-void QSGPaintedItem::resetContentsSize()
+void QQuickPaintedItem::resetContentsSize()
 {
     setContentsSize(QSize());
 }
 
 /*!
-    \property QSGPaintedItem::contentsScale
+    \property QQuickPaintedItem::contentsScale
     \brief The scale of the contents
 
     All painting happening in paint() is scaled by the contents scale. This is distinct
@@ -389,15 +390,15 @@ void QSGPaintedItem::resetContentsSize()
 
     The default value is 1.
 */
-qreal QSGPaintedItem::contentsScale() const
+qreal QQuickPaintedItem::contentsScale() const
 {
-    Q_D(const QSGPaintedItem);
+    Q_D(const QQuickPaintedItem);
     return d->contentsScale;
 }
 
-void QSGPaintedItem::setContentsScale(qreal scale)
+void QQuickPaintedItem::setContentsScale(qreal scale)
 {
-    Q_D(QSGPaintedItem);
+    Q_D(QQuickPaintedItem);
 
     if (d->contentsScale == scale)
         return;
@@ -407,20 +408,20 @@ void QSGPaintedItem::setContentsScale(qreal scale)
 }
 
 /*!
-    \property QSGPaintedItem::fillColor
+    \property QQuickPaintedItem::fillColor
     \brief The item's background fill color.
 
     By default, the fill color is set to Qt::transparent.
 */
-QColor QSGPaintedItem::fillColor() const
+QColor QQuickPaintedItem::fillColor() const
 {
-    Q_D(const QSGPaintedItem);
+    Q_D(const QQuickPaintedItem);
     return d->fillColor;
 }
 
-void QSGPaintedItem::setFillColor(const QColor &c)
+void QQuickPaintedItem::setFillColor(const QColor &c)
 {
-    Q_D(QSGPaintedItem);
+    Q_D(QQuickPaintedItem);
 
     if (d->fillColor == c)
         return;
@@ -432,29 +433,29 @@ void QSGPaintedItem::setFillColor(const QColor &c)
 }
 
 /*!
-    \property QSGPaintedItem::renderTarget
+    \property QQuickPaintedItem::renderTarget
     \brief The item's render target.
 
     This property defines which render target the QPainter renders into, it can be either
-    QSGPaintedItem::Image or QSGPaintedItem::FramebufferObject. Both have certains benefits,
+    QQuickPaintedItem::Image or QQuickPaintedItem::FramebufferObject. Both have certains benefits,
     typically performance versus quality. Using a framebuffer object avoids a costly upload
     of the image contents to the texture in graphics memory, while using an image enables
     high quality anti-aliasing.
 
     \warning Resizing a framebuffer object is a costly operation, avoid using
-    the QSGPaintedItem::FramebufferObject render target if the item gets resized often.
+    the QQuickPaintedItem::FramebufferObject render target if the item gets resized often.
 
-    By default, the render target is QSGPaintedItem::Image.
+    By default, the render target is QQuickPaintedItem::Image.
 */
-QSGPaintedItem::RenderTarget QSGPaintedItem::renderTarget() const
+QQuickPaintedItem::RenderTarget QQuickPaintedItem::renderTarget() const
 {
-    Q_D(const QSGPaintedItem);
+    Q_D(const QQuickPaintedItem);
     return d->renderTarget;
 }
 
-void QSGPaintedItem::setRenderTarget(RenderTarget target)
+void QQuickPaintedItem::setRenderTarget(RenderTarget target)
 {
-    Q_D(QSGPaintedItem);
+    Q_D(QQuickPaintedItem);
 
     if (d->renderTarget == target)
         return;
@@ -466,14 +467,14 @@ void QSGPaintedItem::setRenderTarget(RenderTarget target)
 }
 
 /*!
-    \fn virtual void QSGPaintedItem::paint(QPainter *painter) = 0
+    \fn virtual void QQuickPaintedItem::paint(QPainter *painter) = 0
 
     This function, which is usually called by the QML Scene Graph, paints the
     contents of an item in local coordinates.
 
     The function is called after the item has been filled with the fillColor.
 
-    Reimplement this function in a QSGPaintedItem subclass to provide the
+    Reimplement this function in a QQuickPaintedItem subclass to provide the
     item's painting implementation, using \a painter.
 
     \note The QML Scene Graph uses two separate threads, the main thread does things such as
@@ -486,11 +487,11 @@ void QSGPaintedItem::setRenderTarget(RenderTarget target)
 /*!
     This function is called after the item's geometry has changed.
 */
-void QSGPaintedItem::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
+void QQuickPaintedItem::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
 {
-    Q_D(QSGPaintedItem);
+    Q_D(QQuickPaintedItem);
     d->geometryDirty = true;
-    QSGItem::geometryChanged(newGeometry, oldGeometry);
+    QQuickItem::geometryChanged(newGeometry, oldGeometry);
 }
 
 
@@ -498,10 +499,10 @@ void QSGPaintedItem::geometryChanged(const QRectF &newGeometry, const QRectF &ol
     This function is called when the Scene Graph node associated to the item needs to
     be updated.
 */
-QSGNode *QSGPaintedItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data)
+QSGNode *QQuickPaintedItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data)
 {
     Q_UNUSED(data);
-    Q_D(QSGPaintedItem);
+    Q_D(QQuickPaintedItem);
 
     if (width() <= 0 || height() <= 0) {
         delete oldNode;