Rename Qt Quick-specific classes to QQuick*
[profile/ivi/qtdeclarative.git] / src / declarative / items / qquickdrag.cpp
similarity index 74%
rename from src/declarative/items/qsgdrag.cpp
rename to src/declarative/items/qquickdrag.cpp
index b95e495..d3439b0 100644 (file)
 **
 ****************************************************************************/
 
-#include "qsgdrag_p.h"
+#include "qquickdrag_p.h"
 
-#include <private/qsgitem_p.h>
-#include <private/qsgevents_p_p.h>
-#include <private/qsgitemchangelistener_p.h>
+#include <private/qquickitem_p.h>
+#include <private/qquickevents_p_p.h>
+#include <private/qquickitemchangelistener_p.h>
 #include <private/qv8engine_p.h>
 
 #include <QtGui/qevent.h>
 
 QT_BEGIN_NAMESPACE
 
-class QSGDragAttachedPrivate : public QObjectPrivate, public QSGItemChangeListener
+class QQuickDragAttachedPrivate : public QObjectPrivate, public QQuickItemChangeListener
 {
-    Q_DECLARE_PUBLIC(QSGDragAttached)
+    Q_DECLARE_PUBLIC(QQuickDragAttached)
 public:
-    static QSGDragAttachedPrivate *get(QSGDragAttached *attached) {
-        return static_cast<QSGDragAttachedPrivate *>(QObjectPrivate::get(attached)); }
+    static QQuickDragAttachedPrivate *get(QQuickDragAttached *attached) {
+        return static_cast<QQuickDragAttachedPrivate *>(QObjectPrivate::get(attached)); }
 
-    QSGDragAttachedPrivate()
+    QQuickDragAttachedPrivate()
         : attachedItem(0)
         , mimeData(0)
         , proposedAction(Qt::MoveAction)
@@ -67,17 +67,17 @@ public:
     {
     }
 
-    void itemGeometryChanged(QSGItem *, const QRectF &, const QRectF &);
+    void itemGeometryChanged(QQuickItem *, const QRectF &, const QRectF &);
     void start() { start(supportedActions); }
     void start(Qt::DropActions supportedActions);
-    void setTarget(QSGItem *item);
+    void setTarget(QQuickItem *item);
 
-    QSGDragGrabber dragGrabber;
+    QQuickDragGrabber dragGrabber;
 
     QDeclarativeGuard<QObject> source;
     QDeclarativeGuard<QObject> target;
-    QSGItem *attachedItem;
-    QSGDragMimeData *mimeData;
+    QQuickItem *attachedItem;
+    QQuickDragMimeData *mimeData;
     Qt::DropAction proposedAction;
     Qt::DropActions supportedActions;
     bool active : 1;
@@ -87,7 +87,7 @@ public:
 };
 
 /*!
-    \qmlclass Drag QSGDrag
+    \qmlclass Drag QQuickDrag
     \inqmlmodule QtQuick 2
     \brief The Drag attached property provides drag and drop events for moved Items.
 
@@ -113,17 +113,17 @@ public:
 
 */
 
-void QSGDragAttachedPrivate::itemGeometryChanged(QSGItem *, const QRectF &newGeometry, const QRectF &oldGeometry)
+void QQuickDragAttachedPrivate::itemGeometryChanged(QQuickItem *, const QRectF &newGeometry, const QRectF &oldGeometry)
 {
-    Q_Q(QSGDragAttached);
+    Q_Q(QQuickDragAttached);
     if (newGeometry.topLeft() == oldGeometry.topLeft() || !active)
         return;
 
-    if (QSGCanvas *canvas = attachedItem->canvas()) {
+    if (QQuickCanvas *canvas = attachedItem->canvas()) {
         QPoint scenePos = attachedItem->mapToScene(hotSpot).toPoint();
         QDragMoveEvent event(scenePos, mimeData->m_supportedActions, mimeData, Qt::NoButton, Qt::NoModifier);
-        QSGDropEventEx::setProposedAction(&event, proposedAction);
-        QSGCanvasPrivate::get(canvas)->deliverDragEvent(&dragGrabber, &event);
+        QQuickDropEventEx::setProposedAction(&event, proposedAction);
+        QQuickCanvasPrivate::get(canvas)->deliverDragEvent(&dragGrabber, &event);
         if (target != dragGrabber.target()) {
             target = dragGrabber.target();
             emit q->targetChanged();
@@ -131,17 +131,17 @@ void QSGDragAttachedPrivate::itemGeometryChanged(QSGItem *, const QRectF &newGeo
     }
 }
 
-QSGDragAttached::QSGDragAttached(QObject *parent)
-    : QObject(*new QSGDragAttachedPrivate, parent)
+QQuickDragAttached::QQuickDragAttached(QObject *parent)
+    : QObject(*new QQuickDragAttachedPrivate, parent)
 {
-    Q_D(QSGDragAttached);
-    d->attachedItem = qobject_cast<QSGItem *>(parent);
+    Q_D(QQuickDragAttached);
+    d->attachedItem = qobject_cast<QQuickItem *>(parent);
     d->source = d->attachedItem;
 }
 
-QSGDragAttached::~QSGDragAttached()
+QQuickDragAttached::~QQuickDragAttached()
 {
-    Q_D(QSGDragAttached);
+    Q_D(QQuickDragAttached);
     delete d->mimeData;
 }
 
@@ -158,15 +158,15 @@ QSGDragAttached::~QSGDragAttached()
     event with item's new position to the scene.
 */
 
-bool QSGDragAttached::isActive() const
+bool QQuickDragAttached::isActive() const
 {
-    Q_D(const QSGDragAttached);
+    Q_D(const QQuickDragAttached);
     return d->active;
 }
 
-void QSGDragAttached::setActive(bool active)
+void QQuickDragAttached::setActive(bool active)
 {
-    Q_D(QSGDragAttached);
+    Q_D(QQuickDragAttached);
     if (d->active != active) {
         if (active)
             d->start(d->supportedActions);
@@ -184,24 +184,24 @@ void QSGDragAttached::setActive(bool active)
     Changes to source while a Drag is active don't take effect until a new drag is started.
 */
 
-QObject *QSGDragAttached::source() const
+QObject *QQuickDragAttached::source() const
 {
-    Q_D(const QSGDragAttached);
+    Q_D(const QQuickDragAttached);
     return d->source;
 }
 
-void QSGDragAttached::setSource(QObject *item)
+void QQuickDragAttached::setSource(QObject *item)
 {
-    Q_D(QSGDragAttached);
+    Q_D(QQuickDragAttached);
     if (d->source != item) {
         d->source = item;
         emit sourceChanged();
     }
 }
 
-void QSGDragAttached::resetSource()
+void QQuickDragAttached::resetSource()
 {
-    Q_D(QSGDragAttached);
+    Q_D(QQuickDragAttached);
     if (d->source != d->attachedItem) {
         d->source = d->attachedItem;
         emit sourceChanged();
@@ -220,9 +220,9 @@ void QSGDragAttached::resetSource()
     the drag was cancelled the target will then be null.
 */
 
-QObject *QSGDragAttached::target() const
+QObject *QQuickDragAttached::target() const
 {
-    Q_D(const QSGDragAttached);
+    Q_D(const QQuickDragAttached);
     return d->target;
 }
 
@@ -236,15 +236,15 @@ QObject *QSGDragAttached::target() const
     Changes to hotSpot will take effect when the next event is sent.
 */
 
-QPointF QSGDragAttached::hotSpot() const
+QPointF QQuickDragAttached::hotSpot() const
 {
-    Q_D(const QSGDragAttached);
+    Q_D(const QQuickDragAttached);
     return d->hotSpot;
 }
 
-void QSGDragAttached::setHotSpot(const QPointF &hotSpot)
+void QQuickDragAttached::setHotSpot(const QPointF &hotSpot)
 {
-    Q_D(QSGDragAttached);
+    Q_D(QQuickDragAttached);
     if (d->hotSpot != hotSpot) {
         d->hotSpot = hotSpot;
         emit hotSpotChanged();
@@ -260,15 +260,15 @@ void QSGDragAttached::setHotSpot(const QPointF &hotSpot)
     Changes to keys while a Drag is active don't take effect until a new drag is started.
 */
 
-QStringList QSGDragAttached::keys() const
+QStringList QQuickDragAttached::keys() const
 {
-    Q_D(const QSGDragAttached);
+    Q_D(const QQuickDragAttached);
     return d->keys;
 }
 
-void QSGDragAttached::setKeys(const QStringList &keys)
+void QQuickDragAttached::setKeys(const QStringList &keys)
 {
-    Q_D(QSGDragAttached);
+    Q_D(QQuickDragAttached);
     if (d->keys != keys) {
         d->keys = keys;
         emit keysChanged();
@@ -284,15 +284,15 @@ void QSGDragAttached::setKeys(const QStringList &keys)
     until a new drag is started.
 */
 
-Qt::DropActions QSGDragAttached::supportedActions() const
+Qt::DropActions QQuickDragAttached::supportedActions() const
 {
-    Q_D(const QSGDragAttached);
+    Q_D(const QQuickDragAttached);
     return d->supportedActions;
 }
 
-void QSGDragAttached::setSupportedActions(Qt::DropActions actions)
+void QQuickDragAttached::setSupportedActions(Qt::DropActions actions)
 {
-    Q_D(QSGDragAttached);
+    Q_D(QQuickDragAttached);
     if (d->supportedActions != actions) {
         d->supportedActions = actions;
         emit supportedActionsChanged();
@@ -308,15 +308,15 @@ void QSGDragAttached::setSupportedActions(Qt::DropActions actions)
     Changes to proposedAction will take effect when the next event is sent.
 */
 
-Qt::DropAction QSGDragAttached::proposedAction() const
+Qt::DropAction QQuickDragAttached::proposedAction() const
 {
-    Q_D(const QSGDragAttached);
+    Q_D(const QQuickDragAttached);
     return d->proposedAction;
 }
 
-void QSGDragAttached::setProposedAction(Qt::DropAction action)
+void QQuickDragAttached::setProposedAction(Qt::DropAction action)
 {
-    Q_D(QSGDragAttached);
+    Q_D(QQuickDragAttached);
     if (d->proposedAction != action) {
         d->proposedAction = action;
         emit proposedActionChanged();
@@ -324,16 +324,16 @@ void QSGDragAttached::setProposedAction(Qt::DropAction action)
     }
 }
 
-void QSGDragAttachedPrivate::start(Qt::DropActions supportedActions)
+void QQuickDragAttachedPrivate::start(Qt::DropActions supportedActions)
 {
-    Q_Q(QSGDragAttached);
+    Q_Q(QQuickDragAttached);
     Q_ASSERT(!active);
 
-    if (QSGCanvas *canvas = attachedItem ? attachedItem->canvas() : 0) {
+    if (QQuickCanvas *canvas = attachedItem ? attachedItem->canvas() : 0) {
         if (!mimeData)
-            mimeData = new QSGDragMimeData;
+            mimeData = new QQuickDragMimeData;
         if (!listening) {
-            QSGItemPrivate::get(attachedItem)->addItemChangeListener(this, QSGItemPrivate::Geometry);
+            QQuickItemPrivate::get(attachedItem)->addItemChangeListener(this, QQuickItemPrivate::Geometry);
             listening = true;
         }
 
@@ -344,8 +344,8 @@ void QSGDragAttachedPrivate::start(Qt::DropActions supportedActions)
 
         QPoint scenePos = attachedItem->mapToScene(hotSpot).toPoint();
         QDragEnterEvent event(scenePos, supportedActions, mimeData, Qt::NoButton, Qt::NoModifier);
-        QSGDropEventEx::setProposedAction(&event, proposedAction);
-        QSGCanvasPrivate::get(canvas)->deliverDragEvent(&dragGrabber, &event);
+        QQuickDropEventEx::setProposedAction(&event, proposedAction);
+        QQuickCanvasPrivate::get(canvas)->deliverDragEvent(&dragGrabber, &event);
 
         emit q->activeChanged();
         if (target != dragGrabber.target()) {
@@ -364,9 +364,9 @@ void QSGDragAttachedPrivate::start(Qt::DropActions supportedActions)
     property for the started sequence.
 */
 
-void QSGDragAttached::start(QDeclarativeV8Function *args)
+void QQuickDragAttached::start(QDeclarativeV8Function *args)
 {
-    Q_D(QSGDragAttached);
+    Q_D(QQuickDragAttached);
     if (d->active)
         cancel();
 
@@ -400,9 +400,9 @@ void QSGDragAttached::start(QDeclarativeV8Function *args)
 
 */
 
-int QSGDragAttached::drop()
+int QQuickDragAttached::drop()
 {
-    Q_D(QSGDragAttached);
+    Q_D(QQuickDragAttached);
     Qt::DropAction acceptedAction = Qt::IgnoreAction;
 
     if (!d->active)
@@ -410,13 +410,13 @@ int QSGDragAttached::drop()
 
     QObject *target = 0;
 
-    if (QSGCanvas *canvas = d->attachedItem->canvas()) {
+    if (QQuickCanvas *canvas = d->attachedItem->canvas()) {
         QPoint scenePos = d->attachedItem->mapToScene(d->hotSpot).toPoint();
 
         QDropEvent event(
                 scenePos, d->mimeData->m_supportedActions, d->mimeData, Qt::NoButton, Qt::NoModifier);
-        QSGDropEventEx::setProposedAction(&event, d->proposedAction);
-        QSGCanvasPrivate::get(canvas)->deliverDragEvent(&d->dragGrabber, &event);
+        QQuickDropEventEx::setProposedAction(&event, d->proposedAction);
+        QQuickCanvasPrivate::get(canvas)->deliverDragEvent(&d->dragGrabber, &event);
 
         if (event.isAccepted()) {
             acceptedAction = event.dropAction();
@@ -440,15 +440,15 @@ int QSGDragAttached::drop()
     Ends a drag sequence.
 */
 
-void QSGDragAttached::cancel()
+void QQuickDragAttached::cancel()
 {
-    Q_D(QSGDragAttached);
+    Q_D(QQuickDragAttached);
     if (!d->active)
         return;
 
-    if (QSGCanvas *canvas = d->attachedItem->canvas()) {
+    if (QQuickCanvas *canvas = d->attachedItem->canvas()) {
         QDragLeaveEvent event;
-        QSGCanvasPrivate::get(canvas)->deliverDragEvent(&d->dragGrabber, &event);
+        QQuickCanvasPrivate::get(canvas)->deliverDragEvent(&d->dragGrabber, &event);
     }
 
     d->active = false;