aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2012-07-11 17:32:16 +1000
committerQt by Nokia <qt-info@nokia.com>2012-07-17 07:26:15 +0200
commitfeb996e3ab44e68082c97102556ea396f5df3f44 (patch)
tree7613a8a4eaf5a8e0fb2801e9d0d9d1869524c348 /src/quick/items
parent68bbdacd2d5a6fa02f085a996411fb2b71875174 (diff)
QQuickCanvas renames
QQuickCanvas is now called QQuickWindow QQuickCanvas::rootItem is now QQuickWindow::contentItem QQuickItem::canvas is now QQuickItem::window QQuickItem::ItemChangeData::canvas is also renamed window QQuickCanvas::grabFrameBuffer is now QQuickWindow::grabWindow The functions related to the color property have dropped the clear from their names. The first three changes have interim compatibility measures in place to ease the transition. Change-Id: Id34e29546a22a74a7ae2ad90ee3a8def6fc541d2 Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'src/quick/items')
-rw-r--r--src/quick/items/context2d/qquickcanvasitem.cpp22
-rw-r--r--src/quick/items/context2d/qquickcanvasitem_p.h8
-rw-r--r--src/quick/items/context2d/qquickcontext2d.cpp16
-rw-r--r--src/quick/items/items.pri5
-rw-r--r--src/quick/items/qquickanimatedsprite.cpp4
-rw-r--r--src/quick/items/qquickborderimage.cpp2
-rw-r--r--src/quick/items/qquickcanvas.h123
-rw-r--r--src/quick/items/qquickdrag.cpp34
-rw-r--r--src/quick/items/qquickdroparea.cpp2
-rw-r--r--src/quick/items/qquickflickable.cpp32
-rw-r--r--src/quick/items/qquickimage.cpp6
-rw-r--r--src/quick/items/qquickitem.cpp276
-rw-r--r--src/quick/items/qquickitem.h18
-rw-r--r--src/quick/items/qquickitem_p.h28
-rw-r--r--src/quick/items/qquickmousearea.cpp24
-rw-r--r--src/quick/items/qquickmultipointtoucharea.cpp14
-rw-r--r--src/quick/items/qquickpathview.cpp4
-rw-r--r--src/quick/items/qquickpincharea.cpp6
-rw-r--r--src/quick/items/qquickscreen.cpp8
-rw-r--r--src/quick/items/qquickscreen_p.h4
-rw-r--r--src/quick/items/qquickshadereffect.cpp32
-rw-r--r--src/quick/items/qquickshadereffect_p.h2
-rw-r--r--src/quick/items/qquickshadereffectsource.cpp28
-rw-r--r--src/quick/items/qquickspritesequence.cpp4
-rw-r--r--src/quick/items/qquicktextedit.cpp2
-rw-r--r--src/quick/items/qquicktextinput.cpp2
-rw-r--r--src/quick/items/qquickview.cpp28
-rw-r--r--src/quick/items/qquickview.h4
-rw-r--r--src/quick/items/qquickview_p.h4
-rw-r--r--src/quick/items/qquickwindow.cpp (renamed from src/quick/items/qquickcanvas.cpp)459
-rw-r--r--src/quick/items/qquickwindow.h181
-rw-r--r--src/quick/items/qquickwindow_p.h (renamed from src/quick/items/qquickcanvas_p.h)30
-rw-r--r--src/quick/items/qquickwindowmanager.cpp384
-rw-r--r--src/quick/items/qquickwindowmanager_p.h18
-rw-r--r--src/quick/items/qquickwindowmodule.cpp4
35 files changed, 944 insertions, 874 deletions
diff --git a/src/quick/items/context2d/qquickcanvasitem.cpp b/src/quick/items/context2d/qquickcanvasitem.cpp
index f66b383a57..47c8b4f148 100644
--- a/src/quick/items/context2d/qquickcanvasitem.cpp
+++ b/src/quick/items/context2d/qquickcanvasitem.cpp
@@ -53,19 +53,19 @@
QT_BEGIN_NAMESPACE
-QQuickCanvasPixmap::QQuickCanvasPixmap(const QImage& image, QQuickCanvas *canvas)
+QQuickCanvasPixmap::QQuickCanvasPixmap(const QImage& image, QQuickWindow *window)
: m_pixmap(0)
, m_image(image)
, m_texture(0)
- , m_canvas(canvas)
+ , m_window(window)
{
}
-QQuickCanvasPixmap::QQuickCanvasPixmap(QQuickPixmap *pixmap, QQuickCanvas *canvas)
+QQuickCanvasPixmap::QQuickCanvasPixmap(QQuickPixmap *pixmap, QQuickWindow *window)
: m_pixmap(pixmap)
, m_texture(0)
- , m_canvas(canvas)
+ , m_window(window)
{
}
@@ -105,9 +105,9 @@ QSGTexture *QQuickCanvasPixmap::texture()
if (!m_texture) {
if (m_pixmap) {
Q_ASSERT(m_pixmap->textureFactory());
- m_texture = m_pixmap->textureFactory()->createTexture(m_canvas);
+ m_texture = m_pixmap->textureFactory()->createTexture(m_window);
} else {
- m_texture = QQuickCanvasPrivate::get(m_canvas)->context->createTexture(m_image);
+ m_texture = QQuickWindowPrivate::get(m_window)->context->createTexture(m_image);
}
}
return m_texture;
@@ -620,14 +620,14 @@ void QQuickCanvasItem::itemChange(QQuickItem::ItemChange change, const QQuickIte
if (d->available)
return;
- if (value.canvas == 0)
+ if (value.window== 0)
return;
- d->canvas = value.canvas;
- if (d->canvas->openglContext() != 0) // available context == initialized
+ d->window = value.window;
+ if (d->window->openglContext() != 0) // available context == initialized
sceneGraphInitialized();
else
- connect(d->canvas, SIGNAL(sceneGraphInitialized()), SLOT(sceneGraphInitialized()));
+ connect(d->window, SIGNAL(sceneGraphInitialized()), SLOT(sceneGraphInitialized()));
}
void QQuickCanvasItem::updatePolish()
@@ -881,7 +881,7 @@ void QQuickCanvasItem::loadImage(const QUrl& url)
if (!d->pixmaps.contains(fullPathUrl)) {
QQuickPixmap* pix = new QQuickPixmap();
QQmlRefPointer<QQuickCanvasPixmap> canvasPix;
- canvasPix.take(new QQuickCanvasPixmap(pix, d->canvas));
+ canvasPix.take(new QQuickCanvasPixmap(pix, d->window));
d->pixmaps.insert(fullPathUrl, canvasPix);
pix->load(qmlEngine(this)
diff --git a/src/quick/items/context2d/qquickcanvasitem_p.h b/src/quick/items/context2d/qquickcanvasitem_p.h
index 090c763e46..4e592bcba7 100644
--- a/src/quick/items/context2d/qquickcanvasitem_p.h
+++ b/src/quick/items/context2d/qquickcanvasitem_p.h
@@ -60,8 +60,8 @@ class QQuickPixmap;
class QQuickCanvasPixmap : public QQmlRefCount
{
public:
- QQuickCanvasPixmap(const QImage& image, QQuickCanvas *canvas);
- QQuickCanvasPixmap(QQuickPixmap *pixmap, QQuickCanvas *canvas);
+ QQuickCanvasPixmap(const QImage& image, QQuickWindow *window);
+ QQuickCanvasPixmap(QQuickPixmap *pixmap, QQuickWindow *window);
~QQuickCanvasPixmap();
QSGTexture *texture();
@@ -76,7 +76,7 @@ private:
QQuickPixmap *m_pixmap;
QImage m_image;
QSGTexture *m_texture;
- QQuickCanvas *m_canvas;
+ QQuickWindow *m_window;
};
class QQuickCanvasItem : public QQuickItem
@@ -209,4 +209,4 @@ QML_DECLARE_TYPE(QQuickCanvasItem)
QT_END_HEADER
-#endif //QQUICKCANVASITEM_P_H \ No newline at end of file
+#endif //QQUICKCANVASITEM_P_H
diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp
index 76f795b9b8..2a99a2eb58 100644
--- a/src/quick/items/context2d/qquickcontext2d.cpp
+++ b/src/quick/items/context2d/qquickcontext2d.cpp
@@ -61,7 +61,7 @@
#include <qqmlengine.h>
#include <private/qv8domerrors_p.h>
#include <QtCore/qnumeric.h>
-#include <private/qquickcanvas_p.h>
+#include <private/qquickwindow_p.h>
#include <private/qquickwindowmanager_p.h>
#include <QtGui/private/qguiapplication_p.h>
#include <qpa/qplatformintegration.h>
@@ -2331,13 +2331,13 @@ static v8::Handle<v8::Value> ctx2d_drawImage(const v8::Arguments &args)
QV8Context2DPixelArrayResource *pix = v8_resource_cast<QV8Context2DPixelArrayResource>(args[0]->ToObject()->GetInternalField(0)->ToObject());
if (pix && !pix->image.isNull()) {
- pixmap.take(new QQuickCanvasPixmap(pix->image, r->context->canvas()->canvas()));
+ pixmap.take(new QQuickCanvasPixmap(pix->image, r->context->canvas()->window()));
} else if (imageItem) {
pixmap.take(r->context->createPixmap(imageItem->source()));
} else if (canvas) {
QImage img = canvas->toImage();
if (!img.isNull())
- pixmap.take(new QQuickCanvasPixmap(img, canvas->canvas()));
+ pixmap.take(new QQuickCanvasPixmap(img, canvas->window()));
} else {
V8THROW_DOM(DOMEXCEPTION_TYPE_MISMATCH_ERR, "drawImage(), type mismatch");
}
@@ -3371,8 +3371,8 @@ void QQuickContext2D::init(QQuickCanvasItem *canvasItem, const QVariantMap &args
m_canvas = canvasItem;
m_renderTarget = canvasItem->renderTarget();
- QQuickCanvas *canvas = canvasItem->canvas();
- m_windowManager = QQuickCanvasPrivate::get(canvas)->windowManager;
+ QQuickWindow *window = canvasItem->window();
+ m_windowManager = QQuickWindowPrivate::get(window)->windowManager;
m_renderStrategy = canvasItem->renderStrategy();
switch (m_renderTarget) {
@@ -3396,7 +3396,7 @@ void QQuickContext2D::init(QQuickCanvasItem *canvasItem, const QVariantMap &args
m_texture->setSmooth(canvasItem->smooth());
QThread *renderThread = QThread::currentThread();
- QThread *sceneGraphThread = canvas->openglContext() ? canvas->openglContext()->thread() : 0;
+ QThread *sceneGraphThread = window->openglContext() ? window->openglContext()->thread() : 0;
if (m_renderStrategy == QQuickCanvasItem::Threaded)
renderThread = QQuickContext2DRenderThread::instance(qmlEngine(canvasItem));
@@ -3404,8 +3404,8 @@ void QQuickContext2D::init(QQuickCanvasItem *canvasItem, const QVariantMap &args
renderThread = sceneGraphThread;
if (m_renderTarget == QQuickCanvasItem::FramebufferObject && renderThread != sceneGraphThread) {
- QOpenGLContext *cc = QQuickCanvasPrivate::get(canvas)->context->glContext();
- m_surface = canvas;
+ QOpenGLContext *cc = QQuickWindowPrivate::get(window)->context->glContext();
+ m_surface = window;
m_glContext = new QOpenGLContext;
m_glContext->setFormat(cc->format());
m_glContext->setShareContext(cc);
diff --git a/src/quick/items/items.pri b/src/quick/items/items.pri
index 9f205ed503..3130106c5c 100644
--- a/src/quick/items/items.pri
+++ b/src/quick/items/items.pri
@@ -8,8 +8,9 @@ HEADERS += \
$$PWD/qquickitemchangelistener_p.h \
$$PWD/qquickrectangle_p.h \
$$PWD/qquickrectangle_p_p.h \
+ $$PWD/qquickwindow.h \
+ $$PWD/qquickwindow_p.h \
$$PWD/qquickcanvas.h \
- $$PWD/qquickcanvas_p.h \
$$PWD/qquickfocusscope_p.h \
$$PWD/qquickitemsmodule_p.h \
$$PWD/qquickpainteditem.h \
@@ -82,7 +83,7 @@ SOURCES += \
$$PWD/qquickanchors.cpp \
$$PWD/qquickitem.cpp \
$$PWD/qquickrectangle.cpp \
- $$PWD/qquickcanvas.cpp \
+ $$PWD/qquickwindow.cpp \
$$PWD/qquickfocusscope.cpp \
$$PWD/qquickitemsmodule.cpp \
$$PWD/qquickpainteditem.cpp \
diff --git a/src/quick/items/qquickanimatedsprite.cpp b/src/quick/items/qquickanimatedsprite.cpp
index a2439479b1..8fa4acc67c 100644
--- a/src/quick/items/qquickanimatedsprite.cpp
+++ b/src/quick/items/qquickanimatedsprite.cpp
@@ -48,7 +48,7 @@
#include <QtQuick/qsgnode.h>
#include <QtQuick/qsgtexturematerial.h>
#include <QtQuick/qsgtexture.h>
-#include <QtQuick/qquickcanvas.h>
+#include <QtQuick/qquickwindow.h>
#include <QtQml/qqmlinfo.h>
#include <QFile>
#include <cmath>
@@ -516,7 +516,7 @@ QSGGeometryNode* QQuickAnimatedSprite::buildNode()
if (image.isNull())
return 0;
m_sheetSize = QSizeF(image.size());
- m_material->texture = canvas()->createTextureFromImage(image);
+ m_material->texture = window()->createTextureFromImage(image);
m_material->texture->setFiltering(QSGTexture::Linear);
m_spriteEngine->start(0);
m_material->animT = 0;
diff --git a/src/quick/items/qquickborderimage.cpp b/src/quick/items/qquickborderimage.cpp
index 53ec729346..a9f154bcb7 100644
--- a/src/quick/items/qquickborderimage.cpp
+++ b/src/quick/items/qquickborderimage.cpp
@@ -557,7 +557,7 @@ QSGNode *QQuickBorderImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDat
{
Q_D(QQuickBorderImage);
- QSGTexture *texture = d->sceneGraphContext()->textureForFactory(d->pix.textureFactory(), canvas());
+ QSGTexture *texture = d->sceneGraphContext()->textureForFactory(d->pix.textureFactory(), window());
if (!texture || width() <= 0 || height() <= 0) {
delete oldNode;
diff --git a/src/quick/items/qquickcanvas.h b/src/quick/items/qquickcanvas.h
index 1d23996b91..aaeaca48cf 100644
--- a/src/quick/items/qquickcanvas.h
+++ b/src/quick/items/qquickcanvas.h
@@ -42,135 +42,16 @@
#ifndef QQUICKCANVAS_H
#define QQUICKCANVAS_H
-#include <QtQuick/qtquickglobal.h>
-#include <QtCore/qmetatype.h>
-#include <QtGui/qopengl.h>
-#include <QtGui/qwindow.h>
-#include <QtGui/qevent.h>
+#include "qquickwindow.h"
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-class QQuickItem;
-class QSGTexture;
-class QInputMethodEvent;
-class QQuickCanvasPrivate;
-class QOpenGLFramebufferObject;
-class QQmlIncubationController;
-class QInputMethodEvent;
-
-class Q_QUICK_EXPORT QQuickCanvas : public QWindow
-{
- Q_OBJECT
- Q_PRIVATE_PROPERTY(QQuickCanvas::d_func(), QQmlListProperty<QObject> data READ data DESIGNABLE false)
- Q_PROPERTY(QColor color READ clearColor WRITE setClearColor NOTIFY clearColorChanged)
- Q_CLASSINFO("DefaultProperty", "data")
- Q_DECLARE_PRIVATE(QQuickCanvas)
-public:
- enum CreateTextureOption {
- TextureHasAlphaChannel = 0x0001,
- TextureHasMipmaps = 0x0002,
- TextureOwnsGLTexture = 0x0004
- };
-
- Q_DECLARE_FLAGS(CreateTextureOptions, CreateTextureOption)
-
- QQuickCanvas(QWindow *parent = 0);
-
- virtual ~QQuickCanvas();
-
- QQuickItem *rootItem() const;
- QQuickItem *activeFocusItem() const;
- QObject *focusObject() const;
-
- QQuickItem *mouseGrabberItem() const;
-
- bool sendEvent(QQuickItem *, QEvent *);
-
- QImage grabFrameBuffer();
-
- void setRenderTarget(QOpenGLFramebufferObject *fbo);
- QOpenGLFramebufferObject *renderTarget() const;
-
- void setRenderTarget(uint fboId, const QSize &size);
- uint renderTargetId() const;
- QSize renderTargetSize() const;
-
- QQmlIncubationController *incubationController() const;
-
-#ifndef QT_NO_ACCESSIBILITY
- virtual QAccessibleInterface *accessibleRoot() const;
-#endif
-
- // Scene graph specific functions
- QSGTexture *createTextureFromImage(const QImage &image) const;
- QSGTexture *createTextureFromId(uint id, const QSize &size, CreateTextureOptions options = CreateTextureOption(0)) const;
-
- void setClearBeforeRendering(bool enabled);
- bool clearBeforeRendering() const;
-
- void setClearColor(const QColor &color);
- QColor clearColor() const;
-
- void setPersistentOpenGLContext(bool persistent);
- bool isPersistentOpenGLContext() const;
-
- void setPersistentSceneGraph(bool persistent);
- bool isPersistentSceneGraph() const;
-
- QOpenGLContext *openglContext() const;
-
-Q_SIGNALS:
- void frameSwapped();
- void sceneGraphInitialized();
- void sceneGraphInvalidated();
- void beforeSynchronizing();
- void beforeRendering();
- void afterRendering();
- void clearColorChanged(const QColor &);
-
-public Q_SLOTS:
- void update();
- void releaseResources();
-
-protected:
- QQuickCanvas(QQuickCanvasPrivate &dd, QWindow *parent = 0);
-
- virtual void exposeEvent(QExposeEvent *);
- virtual void resizeEvent(QResizeEvent *);
-
- virtual void showEvent(QShowEvent *);
- virtual void hideEvent(QHideEvent *);
-
- virtual void focusInEvent(QFocusEvent *);
- virtual void focusOutEvent(QFocusEvent *);
-
- virtual bool event(QEvent *);
- virtual void keyPressEvent(QKeyEvent *);
- virtual void keyReleaseEvent(QKeyEvent *);
- virtual void mousePressEvent(QMouseEvent *);
- virtual void mouseReleaseEvent(QMouseEvent *);
- virtual void mouseDoubleClickEvent(QMouseEvent *);
- virtual void mouseMoveEvent(QMouseEvent *);
-#ifndef QT_NO_WHEELEVENT
- virtual void wheelEvent(QWheelEvent *);
-#endif
-
-private Q_SLOTS:
- void maybeUpdate();
- void cleanupSceneGraph();
-
-private:
- friend class QQuickItem;
- friend class QQuickCanvasRenderLoop;
- Q_DISABLE_COPY(QQuickCanvas)
-};
+typedef QQuickWindow QQuickCanvas;
QT_END_NAMESPACE
-Q_DECLARE_METATYPE(QQuickCanvas *)
-
QT_END_HEADER
#endif // QQUICKCANVAS_H
diff --git a/src/quick/items/qquickdrag.cpp b/src/quick/items/qquickdrag.cpp
index 065a97efa0..972b9135c2 100644
--- a/src/quick/items/qquickdrag.cpp
+++ b/src/quick/items/qquickdrag.cpp
@@ -82,7 +82,7 @@ public:
void deliverEnterEvent();
void deliverMoveEvent();
void deliverLeaveEvent();
- void deliverEvent(QQuickCanvas *canvas, QEvent *event);
+ void deliverEvent(QQuickWindow *window, QEvent *event);
void start() { start(supportedActions); }
void start(Qt::DropActions supportedActions);
void setTarget(QQuickItem *item);
@@ -91,7 +91,7 @@ public:
QQmlGuard<QObject> source;
QQmlGuard<QObject> target;
- QQmlGuard<QQuickCanvas> canvas;
+ QQmlGuard<QQuickWindow> window;
QQuickItem *attachedItem;
QQuickDragMimeData *mimeData;
Qt::DropAction proposedAction;
@@ -147,11 +147,11 @@ void QQuickDragAttachedPrivate::itemParentChanged(QQuickItem *, QQuickItem *)
if (!active || dragRestarted)
return;
- QQuickCanvas *newCanvas = attachedItem->canvas();
+ QQuickWindow *newWindow = attachedItem->window();
- if (canvas != newCanvas)
+ if (window != newWindow)
restartDrag();
- else if (canvas)
+ else if (window)
updatePosition();
}
@@ -180,18 +180,18 @@ void QQuickDragAttachedPrivate::deliverEnterEvent()
dragRestarted = false;
itemMoved = false;
- canvas = attachedItem->canvas();
+ window = attachedItem->window();
mimeData->m_source = source;
if (!overrideActions)
mimeData->m_supportedActions = supportedActions;
mimeData->m_keys = keys;
- if (canvas) {
+ if (window) {
QPoint scenePos = attachedItem->mapToScene(hotSpot).toPoint();
QDragEnterEvent event(scenePos, mimeData->m_supportedActions, mimeData, Qt::NoButton, Qt::NoModifier);
QQuickDropEventEx::setProposedAction(&event, proposedAction);
- deliverEvent(canvas, &event);
+ deliverEvent(window, &event);
}
}
@@ -200,11 +200,11 @@ void QQuickDragAttachedPrivate::deliverMoveEvent()
Q_Q(QQuickDragAttached);
itemMoved = false;
- if (canvas) {
+ if (window) {
QPoint scenePos = attachedItem->mapToScene(hotSpot).toPoint();
QDragMoveEvent event(scenePos, mimeData->m_supportedActions, mimeData, Qt::NoButton, Qt::NoModifier);
QQuickDropEventEx::setProposedAction(&event, proposedAction);
- deliverEvent(canvas, &event);
+ deliverEvent(window, &event);
if (target != dragGrabber.target()) {
target = dragGrabber.target();
emit q->targetChanged();
@@ -214,18 +214,18 @@ void QQuickDragAttachedPrivate::deliverMoveEvent()
void QQuickDragAttachedPrivate::deliverLeaveEvent()
{
- if (canvas) {
+ if (window) {
QDragLeaveEvent event;
- deliverEvent(canvas, &event);
- canvas = 0;
+ deliverEvent(window, &event);
+ window = 0;
}
}
-void QQuickDragAttachedPrivate::deliverEvent(QQuickCanvas *canvas, QEvent *event)
+void QQuickDragAttachedPrivate::deliverEvent(QQuickWindow *window, QEvent *event)
{
Q_ASSERT(!inEvent);
inEvent = true;
- QQuickCanvasPrivate::get(canvas)->deliverDragEvent(&dragGrabber, event);
+ QQuickWindowPrivate::get(window)->deliverDragEvent(&dragGrabber, event);
inEvent = false;
}
@@ -564,13 +564,13 @@ int QQuickDragAttached::drop()
QObject *target = 0;
- if (d->canvas) {
+ if (d->window) {
QPoint scenePos = d->attachedItem->mapToScene(d->hotSpot).toPoint();
QDropEvent event(
scenePos, d->mimeData->m_supportedActions, d->mimeData, Qt::NoButton, Qt::NoModifier);
QQuickDropEventEx::setProposedAction(&event, d->proposedAction);
- d->deliverEvent(d->canvas, &event);
+ d->deliverEvent(d->window, &event);
if (event.isAccepted()) {
acceptedAction = event.dropAction();
diff --git a/src/quick/items/qquickdroparea.cpp b/src/quick/items/qquickdroparea.cpp
index ee89098430..1892a433f3 100644
--- a/src/quick/items/qquickdroparea.cpp
+++ b/src/quick/items/qquickdroparea.cpp
@@ -42,7 +42,7 @@
#include "qquickdroparea_p.h"
#include "qquickdrag_p.h"
#include "qquickitem_p.h"
-#include "qquickcanvas.h"
+#include "qquickwindow.h"
#include <private/qqmlengine_p.h>
diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp
index 4a5df1de62..001abe3ace 100644
--- a/src/quick/items/qquickflickable.cpp
+++ b/src/quick/items/qquickflickable.cpp
@@ -41,8 +41,8 @@
#include "qquickflickable_p.h"
#include "qquickflickable_p_p.h"
-#include "qquickcanvas.h"
-#include "qquickcanvas_p.h"
+#include "qquickwindow.h"
+#include "qquickwindow_p.h"
#include "qquickevents_p_p.h"
#include <QtQuick/private/qquicktransition_p.h>
@@ -1007,7 +1007,7 @@ void QQuickFlickablePrivate::handleMouseMoveEvent(QMouseEvent *event)
qint64 elapsedSincePress = computeCurrentTime(event) - lastPressTime;
if (q->yflick()) {
qreal dy = event->localPos().y() - pressPos.y();
- bool overThreshold = QQuickCanvasPrivate::dragOverThreshold(dy, Qt::YAxis, event);
+ bool overThreshold = QQuickWindowPrivate::dragOverThreshold(dy, Qt::YAxis, event);
if (overThreshold || elapsedSincePress > 200) {
if (!vMoved)
vData.dragStartOffset = dy;
@@ -1041,7 +1041,7 @@ void QQuickFlickablePrivate::handleMouseMoveEvent(QMouseEvent *event)
if (q->xflick()) {
qreal dx = event->localPos().x() - pressPos.x();
- bool overThreshold = QQuickCanvasPrivate::dragOverThreshold(dx, Qt::XAxis, event);
+ bool overThreshold = QQuickWindowPrivate::dragOverThreshold(dx, Qt::XAxis, event);
if (overThreshold || elapsedSincePress > 200) {
if (!hMoved)
hData.dragStartOffset = dx;
@@ -1226,7 +1226,7 @@ void QQuickFlickable::mouseReleaseEvent(QMouseEvent *event)
d->clearDelayedPress();
d->handleMouseReleaseEvent(event);
event->accept();
- if (canvas() && canvas()->mouseGrabberItem() == this)
+ if (window() && window()->mouseGrabberItem() == this)
ungrabMouse();
} else {
QQuickItem::mouseReleaseEvent(event);
@@ -1305,12 +1305,12 @@ bool QQuickFlickablePrivate::isOutermostPressDelay() const
void QQuickFlickablePrivate::captureDelayedPress(QMouseEvent *event)
{
Q_Q(QQuickFlickable);
- if (!q->canvas() || pressDelay <= 0)
+ if (!q->window() || pressDelay <= 0)
return;
if (!isOutermostPressDelay())
return;
- delayedPressTarget = q->canvas()->mouseGrabberItem();
- delayedPressEvent = QQuickCanvasPrivate::cloneMouseEvent(event);
+ delayedPressTarget = q->window()->mouseGrabberItem();
+ delayedPressEvent = QQuickWindowPrivate::cloneMouseEvent(event);
delayedPressEvent->setAccepted(false);
delayedPressTimer.start(pressDelay, q);
}
@@ -1341,14 +1341,14 @@ void QQuickFlickable::timerEvent(QTimerEvent *event)
if (event->timerId() == d->delayedPressTimer.timerId()) {
d->delayedPressTimer.stop();
if (d->delayedPressEvent) {
- QQuickItem *grabber = canvas() ? canvas()->mouseGrabberItem() : 0;
+ QQuickItem *grabber = window() ? window()->mouseGrabberItem() : 0;
if (!grabber || grabber != this) {
// We replay the mouse press but the grabber we had might not be interessted by the event (e.g. overlay)
// so we reset the grabber
- if (canvas()->mouseGrabberItem() == d->delayedPressTarget)
+ if (window()->mouseGrabberItem() == d->delayedPressTarget)
d->delayedPressTarget->ungrabMouse();
// Use the event handler that will take care of finding the proper item to propagate the event
- QQuickCanvasPrivate::get(canvas())->deliverMouseEvent(d->delayedPressEvent);
+ QQuickWindowPrivate::get(window())->deliverMouseEvent(d->delayedPressEvent);
}
delete d->delayedPressEvent;
d->delayedPressEvent = 0;
@@ -1981,12 +1981,12 @@ bool QQuickFlickable::sendMouseEvent(QMouseEvent *event)
Q_D(QQuickFlickable);
QPointF localPos = mapFromScene(event->windowPos());
- QQuickCanvas *c = canvas();
+ QQuickWindow *c = window();
QQuickItem *grabber = c ? c->mouseGrabberItem() : 0;
bool grabberDisabled = grabber && !grabber->isEnabled();
bool stealThisEvent = d->stealMouse;
if ((stealThisEvent || contains(localPos)) && (!grabber || !grabber->keepMouseGrab() || grabberDisabled)) {
- QScopedPointer<QMouseEvent> mouseEvent(QQuickCanvasPrivate::cloneMouseEvent(event, &localPos));
+ QScopedPointer<QMouseEvent> mouseEvent(QQuickWindowPrivate::cloneMouseEvent(event, &localPos));
mouseEvent->setAccepted(false);
switch (mouseEvent->type()) {
@@ -2008,10 +2008,10 @@ bool QQuickFlickable::sendMouseEvent(QMouseEvent *event)
if (c->mouseGrabberItem() == d->delayedPressTarget)
d->delayedPressTarget->ungrabMouse();
// Use the event handler that will take care of finding the proper item to propagate the event
- QQuickCanvasPrivate::get(canvas())->deliverMouseEvent(d->delayedPressEvent);
+ QQuickWindowPrivate::get(window())->deliverMouseEvent(d->delayedPressEvent);
d->clearDelayedPress();
// We send the release
- canvas()->sendEvent(c->mouseGrabberItem(), event);
+ window()->sendEvent(c->mouseGrabberItem(), event);
// And the event has been consumed
d->stealMouse = false;
d->pressed = false;
@@ -2054,7 +2054,7 @@ bool QQuickFlickable::childMouseEventFilter(QQuickItem *i, QEvent *e)
case QEvent::MouseButtonRelease:
return sendMouseEvent(static_cast<QMouseEvent *>(e));
case QEvent::UngrabMouse:
- if (d->canvas && d->canvas->mouseGrabberItem() && d->canvas->mouseGrabberItem() != this) {
+ if (d->window && d->window->mouseGrabberItem() && d->window->mouseGrabberItem() != this) {
// The grab has been taken away from a child and given to some other item.
mouseUngrabEvent();
}
diff --git a/src/quick/items/qquickimage.cpp b/src/quick/items/qquickimage.cpp
index 141e643d20..4279e27832 100644
--- a/src/quick/items/qquickimage.cpp
+++ b/src/quick/items/qquickimage.cpp
@@ -536,7 +536,7 @@ QSGTextureProvider *QQuickImage::textureProvider() const
Q_D(const QQuickImage);
if (!d->provider) {
// Make sure it gets thread affinity on the rendering thread so deletion works properly..
- Q_ASSERT_X(d->canvas
+ Q_ASSERT_X(d->window
&& d->sceneGraphContext()
&& QThread::currentThread() == d->sceneGraphContext()->thread(),
"QQuickImage::textureProvider",
@@ -544,7 +544,7 @@ QSGTextureProvider *QQuickImage::textureProvider() const
QQuickImagePrivate *dd = const_cast<QQuickImagePrivate *>(d);
dd->provider = new QQuickImageTextureProvider;
dd->provider->m_smooth = d->smooth;
- dd->provider->m_texture = d->sceneGraphContext()->textureForFactory(d->pix.textureFactory(), canvas());
+ dd->provider->m_texture = d->sceneGraphContext()->textureForFactory(d->pix.textureFactory(), window());
}
return d->provider;
@@ -554,7 +554,7 @@ QSGNode *QQuickImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
{
Q_D(QQuickImage);
- QSGTexture *texture = d->sceneGraphContext()->textureForFactory(d->pix.textureFactory(), canvas());
+ QSGTexture *texture = d->sceneGraphContext()->textureForFactory(d->pix.textureFactory(), window());
// Copy over the current texture state into the texture provider...
if (d->provider) {
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index 0d5518ce5d..667b919207 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -41,9 +41,9 @@
#include "qquickitem.h"
-#include "qquickcanvas.h"
+#include "qquickwindow.h"
#include <QtQml/qjsengine.h>
-#include "qquickcanvas_p.h"
+#include "qquickwindow_p.h"
#include "qquickevents_p_p.h"
#include "qquickscreen_p.h"
@@ -1352,12 +1352,12 @@ void QQuickKeysAttached::keyPressed(QKeyEvent *event, bool post)
}
// first process forwards
- if (d->item && d->item->canvas()) {
+ if (d->item && d->item->window()) {
d->inPress = true;
for (int ii = 0; ii < d->targets.count(); ++ii) {
QQuickItem *i = d->targets.at(ii);
if (i && i->isVisible()) {
- d->item->canvas()->sendEvent(i, event);
+ d->item->window()->sendEvent(i, event);
if (event->isAccepted()) {
d->inPress = false;
return;
@@ -1394,12 +1394,12 @@ void QQuickKeysAttached::keyReleased(QKeyEvent *event, bool post)
return;
}
- if (d->item && d->item->canvas()) {
+ if (d->item && d->item->window()) {
d->inRelease = true;
for (int ii = 0; ii < d->targets.count(); ++ii) {
QQuickItem *i = d->targets.at(ii);
if (i && i->isVisible()) {
- d->item->canvas()->sendEvent(i, event);
+ d->item->window()->sendEvent(i, event);
if (event->isAccepted()) {
d->inRelease = false;
return;
@@ -1419,12 +1419,12 @@ void QQuickKeysAttached::keyReleased(QKeyEvent *event, bool post)
void QQuickKeysAttached::inputMethodEvent(QInputMethodEvent *event, bool post)
{
Q_D(QQuickKeysAttached);
- if (post == m_processPost && d->item && !d->inIM && d->item->canvas()) {
+ if (post == m_processPost && d->item && !d->inIM && d->item->window()) {
d->inIM = true;
for (int ii = 0; ii < d->targets.count(); ++ii) {
QQuickItem *i = d->targets.at(ii);
if (i && i->isVisible() && (i->flags() & QQuickItem::ItemAcceptsInputMethod)) {
- d->item->canvas()->sendEvent(i, event);
+ d->item->window()->sendEvent(i, event);
if (event->isAccepted()) {
d->imeItem = i;
d->inIM = false;
@@ -1714,7 +1714,7 @@ void QQuickItemPrivate::updateSubFocusItem(QQuickItem *scope, bool focus)
surface. Using scene graph API directly is always significantly
faster.
- \sa QQuickCanvas, QQuickPaintedItem
+ \sa QQuickWindow, QQuickPaintedItem
*/
/*!
@@ -1872,12 +1872,12 @@ QQuickItem::~QQuickItem()
Q_D(QQuickItem);
- if (d->canvasRefCount > 1)
- d->canvasRefCount = 1; // Make sure canvas is set to null in next call to derefCanvas().
+ if (d->windowRefCount > 1)
+ d->windowRefCount = 1; // Make sure window is set to null in next call to derefWindow().
if (d->parentItem)
setParentItem(0);
- else if (d->canvas)
- d->derefCanvas();
+ else if (d->window)
+ d->derefWindow();
// XXX todo - optimize
while (!d->childItems.isEmpty())
@@ -1984,9 +1984,9 @@ void QQuickItem::setParentItem(QQuickItem *parentItem)
scopeItem = oldParentItem;
while (!scopeItem->isFocusScope() && scopeItem->parentItem())
scopeItem = scopeItem->parentItem();
- if (d->canvas) {
- QQuickCanvasPrivate::get(d->canvas)->clearFocusInScope(scopeItem, scopeFocusedItem,
- QQuickCanvasPrivate::DontChangeFocusProperty);
+ if (d->window) {
+ QQuickWindowPrivate::get(d->window)->clearFocusInScope(scopeItem, scopeFocusedItem,
+ QQuickWindowPrivate::DontChangeFocusProperty);
if (scopeFocusedItem != this)
QQuickItemPrivate::get(scopeFocusedItem)->updateSubFocusItem(this, true);
} else {
@@ -1999,29 +1999,29 @@ void QQuickItem::setParentItem(QQuickItem *parentItem)
if (wasVisible) {
emit oldParentItem->visibleChildrenChanged();
}
- } else if (d->canvas) {
- QQuickCanvasPrivate::get(d->canvas)->parentlessItems.remove(this);
+ } else if (d->window) {
+ QQuickWindowPrivate::get(d->window)->parentlessItems.remove(this);
}
- QQuickCanvas *oldParentCanvas = oldParentItem ? QQuickItemPrivate::get(oldParentItem)->canvas : 0;
- QQuickCanvas *parentCanvas = parentItem ? QQuickItemPrivate::get(parentItem)->canvas : 0;
- if (oldParentCanvas == parentCanvas) {
- // Avoid freeing and reallocating resources if the canvas stays the same.
+ QQuickWindow *oldParentWindow = oldParentItem ? QQuickItemPrivate::get(oldParentItem)->window : 0;
+ QQuickWindow *parentWindow = parentItem ? QQuickItemPrivate::get(parentItem)->window : 0;
+ if (oldParentWindow == parentWindow) {
+ // Avoid freeing and reallocating resources if the window stays the same.
d->parentItem = parentItem;
} else {
- if (oldParentCanvas)
- d->derefCanvas();
+ if (oldParentWindow)
+ d->derefWindow();
d->parentItem = parentItem;
- if (parentCanvas)
- d->refCanvas(parentCanvas);
+ if (parentWindow)
+ d->refWindow(parentWindow);
}
d->dirty(QQuickItemPrivate::ParentChanged);
if (d->parentItem)
QQuickItemPrivate::get(d->parentItem)->addChild(this);
- else if (d->canvas)
- QQuickCanvasPrivate::get(d->canvas)->parentlessItems.insert(this);
+ else if (d->window)
+ QQuickWindowPrivate::get(d->window)->parentlessItems.insert(this);
d->setEffectiveVisibleRecur(d->calcEffectiveVisible());
d->setEffectiveEnableRecur(0, d->calcEffectiveEnable());
@@ -2047,9 +2047,9 @@ void QQuickItem::setParentItem(QQuickItem *parentItem)
QQuickItemPrivate::get(scopeFocusedItem)->focus = false;
emit scopeFocusedItem->focusChanged(false);
} else {
- if (d->canvas) {
- QQuickCanvasPrivate::get(d->canvas)->setFocusInScope(scopeItem, scopeFocusedItem,
- QQuickCanvasPrivate::DontChangeFocusProperty);
+ if (d->window) {
+ QQuickWindowPrivate::get(d->window)->setFocusInScope(scopeItem, scopeFocusedItem,
+ QQuickWindowPrivate::DontChangeFocusProperty);
} else {
QQuickItemPrivate::get(scopeFocusedItem)->updateSubFocusItem(scopeItem, true);
}
@@ -2134,10 +2134,10 @@ QQuickItem *QQuickItem::parentItem() const
return d->parentItem;
}
-QQuickCanvas *QQuickItem::canvas() const
+QQuickWindow *QQuickItem::window() const
{
Q_D(const QQuickItem);
- return d->canvas;
+ return d->window;
}
static bool itemZOrder_sort(QQuickItem *lhs, QQuickItem *rhs)
@@ -2203,61 +2203,61 @@ void QQuickItemPrivate::removeChild(QQuickItem *child)
emit q->childrenChanged();
}
-void QQuickItemPrivate::refCanvas(QQuickCanvas *c)
+void QQuickItemPrivate::refWindow(QQuickWindow *c)
{
- // An item needs a canvas if it is referenced by another item which has a canvas.
+ // An item needs a window if it is referenced by another item which has a window.
// Typically the item is referenced by a parent, but can also be referenced by a
- // ShaderEffect or ShaderEffectSource. 'canvasRefCount' counts how many items with
- // a canvas is referencing this item. When the reference count goes from zero to one,
- // or one to zero, the canvas of this item is updated and propagated to the children.
- // As long as the reference count stays above zero, the canvas is unchanged.
- // refCanvas() increments the reference count.
- // derefCanvas() decrements the reference count.
+ // ShaderEffect or ShaderEffectSource. 'windowRefCount' counts how many items with
+ // a window is referencing this item. When the reference count goes from zero to one,
+ // or one to zero, the window of this item is updated and propagated to the children.
+ // As long as the reference count stays above zero, the window is unchanged.
+ // refWindow() increments the reference count.
+ // derefWindow() decrements the reference count.
Q_Q(QQuickItem);
- Q_ASSERT((canvas != 0) == (canvasRefCount > 0));
+ Q_ASSERT((window != 0) == (windowRefCount > 0));
Q_ASSERT(c);
- if (++canvasRefCount > 1) {
- if (c != canvas)
- qWarning("QQuickItem: Cannot use same item on different canvases at the same time.");
- return; // Canvas already set.
+ if (++windowRefCount > 1) {
+ if (c != window)
+ qWarning("QQuickItem: Cannot use same item on different windows at the same time.");
+ return; // Window already set.
}
- Q_ASSERT(canvas == 0);
- canvas = c;
+ Q_ASSERT(window == 0);
+ window = c;
if (polishScheduled)
- QQuickCanvasPrivate::get(canvas)->itemsToPolish.insert(q);
+ QQuickWindowPrivate::get(window)->itemsToPolish.insert(q);
if (!parentItem)
- QQuickCanvasPrivate::get(canvas)->parentlessItems.insert(q);
+ QQuickWindowPrivate::get(window)->parentlessItems.insert(q);
for (int ii = 0; ii < childItems.count(); ++ii) {
QQuickItem *child = childItems.at(ii);
- QQuickItemPrivate::get(child)->refCanvas(c);
+ QQuickItemPrivate::get(child)->refWindow(c);
}
- dirty(Canvas);
+ dirty(Window);
if (extra.isAllocated() && extra->screenAttached)
- extra->screenAttached->canvasChanged(c);
+ extra->screenAttached->windowChanged(c);
itemChange(QQuickItem::ItemSceneChange, c);
}
-void QQuickItemPrivate::derefCanvas()
+void QQuickItemPrivate::derefWindow()
{
Q_Q(QQuickItem);
- Q_ASSERT((canvas != 0) == (canvasRefCount > 0));
+ Q_ASSERT((window != 0) == (windowRefCount > 0));
- if (!canvas)
+ if (!window)
return; // This can happen when destroying recursive shader effect sources.
- if (--canvasRefCount > 0)
- return; // There are still other references, so don't set canvas to null yet.
+ if (--windowRefCount > 0)
+ return; // There are still other references, so don't set window to null yet.
q->releaseResources();
removeFromDirtyList();
- QQuickCanvasPrivate *c = QQuickCanvasPrivate::get(canvas);
+ QQuickWindowPrivate *c = QQuickWindowPrivate::get(window);
if (polishScheduled)
c->itemsToPolish.remove(q);
QMutableHashIterator<int, QQuickItem *> itemTouchMapIt(c->itemForTouchPointId);
@@ -2274,7 +2274,7 @@ void QQuickItemPrivate::derefCanvas()
if (!parentItem)
c->parentlessItems.remove(q);
- canvas = 0;
+ window = 0;
itemNodeInstance = 0;
@@ -2290,33 +2290,33 @@ void QQuickItemPrivate::derefCanvas()
for (int ii = 0; ii < childItems.count(); ++ii) {
QQuickItem *child = childItems.at(ii);
- QQuickItemPrivate::get(child)->derefCanvas();
+ QQuickItemPrivate::get(child)->derefWindow();
}
- dirty(Canvas);
+ dirty(Window);
if (extra.isAllocated() && extra->screenAttached)
- extra->screenAttached->canvasChanged(0);
- itemChange(QQuickItem::ItemSceneChange, (QQuickCanvas *)0);
+ extra->screenAttached->windowChanged(0);
+ itemChange(QQuickItem::ItemSceneChange, (QQuickWindow *)0);
}
/*!
-Returns a transform that maps points from canvas space into item space.
+Returns a transform that maps points from window space into item space.
*/
-QTransform QQuickItemPrivate::canvasToItemTransform() const
+QTransform QQuickItemPrivate::windowToItemTransform() const
{
// XXX todo - optimize
- return itemToCanvasTransform().inverted();
+ return itemToWindowTransform().inverted();
}
/*!
-Returns a transform that maps points from item space into canvas space.
+Returns a transform that maps points from item space into window space.
*/
-QTransform QQuickItemPrivate::itemToCanvasTransform() const
+QTransform QQuickItemPrivate::itemToWindowTransform() const
{
// XXX todo
- QTransform rv = parentItem?QQuickItemPrivate::get(parentItem)->itemToCanvasTransform():QTransform();
+ QTransform rv = parentItem?QQuickItemPrivate::get(parentItem)->itemToWindowTransform():QTransform();
itemToParentTransform(rv);
return rv;
}
@@ -2433,8 +2433,8 @@ QQuickItemPrivate::QQuickItemPrivate()
, dirtyAttributes(0)
, nextDirtyItem(0)
, prevDirtyItem(0)
- , canvas(0)
- , canvasRefCount(0)
+ , window(0)
+ , windowRefCount(0)
, parentItem(0)
, sortedChildItems(&childItems)
, subFocusItem(0)
@@ -3132,7 +3132,7 @@ QSGNode *QQuickItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
/*!
This function is called when the item's scene graph resources are no longer needed.
It allows items to free its resources, for instance textures, that are not owned by scene graph
- nodes. Note that scene graph nodes are managed by QQuickCanvas and should not be deleted by
+ nodes. Note that scene graph nodes are managed by QQuickWindow and should not be deleted by
this function. Scene graph resources are no longer needed when the parent is set to null and
the item is not used by any \l ShaderEffect or \l ShaderEffectSource.
@@ -3414,7 +3414,7 @@ void QQuickItem::setBaselineOffset(qreal offset)
* Schedules a call to updatePaintNode() for this item.
*
* The call to QQuickItem::updatePaintNode() will always happen if the
- * item is showing in a QQuickCanvas.
+ * item is showing in a QQuickWindow.
*
* Only items which specifies QQuickItem::ItemHasContents are allowed
* to call QQuickItem::update().
@@ -3431,11 +3431,11 @@ void QQuickItem::polish()
Q_D(QQuickItem);
if (!d->polishScheduled) {
d->polishScheduled = true;
- if (d->canvas) {
- QQuickCanvasPrivate *p = QQuickCanvasPrivate::get(d->canvas);
+ if (d->window) {
+ QQuickWindowPrivate *p = QQuickWindowPrivate::get(d->window);
bool maybeupdate = p->itemsToPolish.isEmpty();
p->itemsToPolish.insert(this);
- if (maybeupdate) d->canvas->maybeUpdate();
+ if (maybeupdate) d->window->maybeUpdate();
}
}
}
@@ -3500,8 +3500,8 @@ QTransform QQuickItem::itemTransform(QQuickItem *other, bool *ok) const
// invalid cases
if (ok) *ok = true;
- QTransform t = d->itemToCanvasTransform();
- if (other) t *= QQuickItemPrivate::get(other)->canvasToItemTransform();
+ QTransform t = d->itemToWindowTransform();
+ if (other) t *= QQuickItemPrivate::get(other)->windowToItemTransform();
return t;
}
@@ -3701,9 +3701,9 @@ void QQuickItem::componentComplete()
if (d->extra.isAllocated() && d->extra->contents)
d->extra->contents->complete();
- if (d->canvas && d->dirtyAttributes) {
+ if (d->window && d->dirtyAttributes) {
d->addToDirtyList();
- QQuickCanvasPrivate::get(d->canvas)->dirtyItem(this);
+ QQuickWindowPrivate::get(d->window)->dirtyItem(this);
}
}
@@ -4249,9 +4249,9 @@ bool QQuickItemPrivate::setEffectiveVisibleRecur(bool newEffectiveVisible)
dirty(Visible);
if (parentItem) QQuickItemPrivate::get(parentItem)->dirty(ChildrenStackingChanged);
- if (canvas) {
- QQuickCanvasPrivate *canvasPriv = QQuickCanvasPrivate::get(canvas);
- if (canvasPriv->mouseGrabberItem == q)
+ if (window) {
+ QQuickWindowPrivate *windowPriv = QQuickWindowPrivate::get(window);
+ if (windowPriv->mouseGrabberItem == q)
q->ungrabMouse();
}
@@ -4297,13 +4297,13 @@ void QQuickItemPrivate::setEffectiveEnableRecur(QQuickItem *scope, bool newEffec
effectiveEnable = newEffectiveEnable;
- if (canvas) {
- QQuickCanvasPrivate *canvasPriv = QQuickCanvasPrivate::get(canvas);
- if (canvasPriv->mouseGrabberItem == q)
+ if (window) {
+ QQuickWindowPrivate *windowPriv = QQuickWindowPrivate::get(window);
+ if (windowPriv->mouseGrabberItem == q)
q->ungrabMouse();
if (scope && !effectiveEnable && activeFocus) {
- canvasPriv->clearFocusInScope(
- scope, q, QQuickCanvasPrivate::DontChangeFocusProperty | QQuickCanvasPrivate::DontChangeSubFocusItem);
+ windowPriv->clearFocusInScope(
+ scope, q, QQuickWindowPrivate::DontChangeFocusProperty | QQuickWindowPrivate::DontChangeSubFocusItem);
}
}
@@ -4312,9 +4312,9 @@ void QQuickItemPrivate::setEffectiveEnableRecur(QQuickItem *scope, bool newEffec
(flags & QQuickItem::ItemIsFocusScope) && scope ? q : scope, newEffectiveEnable);
}
- if (canvas && scope && effectiveEnable && focus) {
- QQuickCanvasPrivate::get(canvas)->setFocusInScope(
- scope, q, QQuickCanvasPrivate::DontChangeFocusProperty | QQuickCanvasPrivate::DontChangeSubFocusItem);
+ if (window && scope && effectiveEnable && focus) {
+ QQuickWindowPrivate::get(window)->setFocusInScope(
+ scope, q, QQuickWindowPrivate::DontChangeFocusProperty | QQuickWindowPrivate::DontChangeSubFocusItem);
}
emit q->enabledChanged();
@@ -4344,7 +4344,7 @@ QString QQuickItemPrivate::dirtyToString() const
DIRTY_TO_STRING(ChildrenStackingChanged);
DIRTY_TO_STRING(ParentChanged);
DIRTY_TO_STRING(Clip);
- DIRTY_TO_STRING(Canvas);
+ DIRTY_TO_STRING(Window);
DIRTY_TO_STRING(EffectReference);
DIRTY_TO_STRING(Visible);
DIRTY_TO_STRING(HideReference);
@@ -4359,11 +4359,11 @@ void QQuickItemPrivate::dirty(DirtyType type)
if (type & (TransformOrigin | Transform | BasicTransform | Position | Size))
transformChanged();
- if (!(dirtyAttributes & type) || (canvas && !prevDirtyItem)) {
+ if (!(dirtyAttributes & type) || (window && !prevDirtyItem)) {
dirtyAttributes |= type;
- if (canvas && componentComplete) {
+ if (window && componentComplete) {
addToDirtyList();
- QQuickCanvasPrivate::get(canvas)->dirtyItem(q);
+ QQuickWindowPrivate::get(window)->dirtyItem(q);
}
}
}
@@ -4372,11 +4372,11 @@ void QQuickItemPrivate::addToDirtyList()
{
Q_Q(QQuickItem);
- Q_ASSERT(canvas);
+ Q_ASSERT(window);
if (!prevDirtyItem) {
Q_ASSERT(!nextDirtyItem);
- QQuickCanvasPrivate *p = QQuickCanvasPrivate::get(canvas);
+ QQuickWindowPrivate *p = QQuickWindowPrivate::get(window);
nextDirtyItem = p->dirtyItemList;
if (nextDirtyItem) QQuickItemPrivate::get(nextDirtyItem)->prevDirtyItem = &nextDirtyItem;
prevDirtyItem = &p->dirtyItemList;
@@ -4608,8 +4608,8 @@ void QQuickItem::setFlags(Flags flags)
Q_D(QQuickItem);
if ((flags & ItemIsFocusScope) != (d->flags & ItemIsFocusScope)) {
- if (flags & ItemIsFocusScope && !d->childItems.isEmpty() && d->canvas) {
- qWarning("QQuickItem: Cannot set FocusScope once item has children and is in a canvas.");
+ if (flags & ItemIsFocusScope && !d->childItems.isEmpty() && d->window) {
+ qWarning("QQuickItem: Cannot set FocusScope once item has children and is in a window.");
flags &= ~ItemIsFocusScope;
} else if (d->flags & ItemIsFocusScope) {
qWarning("QQuickItem: Cannot unset FocusScope flag.");
@@ -4998,19 +4998,19 @@ void QQuickItem::setFocus(bool focus)
if (d->focus == focus)
return;
- if (d->canvas || d->parentItem) {
+ if (d->window || d->parentItem) {
// Need to find our nearest focus scope
QQuickItem *scope = parentItem();
while (scope && !scope->isFocusScope() && scope->parentItem())
scope = scope->parentItem();
- if (d->canvas) {
+ if (d->window) {
if (focus)
- QQuickCanvasPrivate::get(d->canvas)->setFocusInScope(scope, this);
+ QQuickWindowPrivate::get(d->window)->setFocusInScope(scope, this);
else
- QQuickCanvasPrivate::get(d->canvas)->clearFocusInScope(scope, this);
+ QQuickWindowPrivate::get(d->window)->clearFocusInScope(scope, this);
} else {
// do the focus changes from setFocusInScope/clearFocusInScope that are
- // unrelated to a canvas
+ // unrelated to a window
QVarLengthArray<QQuickItem *, 20> changed;
QQuickItem *oldSubFocusItem = QQuickItemPrivate::get(scope)->subFocusItem;
if (oldSubFocusItem) {
@@ -5027,7 +5027,7 @@ void QQuickItem::setFocus(bool focus)
changed << this;
emit focusChanged(focus);
- QQuickCanvasPrivate::notifyFocusChangesRecur(changed.data(), changed.count() - 1);
+ QQuickWindowPrivate::notifyFocusChangesRecur(changed.data(), changed.count() - 1);
}
} else {
QVarLengthArray<QQuickItem *, 20> changed;
@@ -5042,7 +5042,7 @@ void QQuickItem::setFocus(bool focus)
changed << this;
emit focusChanged(focus);
- QQuickCanvasPrivate::notifyFocusChangesRecur(changed.data(), changed.count() - 1);
+ QQuickWindowPrivate::notifyFocusChangesRecur(changed.data(), changed.count() - 1);
}
}
@@ -5095,11 +5095,11 @@ void QQuickItem::setFiltersChildMouseEvents(bool filter)
bool QQuickItem::isUnderMouse() const
{
Q_D(const QQuickItem);
- if (!d->canvas)
+ if (!d->window)
return false;
QPointF cursorPos = QGuiApplicationPrivate::lastCursorPosition;
- return contains(mapFromScene(d->canvas->mapFromGlobal(cursorPos.toPoint())));
+ return contains(mapFromScene(d->window->mapFromGlobal(cursorPos.toPoint())));
}
bool QQuickItem::acceptHoverEvents() const
@@ -5117,35 +5117,35 @@ void QQuickItem::setAcceptHoverEvents(bool enabled)
void QQuickItem::grabMouse()
{
Q_D(QQuickItem);
- if (!d->canvas)
+ if (!d->window)
return;
- QQuickCanvasPrivate *canvasPriv = QQuickCanvasPrivate::get(d->canvas);
- if (canvasPriv->mouseGrabberItem == this)
+ QQuickWindowPrivate *windowPriv = QQuickWindowPrivate::get(d->window);
+ if (windowPriv->mouseGrabberItem == this)
return;
- QQuickItem *oldGrabber = canvasPriv->mouseGrabberItem;
- canvasPriv->mouseGrabberItem = this;
+ QQuickItem *oldGrabber = windowPriv->mouseGrabberItem;
+ windowPriv->mouseGrabberItem = this;
if (oldGrabber) {
QEvent ev(QEvent::UngrabMouse);
- d->canvas->sendEvent(oldGrabber, &ev);
+ d->window->sendEvent(oldGrabber, &ev);
}
}
void QQuickItem::ungrabMouse()
{
Q_D(QQuickItem);
- if (!d->canvas)
+ if (!d->window)
return;
- QQuickCanvasPrivate *canvasPriv = QQuickCanvasPrivate::get(d->canvas);
- if (canvasPriv->mouseGrabberItem != this) {
+ QQuickWindowPrivate *windowPriv = QQuickWindowPrivate::get(d->window);
+ if (windowPriv->mouseGrabberItem != this) {
qWarning("QQuickItem::ungrabMouse(): Item is not the mouse grabber.");
return;
}
- canvasPriv->mouseGrabberItem = 0;
+ windowPriv->mouseGrabberItem = 0;
QEvent ev(QEvent::UngrabMouse);
- d->canvas->sendEvent(this, &ev);
+ d->window->sendEvent(this, &ev);
}
bool QQuickItem::keepMouseGrab() const
@@ -5191,17 +5191,17 @@ void QQuickItem::setKeepMouseGrab(bool keep)
void QQuickItem::grabTouchPoints(const QVector<int> &ids)
{
Q_D(QQuickItem);
- if (!d->canvas)
+ if (!d->window)
return;
- QQuickCanvasPrivate *canvasPriv = QQuickCanvasPrivate::get(d->canvas);
+ QQuickWindowPrivate *windowPriv = QQuickWindowPrivate::get(d->window);
QSet<QQuickItem*> ungrab;
for (int i = 0; i < ids.count(); ++i) {
- QQuickItem *oldGrabber = canvasPriv->itemForTouchPointId.value(ids.at(i));
+ QQuickItem *oldGrabber = windowPriv->itemForTouchPointId.value(ids.at(i));
if (oldGrabber == this)
return;
- canvasPriv->itemForTouchPointId[ids.at(i)] = this;
+ windowPriv->itemForTouchPointId[ids.at(i)] = this;
if (oldGrabber)
ungrab.insert(oldGrabber);
}
@@ -5217,11 +5217,11 @@ void QQuickItem::grabTouchPoints(const QVector<int> &ids)
void QQuickItem::ungrabTouchPoints()
{
Q_D(QQuickItem);
- if (!d->canvas)
+ if (!d->window)
return;
- QQuickCanvasPrivate *canvasPriv = QQuickCanvasPrivate::get(d->canvas);
+ QQuickWindowPrivate *windowPriv = QQuickWindowPrivate::get(d->window);
- QMutableHashIterator<int, QQuickItem*> i(canvasPriv->itemForTouchPointId);
+ QMutableHashIterator<int, QQuickItem*> i(windowPriv->itemForTouchPointId);
while (i.hasNext()) {
i.next();
if (i.value() == this)
@@ -5295,22 +5295,22 @@ QPointF QQuickItem::mapToItem(const QQuickItem *item, const QPointF &point) cons
QPointF QQuickItem::mapToScene(const QPointF &point) const
{
Q_D(const QQuickItem);
- return d->itemToCanvasTransform().map(point);
+ return d->itemToWindowTransform().map(point);
}
QRectF QQuickItem::mapRectToItem(const QQuickItem *item, const QRectF &rect) const
{
Q_D(const QQuickItem);
- QTransform t = d->itemToCanvasTransform();
+ QTransform t = d->itemToWindowTransform();
if (item)
- t *= QQuickItemPrivate::get(item)->canvasToItemTransform();
+ t *= QQuickItemPrivate::get(item)->windowToItemTransform();
return t.mapRect(rect);
}
QRectF QQuickItem::mapRectToScene(const QRectF &rect) const
{
Q_D(const QQuickItem);
- return d->itemToCanvasTransform().mapRect(rect);
+ return d->itemToWindowTransform().mapRect(rect);
}
QPointF QQuickItem::mapFromItem(const QQuickItem *item, const QPointF &point) const
@@ -5322,21 +5322,21 @@ QPointF QQuickItem::mapFromItem(const QQuickItem *item, const QPointF &point) co
QPointF QQuickItem::mapFromScene(const QPointF &point) const
{
Q_D(const QQuickItem);
- return d->canvasToItemTransform().map(point);
+ return d->windowToItemTransform().map(point);
}
QRectF QQuickItem::mapRectFromItem(const QQuickItem *item, const QRectF &rect) const
{
Q_D(const QQuickItem);
- QTransform t = item?QQuickItemPrivate::get(item)->itemToCanvasTransform():QTransform();
- t *= d->canvasToItemTransform();
+ QTransform t = item?QQuickItemPrivate::get(item)->itemToWindowTransform():QTransform();
+ t *= d->windowToItemTransform();
return t.mapRect(rect);
}
QRectF QQuickItem::mapRectFromScene(const QRectF &rect) const
{
Q_D(const QQuickItem);
- return d->canvasToItemTransform().mapRect(rect);
+ return d->windowToItemTransform().mapRect(rect);
}
@@ -5414,9 +5414,9 @@ QRectF QQuickItem::mapRectFromScene(const QRectF &rect) const
\l {Filter}{Filters} include things like \l {Blur}{blurring}
the item, or giving it a \l Reflection. Some
- filters may not be available on all canvases; if a filter is not
- available on a certain canvas, it will simply not be applied for
- that canvas (but the QML will still be considered valid).
+ filters may not be available on all windows; if a filter is not
+ available on a certain window, it will simply not be applied for
+ that window (but the QML will still be considered valid).
\qml
Item {
diff --git a/src/quick/items/qquickitem.h b/src/quick/items/qquickitem.h
index 15bf5dd46d..61bb3250ea 100644
--- a/src/quick/items/qquickitem.h
+++ b/src/quick/items/qquickitem.h
@@ -88,7 +88,7 @@ class QQuickTransition;
class QQuickKeyEvent;
class QQuickAnchors;
class QQuickItemPrivate;
-class QQuickCanvas;
+class QQuickWindow;
class QTouchEvent;
class QSGNode;
class QSGTransformNode;
@@ -166,7 +166,7 @@ public:
enum ItemChange {
ItemChildAddedChange, // value.item
ItemChildRemovedChange, // value.item
- ItemSceneChange, // value.canvas
+ ItemSceneChange, // value.window
ItemVisibleHasChanged, // value.boolValue
ItemParentHasChanged, // value.item
ItemOpacityHasChanged, // value.realValue
@@ -176,12 +176,12 @@ public:
union ItemChangeData {
ItemChangeData(QQuickItem *v) : item(v) {}
- ItemChangeData(QQuickCanvas *v) : canvas(v) {}
+ ItemChangeData(QQuickWindow *v) : window(v) {}
ItemChangeData(qreal v) : realValue(v) {}
ItemChangeData(bool v) : boolValue(v) {}
QQuickItem *item;
- QQuickCanvas *canvas;
+ QQuickWindow *window;
qreal realValue;
bool boolValue;
};
@@ -195,7 +195,9 @@ public:
QQuickItem(QQuickItem *parent = 0);
virtual ~QQuickItem();
- QQuickCanvas *canvas() const;
+ //canvas() is being removed in favor of window() really soon now
+ QQuickWindow *canvas() const { return window(); }
+ QQuickWindow *window() const;
QQuickItem *parentItem() const;
void setParentItem(QQuickItem *parent);
void stackBefore(const QQuickItem *);
@@ -317,7 +319,7 @@ public:
struct UpdatePaintNodeData {
QSGTransformNode *transformNode;
private:
- friend class QQuickCanvasPrivate;
+ friend class QQuickWindowPrivate;
UpdatePaintNodeData();
};
@@ -409,8 +411,8 @@ protected:
QQuickItem(QQuickItemPrivate &dd, QQuickItem *parent = 0);
private:
- friend class QQuickCanvas;
- friend class QQuickCanvasPrivate;
+ friend class QQuickWindow;
+ friend class QQuickWindowPrivate;
friend class QSGRenderer;
friend class QAccessibleQuickItem;
friend class QQuickAccessibleAttached;
diff --git a/src/quick/items/qquickitem_p.h b/src/quick/items/qquickitem_p.h
index 69099212ea..adfe384b25 100644
--- a/src/quick/items/qquickitem_p.h
+++ b/src/quick/items/qquickitem_p.h
@@ -59,7 +59,7 @@
#include "qquickanchors_p_p.h"
#include "qquickitemchangelistener_p.h"
-#include "qquickcanvas_p.h"
+#include "qquickwindow_p.h"
#include <QtQuick/qsgnode.h>
#include "qquickclipnode_p.h"
@@ -427,7 +427,7 @@ public:
ParentChanged = 0x00000800,
Clip = 0x00001000,
- Canvas = 0x00002000,
+ Window = 0x00002000,
EffectReference = 0x00008000,
Visible = 0x00010000,
@@ -437,10 +437,10 @@ public:
// dirtyToString()
TransformUpdateMask = TransformOrigin | Transform | BasicTransform | Position |
- Size | Canvas,
- ComplexTransformUpdateMask = Transform | Canvas,
- ContentUpdateMask = Size | Content | Smooth | Canvas | Antialiasing,
- ChildrenUpdateMask = ChildrenChanged | ChildrenStackingChanged | EffectReference | Canvas
+ Size | Window,
+ ComplexTransformUpdateMask = Transform | Window,
+ ContentUpdateMask = Size | Content | Smooth | Window | Antialiasing,
+ ChildrenUpdateMask = ChildrenChanged | ChildrenStackingChanged | EffectReference | Window
};
quint32 dirtyAttributes;
@@ -453,8 +453,8 @@ public:
void setCulled(bool);
- QQuickCanvas *canvas;
- int canvasRefCount;
+ QQuickWindow *window;
+ int windowRefCount;
inline QSGContext *sceneGraphContext() const;
QQuickItem *parentItem;
@@ -469,14 +469,14 @@ public:
inline void markSortedChildrenDirty(QQuickItem *child);
- void refCanvas(QQuickCanvas *);
- void derefCanvas();
+ void refWindow(QQuickWindow *);
+ void derefWindow();
QQuickItem *subFocusItem;
void updateSubFocusItem(QQuickItem *scope, bool focus);
- QTransform canvasToItemTransform() const;
- QTransform itemToCanvasTransform() const;
+ QTransform windowToItemTransform() const;
+ QTransform itemToWindowTransform() const;
void itemToParentTransform(QTransform &) const;
qreal x;
@@ -837,8 +837,8 @@ Qt::MouseButtons QQuickItemPrivate::acceptedMouseButtons() const
QSGContext *QQuickItemPrivate::sceneGraphContext() const
{
- Q_ASSERT(canvas);
- return static_cast<QQuickCanvasPrivate *>(QObjectPrivate::get(canvas))->context;
+ Q_ASSERT(window);
+ return static_cast<QQuickWindowPrivate *>(QObjectPrivate::get(window))->context;
}
void QQuickItemPrivate::markSortedChildrenDirty(QQuickItem *child)
diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp
index 88cf547829..5cfd62ff8f 100644
--- a/src/quick/items/qquickmousearea.cpp
+++ b/src/quick/items/qquickmousearea.cpp
@@ -41,7 +41,7 @@
#include "qquickmousearea_p.h"
#include "qquickmousearea_p_p.h"
-#include "qquickcanvas.h"
+#include "qquickwindow.h"
#include "qquickevents_p_p.h"
#include "qquickdrag_p.h"
@@ -264,13 +264,13 @@ void QQuickMouseAreaPrivate::propagate(QQuickMouseEvent* event, PropagateType t)
if (!propagateComposedEvents)
return;
QPointF scenePos = q->mapToScene(QPointF(event->x(), event->y()));
- propagateHelper(event, canvas->rootItem(), scenePos, t);
+ propagateHelper(event, window->rootItem(), scenePos, t);
}
bool QQuickMouseAreaPrivate::propagateHelper(QQuickMouseEvent *ev, QQuickItem *item,const QPointF &sp, PropagateType sig)
{
- //Based off of QQuickCanvas::deliverInitialMousePressEvent
- //But specific to MouseArea, so doesn't belong in canvas
+ //Based off of QQuickWindow::deliverInitialMousePressEvent
+ //But specific to MouseArea, so doesn't belong in window
Q_Q(const QQuickMouseArea);
QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
@@ -795,8 +795,8 @@ void QQuickMouseArea::mouseMoveEvent(QMouseEvent *event)
d->drag->target()->setPos(dragPos);
if (!keepMouseGrab()) {
- bool xDragged = QQuickCanvasPrivate::dragOverThreshold(dx, Qt::XAxis, event);
- bool yDragged = QQuickCanvasPrivate::dragOverThreshold(dy, Qt::YAxis, event);
+ bool xDragged = QQuickWindowPrivate::dragOverThreshold(dx, Qt::XAxis, event);
+ bool yDragged = QQuickWindowPrivate::dragOverThreshold(dy, Qt::YAxis, event);
if ((!dragY && !yDragged && dragX && xDragged)
|| (!dragX && !xDragged && dragY && yDragged)
|| (dragX && dragY && (xDragged || yDragged))) {
@@ -835,8 +835,8 @@ void QQuickMouseArea::mouseReleaseEvent(QMouseEvent *event)
// If we don't accept hover, we need to reset containsMouse.
if (!acceptHoverEvents())
setHovered(false);
- QQuickCanvas *c = canvas();
- if (c && c->mouseGrabberItem() == this)
+ QQuickWindow *w = window();
+ if (w && w->mouseGrabberItem() == this)
ungrabMouse();
setKeepMouseGrab(false);
}
@@ -947,7 +947,7 @@ bool QQuickMouseArea::sendMouseEvent(QMouseEvent *event)
Q_D(QQuickMouseArea);
QPointF localPos = mapFromScene(event->windowPos());
- QQuickCanvas *c = canvas();
+ QQuickWindow *c = window();
QQuickItem *grabber = c ? c->mouseGrabberItem() : 0;
bool stealThisEvent = d->stealMouse;
if ((stealThisEvent || contains(localPos)) && (!grabber || !grabber->keepMouseGrab())) {
@@ -1067,7 +1067,7 @@ void QQuickMouseArea::itemChange(ItemChange change, const ItemChangeData &value)
if (acceptHoverEvents() && d->hovered != (isVisible() && isUnderMouse())) {
if (!d->hovered) {
QPointF cursorPos = QGuiApplicationPrivate::lastCursorPosition;
- d->lastScenePos = d->canvas->mapFromGlobal(cursorPos.toPoint());
+ d->lastScenePos = d->window->mapFromGlobal(cursorPos.toPoint());
d->lastPos = mapFromScene(d->lastScenePos);
}
setHovered(!d->hovered);
@@ -1139,9 +1139,9 @@ void QQuickMouseArea::setHovered(bool h)
#ifndef QT_NO_CURSOR
if (d->cursor) {
if (d->hovered) {
- canvas()->setCursor(QCursor(*d->cursor));
+ window()->setCursor(QCursor(*d->cursor));
} else {
- canvas()->unsetCursor();
+ window()->unsetCursor();
}
}
#endif
diff --git a/src/quick/items/qquickmultipointtoucharea.cpp b/src/quick/items/qquickmultipointtoucharea.cpp
index 0348c25c25..15e60582b1 100644
--- a/src/quick/items/qquickmultipointtoucharea.cpp
+++ b/src/quick/items/qquickmultipointtoucharea.cpp
@@ -40,7 +40,7 @@
****************************************************************************/
#include "qquickmultipointtoucharea_p.h"
-#include <QtQuick/qquickcanvas.h>
+#include <QtQuick/qquickwindow.h>
#include <private/qsgadaptationlayer_p.h>
#include <private/qquickitem_p.h>
#include <QEvent>
@@ -386,7 +386,7 @@ void QQuickMultiPointTouchArea::touchEvent(QTouchEvent *event)
case QEvent::TouchUpdate:
case QEvent::TouchEnd: {
//if e.g. a parent Flickable has the mouse grab, don't process the touch events
- QQuickCanvas *c = canvas();
+ QQuickWindow *c = window();
QQuickItem *grabber = c ? c->mouseGrabberItem() : 0;
if (grabber && grabber != this && grabber->keepMouseGrab() && grabber->isEnabled()) {
QQuickItem *item = this;
@@ -397,7 +397,7 @@ void QQuickMultiPointTouchArea::touchEvent(QTouchEvent *event)
}
updateTouchData(event);
if (event->type() == QEvent::TouchEnd) {
- //TODO: move to canvas
+ //TODO: move to window
_stealMouse = false;
setKeepMouseGrab(false);
setKeepTouchGrab(false);
@@ -593,7 +593,7 @@ void QQuickMultiPointTouchArea::mouseReleaseEvent(QMouseEvent *event)
QQuickItem::mouseReleaseEvent(event);
return;
}
- QQuickCanvas *c = canvas();
+ QQuickWindow *c = window();
if (c && c->mouseGrabberItem() == this)
ungrabMouse();
setKeepMouseGrab(false);
@@ -602,7 +602,7 @@ void QQuickMultiPointTouchArea::mouseReleaseEvent(QMouseEvent *event)
void QQuickMultiPointTouchArea::ungrab()
{
if (_touchPoints.count()) {
- QQuickCanvas *c = canvas();
+ QQuickWindow *c = window();
if (c && c->mouseGrabberItem() == this) {
_stealMouse = false;
setKeepMouseGrab(false);
@@ -638,7 +638,7 @@ bool QQuickMultiPointTouchArea::sendMouseEvent(QMouseEvent *event)
{
QPointF localPos = mapFromScene(event->windowPos());
- QQuickCanvas *c = canvas();
+ QQuickWindow *c = window();
QQuickItem *grabber = c ? c->mouseGrabberItem() : 0;
bool stealThisEvent = _stealMouse;
if ((stealThisEvent || contains(localPos)) && (!grabber || !grabber->keepMouseGrab())) {
@@ -709,7 +709,7 @@ bool QQuickMultiPointTouchArea::childMouseEventFilter(QQuickItem *i, QEvent *eve
bool QQuickMultiPointTouchArea::shouldFilter(QEvent *event)
{
- QQuickCanvas *c = canvas();
+ QQuickWindow *c = window();
QQuickItem *grabber = c ? c->mouseGrabberItem() : 0;
bool disabledItem = grabber && !grabber->isEnabled();
bool stealThisEvent = _stealMouse;
diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp
index 52e200d1fb..cb56dd265f 100644
--- a/src/quick/items/qquickpathview.cpp
+++ b/src/quick/items/qquickpathview.cpp
@@ -41,7 +41,7 @@
#include "qquickpathview_p.h"
#include "qquickpathview_p_p.h"
-#include "qquickcanvas.h"
+#include "qquickwindow.h"
#include <QtQuick/private/qquickstate_p.h>
#include <private/qqmlglobal_p.h>
@@ -1516,7 +1516,7 @@ bool QQuickPathView::sendMouseEvent(QMouseEvent *event)
Q_D(QQuickPathView);
QPointF localPos = mapFromScene(event->windowPos());
- QQuickCanvas *c = canvas();
+ QQuickWindow *c = window();
QQuickItem *grabber = c ? c->mouseGrabberItem() : 0;
bool stealThisEvent = d->stealMouse;
if ((stealThisEvent || contains(localPos)) && (!grabber || !grabber->keepMouseGrab())) {
diff --git a/src/quick/items/qquickpincharea.cpp b/src/quick/items/qquickpincharea.cpp
index 848e887fba..d167d75efb 100644
--- a/src/quick/items/qquickpincharea.cpp
+++ b/src/quick/items/qquickpincharea.cpp
@@ -40,7 +40,7 @@
****************************************************************************/
#include "qquickpincharea_p_p.h"
-#include "qquickcanvas.h"
+#include "qquickwindow.h"
#include <QtGui/qevent.h>
#include <QtGui/qguiapplication.h>
@@ -285,7 +285,7 @@ void QQuickPinchArea::touchEvent(QTouchEvent *event)
// A common non-trivial starting scenario is the user puts down one finger,
// then that finger remains stationary while putting down a second one.
- // However QQuickCanvas will not send TouchUpdates for TouchPoints which
+ // However QQuickWindow will not send TouchUpdates for TouchPoints which
// were not initially accepted; that would be inefficient and noisy.
// So even if there is only one touchpoint so far, it's important to accept it
// in order to get updates later on (and it's accepted by default anyway).
@@ -416,7 +416,7 @@ void QQuickPinchArea::updatePinch()
if (pe.accepted()) {
d->inPinch = true;
d->stealMouse = true;
- QQuickCanvas *c = canvas();
+ QQuickWindow *c = window();
if (c && c->mouseGrabberItem() != this)
grabMouse();
setKeepMouseGrab(true);
diff --git a/src/quick/items/qquickscreen.cpp b/src/quick/items/qquickscreen.cpp
index a55cb1f105..32b0d321db 100644
--- a/src/quick/items/qquickscreen.cpp
+++ b/src/quick/items/qquickscreen.cpp
@@ -43,7 +43,7 @@
#include "qquickitem.h"
#include "qquickitem_p.h"
-#include "qquickcanvas.h"
+#include "qquickwindow.h"
#include <QScreen>
@@ -108,8 +108,8 @@ QQuickScreenAttached::QQuickScreenAttached(QObject* attachee)
if (m_attachee) {
QQuickItemPrivate::get(m_attachee)->extra.value().screenAttached = this;
- if (m_attachee->canvas()) //It might not be assigned to a canvas yet
- canvasChanged(m_attachee->canvas());
+ if (m_attachee->window()) //It might not be assigned to a window yet
+ windowChanged(m_attachee->window());
}
}
@@ -148,7 +148,7 @@ int QQuickScreenAttached::angleBetween(int a, int b)
return m_screen->angleBetween((Qt::ScreenOrientation)a,(Qt::ScreenOrientation)b);
}
-void QQuickScreenAttached::canvasChanged(QQuickCanvas* c)//Called by QQuickItemPrivate::initCanvas
+void QQuickScreenAttached::windowChanged(QQuickWindow* c)//Called by QQuickItemPrivate::initWindow
{
QScreen* screen = c ? c->screen() : 0;
if (screen != m_screen) {
diff --git a/src/quick/items/qquickscreen_p.h b/src/quick/items/qquickscreen_p.h
index 1a501f2f0f..45a339bd8e 100644
--- a/src/quick/items/qquickscreen_p.h
+++ b/src/quick/items/qquickscreen_p.h
@@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE
class QQuickItem;
-class QQuickCanvas;
+class QQuickWindow;
class QScreen;
class Q_AUTOTEST_EXPORT QQuickScreenAttached : public QObject
@@ -76,7 +76,7 @@ public:
//Treats int as Qt::ScreenOrientation, due to QTBUG-20639
Q_INVOKABLE int angleBetween(int a, int b);
- void canvasChanged(QQuickCanvas*);
+ void windowChanged(QQuickWindow*);
Q_SIGNALS:
void widthChanged();
diff --git a/src/quick/items/qquickshadereffect.cpp b/src/quick/items/qquickshadereffect.cpp
index be3023036b..0b8189fa33 100644
--- a/src/quick/items/qquickshadereffect.cpp
+++ b/src/quick/items/qquickshadereffect.cpp
@@ -47,7 +47,7 @@
#include <QtQuick/private/qsgcontext_p.h>
#include <QtQuick/qsgtextureprovider.h>
-#include "qquickcanvas.h"
+#include "qquickwindow.h"
#include "qquickimage_p.h"
#include "qquickshadereffectsource_p.h"
@@ -224,8 +224,8 @@ void QQuickShaderEffectCommon::disconnectPropertySignals(QQuickItem *item, Key::
if (d.specialType == UniformData::Sampler) {
QQuickItem *source = qobject_cast<QQuickItem *>(qvariant_cast<QObject *>(d.value));
if (source) {
- if (item->canvas())
- QQuickItemPrivate::get(source)->derefCanvas();
+ if (item->window())
+ QQuickItemPrivate::get(source)->derefWindow();
QObject::disconnect(source, SIGNAL(destroyed(QObject*)), item, SLOT(sourceDestroyed(QObject*)));
}
}
@@ -257,8 +257,8 @@ void QQuickShaderEffectCommon::connectPropertySignals(QQuickItem *item, Key::Sha
if (d.specialType == UniformData::Sampler) {
QQuickItem *source = qobject_cast<QQuickItem *>(qvariant_cast<QObject *>(d.value));
if (source) {
- if (item->canvas())
- QQuickItemPrivate::get(source)->refCanvas(item->canvas());
+ if (item->window())
+ QQuickItemPrivate::get(source)->refWindow(item->window());
QObject::connect(source, SIGNAL(destroyed(QObject*)), item, SLOT(sourceDestroyed(QObject*)));
}
}
@@ -454,17 +454,17 @@ void QQuickShaderEffectCommon::updateMaterial(QQuickShaderEffectNode *node,
}
}
-void QQuickShaderEffectCommon::updateCanvas(QQuickCanvas *canvas)
+void QQuickShaderEffectCommon::updateWindow(QQuickWindow *window)
{
// See comment in QQuickShaderEffectCommon::propertyChanged().
- if (canvas) {
+ if (window) {
for (int shaderType = 0; shaderType < Key::ShaderTypeCount; ++shaderType) {
for (int i = 0; i < uniformData[shaderType].size(); ++i) {
const UniformData &d = uniformData[shaderType].at(i);
if (d.specialType == UniformData::Sampler) {
QQuickItem *source = qobject_cast<QQuickItem *>(qvariant_cast<QObject *>(d.value));
if (source)
- QQuickItemPrivate::get(source)->refCanvas(canvas);
+ QQuickItemPrivate::get(source)->refWindow(window);
}
}
}
@@ -475,7 +475,7 @@ void QQuickShaderEffectCommon::updateCanvas(QQuickCanvas *canvas)
if (d.specialType == UniformData::Sampler) {
QQuickItem *source = qobject_cast<QQuickItem *>(qvariant_cast<QObject *>(d.value));
if (source)
- QQuickItemPrivate::get(source)->derefCanvas();
+ QQuickItemPrivate::get(source)->derefWindow();
}
}
}
@@ -505,8 +505,8 @@ void QQuickShaderEffectCommon::propertyChanged(QQuickItem *item, int mappedId,
if (d.specialType == UniformData::Sampler) {
QQuickItem *source = qobject_cast<QQuickItem *>(qvariant_cast<QObject *>(d.value));
if (source) {
- if (item->canvas())
- QQuickItemPrivate::get(source)->derefCanvas();
+ if (item->window())
+ QQuickItemPrivate::get(source)->derefWindow();
QObject::disconnect(source, SIGNAL(destroyed(QObject*)), item, SLOT(sourceDestroyed(QObject*)));
}
@@ -514,12 +514,12 @@ void QQuickShaderEffectCommon::propertyChanged(QQuickItem *item, int mappedId,
source = qobject_cast<QQuickItem *>(qvariant_cast<QObject *>(d.value));
if (source) {
- // 'source' needs a canvas to get a scene graph node. It usually gets one through its
+ // 'source' needs a window to get a scene graph node. It usually gets one through its
// parent, but if the source item is "inline" rather than a reference -- i.e.
// "property variant source: Image { }" instead of "property variant source: foo" -- it
- // will not get a parent. In those cases, 'source' should get the canvas from 'item'.
- if (item->canvas())
- QQuickItemPrivate::get(source)->refCanvas(item->canvas());
+ // will not get a parent. In those cases, 'source' should get the window from 'item'.
+ if (item->window())
+ QQuickItemPrivate::get(source)->refWindow(item->window());
QObject::connect(source, SIGNAL(destroyed(QObject*)), item, SLOT(sourceDestroyed(QObject*)));
}
if (textureProviderChanged)
@@ -1009,7 +1009,7 @@ void QQuickShaderEffect::componentComplete()
void QQuickShaderEffect::itemChange(ItemChange change, const ItemChangeData &value)
{
if (change == QQuickItem::ItemSceneChange)
- m_common.updateCanvas(value.canvas);
+ m_common.updateWindow(value.window);
QQuickItem::itemChange(change, value);
}
diff --git a/src/quick/items/qquickshadereffect_p.h b/src/quick/items/qquickshadereffect_p.h
index 2f41324f0f..e7bcd90adb 100644
--- a/src/quick/items/qquickshadereffect_p.h
+++ b/src/quick/items/qquickshadereffect_p.h
@@ -77,7 +77,7 @@ struct Q_QUICK_PRIVATE_EXPORT QQuickShaderEffectCommon
void updateShader(QQuickItem *item, Key::ShaderType shaderType);
void updateMaterial(QQuickShaderEffectNode *node, QQuickShaderEffectMaterial *material,
bool updateUniforms, bool updateUniformValues, bool updateTextureProviders);
- void updateCanvas(QQuickCanvas *canvas);
+ void updateWindow(QQuickWindow *window);
// Called by slots in QQuickShaderEffect:
void sourceDestroyed(QObject *object);
diff --git a/src/quick/items/qquickshadereffectsource.cpp b/src/quick/items/qquickshadereffectsource.cpp
index 3804c933c8..5ccd7bc247 100644
--- a/src/quick/items/qquickshadereffectsource.cpp
+++ b/src/quick/items/qquickshadereffectsource.cpp
@@ -42,7 +42,7 @@
#include "qquickshadereffectsource_p.h"
#include "qquickitem_p.h"
-#include "qquickcanvas_p.h"
+#include "qquickwindow_p.h"
#include <private/qsgadaptationlayer_p.h>
#include <QtQuick/private/qsgrenderer_p.h>
@@ -568,8 +568,8 @@ QQuickShaderEffectSource::~QQuickShaderEffectSource()
QQuickItemPrivate *sd = QQuickItemPrivate::get(m_sourceItem);
sd->removeItemChangeListener(this, QQuickItemPrivate::Geometry);
sd->derefFromEffectItem(m_hideSource);
- if (canvas())
- sd->derefCanvas();
+ if (window())
+ sd->derefWindow();
}
}
@@ -578,7 +578,7 @@ void QQuickShaderEffectSource::ensureTexture()
if (m_texture)
return;
- Q_ASSERT_X(QQuickItemPrivate::get(this)->canvas
+ Q_ASSERT_X(QQuickItemPrivate::get(this)->window
&& QQuickItemPrivate::get(this)->sceneGraphContext()
&& QThread::currentThread() == QQuickItemPrivate::get(this)->sceneGraphContext()->thread(),
"QQuickShaderEffectSource::ensureTexture",
@@ -593,7 +593,7 @@ QSGTextureProvider *QQuickShaderEffectSource::textureProvider() const
{
if (!m_provider) {
// Make sure it gets thread affinity on the rendering thread so deletion works properly..
- Q_ASSERT_X(QQuickItemPrivate::get(this)->canvas
+ Q_ASSERT_X(QQuickItemPrivate::get(this)->window
&& QQuickItemPrivate::get(this)->sceneGraphContext()
&& QThread::currentThread() == QQuickItemPrivate::get(this)->sceneGraphContext()->thread(),
"QQuickShaderEffectSource::textureProvider",
@@ -668,19 +668,19 @@ void QQuickShaderEffectSource::setSourceItem(QQuickItem *item)
d->derefFromEffectItem(m_hideSource);
d->removeItemChangeListener(this, QQuickItemPrivate::Geometry);
disconnect(m_sourceItem, SIGNAL(destroyed(QObject*)), this, SLOT(sourceItemDestroyed(QObject*)));
- if (canvas())
- d->derefCanvas();
+ if (window())
+ d->derefWindow();
}
m_sourceItem = item;
if (item) {
QQuickItemPrivate *d = QQuickItemPrivate::get(item);
- // 'item' needs a canvas to get a scene graph node. It usually gets one through its
+ // 'item' needs a window to get a scene graph node. It usually gets one through its
// parent, but if the source item is "inline" rather than a reference -- i.e.
// "sourceItem: Item { }" instead of "sourceItem: foo" -- it will not get a parent.
- // In those cases, 'item' should get the canvas from 'this'.
- if (canvas())
- d->refCanvas(canvas());
+ // In those cases, 'item' should get the window from 'this'.
+ if (window())
+ d->refWindow(window());
d->refFromEffectItem(m_hideSource);
d->addItemChangeListener(this, QQuickItemPrivate::Geometry);
connect(m_sourceItem, SIGNAL(destroyed(QObject*)), this, SLOT(sourceItemDestroyed(QObject*)));
@@ -1015,10 +1015,10 @@ void QQuickShaderEffectSource::itemChange(ItemChange change, const ItemChangeDat
{
if (change == QQuickItem::ItemSceneChange && m_sourceItem) {
// See comment in QQuickShaderEffectSource::setSourceItem().
- if (value.canvas)
- QQuickItemPrivate::get(m_sourceItem)->refCanvas(value.canvas);
+ if (value.window)
+ QQuickItemPrivate::get(m_sourceItem)->refWindow(value.window);
else
- QQuickItemPrivate::get(m_sourceItem)->derefCanvas();
+ QQuickItemPrivate::get(m_sourceItem)->derefWindow();
}
QQuickItem::itemChange(change, value);
}
diff --git a/src/quick/items/qquickspritesequence.cpp b/src/quick/items/qquickspritesequence.cpp
index def6963763..62ab20b35e 100644
--- a/src/quick/items/qquickspritesequence.cpp
+++ b/src/quick/items/qquickspritesequence.cpp
@@ -47,7 +47,7 @@
#include <QtQuick/qsgnode.h>
#include <QtQuick/qsgtexturematerial.h>
#include <QtQuick/qsgtexture.h>
-#include <QtQuick/qquickcanvas.h>
+#include <QtQuick/qquickwindow.h>
#include <QtQml/qqmlinfo.h>
#include <QFile>
#include <cmath>
@@ -367,7 +367,7 @@ QSGGeometryNode* QQuickSpriteSequence::buildNode()
if (image.isNull())
return 0;
m_sheetSize = QSizeF(image.size());
- m_material->texture = canvas()->createTextureFromImage(image);
+ m_material->texture = window()->createTextureFromImage(image);
m_material->texture->setFiltering(QSGTexture::Linear);
m_spriteEngine->start(0);
m_material->animT = 0;
diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp
index 7159410ff5..3737a0e3b3 100644
--- a/src/quick/items/qquicktextedit.cpp
+++ b/src/quick/items/qquicktextedit.cpp
@@ -44,7 +44,7 @@
#include "qquicktextcontrol_p.h"
#include "qquicktext_p_p.h"
#include "qquickevents_p_p.h"
-#include "qquickcanvas.h"
+#include "qquickwindow.h"
#include "qquicktextnode_p.h"
#include "qquicktextutil_p.h"
#include <QtQuick/qsgsimplerectnode.h>
diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp
index 16adcd333d..b243442513 100644
--- a/src/quick/items/qquicktextinput.cpp
+++ b/src/quick/items/qquicktextinput.cpp
@@ -41,7 +41,7 @@
#include "qquicktextinput_p.h"
#include "qquicktextinput_p_p.h"
-#include "qquickcanvas.h"
+#include "qquickwindow.h"
#include "qquicktextutil_p.h"
#include <private/qqmlglobal_p.h>
diff --git a/src/quick/items/qquickview.cpp b/src/quick/items/qquickview.cpp
index 52c99591a4..2a56c7374c 100644
--- a/src/quick/items/qquickview.cpp
+++ b/src/quick/items/qquickview.cpp
@@ -42,7 +42,7 @@
#include "qquickview.h"
#include "qquickview_p.h"
-#include "qquickcanvas_p.h"
+#include "qquickwindow_p.h"
#include "qquickitem_p.h"
#include "qquickitemchangelistener_p.h"
@@ -128,9 +128,9 @@ void QQuickViewPrivate::itemGeometryChanged(QQuickItem *resizeItem, const QRectF
\inmodule QtQuick
- This is a convenience subclass of QQuickCanvas which
+ This is a convenience subclass of QQuickWindow which
will automatically load and display a QML scene when given the URL of the main source file. Alternatively,
- you can instantiate your own objects using QQmlComponent and place them in a manually setup QQuickCanvas.
+ you can instantiate your own objects using QQmlComponent and place them in a manually setup QQuickWindow.
Typical usage:
@@ -171,7 +171,7 @@ void QQuickViewPrivate::itemGeometryChanged(QQuickItem *resizeItem, const QRectF
*/
QQuickView::QQuickView(QWindow *parent)
-: QQuickCanvas(*(new QQuickViewPrivate), parent)
+: QQuickWindow(*(new QQuickViewPrivate), parent)
{
d_func()->init();
}
@@ -182,7 +182,7 @@ QQuickView::QQuickView(QWindow *parent)
*/
QQuickView::QQuickView(const QUrl &source, QWindow *parent)
-: QQuickCanvas(*(new QQuickViewPrivate), parent)
+: QQuickWindow(*(new QQuickViewPrivate), parent)
{
d_func()->init();
setSource(source);
@@ -198,7 +198,7 @@ QQuickView::QQuickView(const QUrl &source, QWindow *parent)
\sa Status, status(), errors()
*/
QQuickView::QQuickView(QQmlEngine* engine, QWindow *parent)
- : QQuickCanvas(*(new QQuickViewPrivate), parent)
+ : QQuickWindow(*(new QQuickViewPrivate), parent)
{
Q_ASSERT(engine);
d_func()->init(engine);
@@ -336,7 +336,7 @@ QList<QQmlError> QQuickView::errors() const
/*!
\property QQuickView::resizeMode
- \brief whether the view should resize the canvas contents
+ \brief whether the view should resize the window contents
If this property is set to SizeViewToRootObject (the default), the view
resizes to the size of the root item in the QML.
@@ -469,7 +469,7 @@ void QQuickViewPrivate::setRootObject(QObject *obj)
return;
if (QQuickItem *sgItem = qobject_cast<QQuickItem *>(obj)) {
root = sgItem;
- sgItem->setParentItem(q->QQuickCanvas::rootItem());
+ sgItem->setParentItem(q->QQuickWindow::rootItem());
} else {
qWarning() << "QQuickView only supports loading of root objects that derive from QQuickItem." << endl
<< endl
@@ -553,7 +553,7 @@ void QQuickView::resizeEvent(QResizeEvent *e)
if (d->resizeMode == SizeRootObjectToView)
d->updateSize();
- QQuickCanvas::resizeEvent(e);
+ QQuickWindow::resizeEvent(e);
}
/*! \reimp */
@@ -561,7 +561,7 @@ void QQuickView::keyPressEvent(QKeyEvent *e)
{
QQmlProfilerService::addEvent(QQmlProfilerService::Key);
- QQuickCanvas::keyPressEvent(e);
+ QQuickWindow::keyPressEvent(e);
}
/*! \reimp */
@@ -569,7 +569,7 @@ void QQuickView::keyReleaseEvent(QKeyEvent *e)
{
QQmlProfilerService::addEvent(QQmlProfilerService::Key);
- QQuickCanvas::keyReleaseEvent(e);
+ QQuickWindow::keyReleaseEvent(e);
}
/*! \reimp */
@@ -577,7 +577,7 @@ void QQuickView::mouseMoveEvent(QMouseEvent *e)
{
QQmlProfilerService::addEvent(QQmlProfilerService::Mouse);
- QQuickCanvas::mouseMoveEvent(e);
+ QQuickWindow::mouseMoveEvent(e);
}
/*! \reimp */
@@ -585,7 +585,7 @@ void QQuickView::mousePressEvent(QMouseEvent *e)
{
QQmlProfilerService::addEvent(QQmlProfilerService::Mouse);
- QQuickCanvas::mousePressEvent(e);
+ QQuickWindow::mousePressEvent(e);
}
/*! \reimp */
@@ -593,7 +593,7 @@ void QQuickView::mouseReleaseEvent(QMouseEvent *e)
{
QQmlProfilerService::addEvent(QQmlProfilerService::Mouse);
- QQuickCanvas::mouseReleaseEvent(e);
+ QQuickWindow::mouseReleaseEvent(e);
}
diff --git a/src/quick/items/qquickview.h b/src/quick/items/qquickview.h
index 89647ba907..97d325e8e3 100644
--- a/src/quick/items/qquickview.h
+++ b/src/quick/items/qquickview.h
@@ -42,7 +42,7 @@
#ifndef QQUICKVIEW_H
#define QQUICKVIEW_H
-#include <QtQuick/qquickcanvas.h>
+#include <QtQuick/qquickwindow.h>
#include <QtCore/qurl.h>
#include <QtQml/qqmldebug.h>
@@ -56,7 +56,7 @@ class QQmlError;
class QQuickItem;
class QQuickViewPrivate;
-class Q_QUICK_EXPORT QQuickView : public QQuickCanvas
+class Q_QUICK_EXPORT QQuickView : public QQuickWindow
{
Q_OBJECT
Q_PROPERTY(ResizeMode resizeMode READ resizeMode WRITE setResizeMode)
diff --git a/src/quick/items/qquickview_p.h b/src/quick/items/qquickview_p.h
index fcabddda1f..0442f78432 100644
--- a/src/quick/items/qquickview_p.h
+++ b/src/quick/items/qquickview_p.h
@@ -51,7 +51,7 @@
#include <QtCore/QWeakPointer>
#include <QtQml/qqmlengine.h>
-#include "qquickcanvas_p.h"
+#include "qquickwindow_p.h"
#include "qquickitemchangelistener_p.h"
@@ -64,7 +64,7 @@ class QQmlError;
class QQuickItem;
class QQmlComponent;
-class QQuickViewPrivate : public QQuickCanvasPrivate,
+class QQuickViewPrivate : public QQuickWindowPrivate,
public QQuickItemChangeListener
{
Q_DECLARE_PUBLIC(QQuickView)
diff --git a/src/quick/items/qquickcanvas.cpp b/src/quick/items/qquickwindow.cpp
index de53e80186..1d3adea5cb 100644
--- a/src/quick/items/qquickcanvas.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#include "qquickcanvas.h"
-#include "qquickcanvas_p.h"
+#include "qquickwindow.h"
+#include "qquickwindow_p.h"
#include "qquickitem.h"
#include "qquickitem_p.h"
@@ -72,26 +72,26 @@
QT_BEGIN_NAMESPACE
-void QQuickCanvasPrivate::updateFocusItemTransform()
+void QQuickWindowPrivate::updateFocusItemTransform()
{
- Q_Q(QQuickCanvas);
+ Q_Q(QQuickWindow);
QQuickItem *focus = q->activeFocusItem();
if (focus && qApp->focusObject() == focus)
- qApp->inputMethod()->setInputItemTransform(QQuickItemPrivate::get(focus)->itemToCanvasTransform());
+ qApp->inputMethod()->setInputItemTransform(QQuickItemPrivate::get(focus)->itemToWindowTransform());
}
-class QQuickCanvasIncubationController : public QObject, public QQmlIncubationController
+class QQuickWindowIncubationController : public QObject, public QQmlIncubationController
{
public:
- QQuickCanvasIncubationController(QQuickCanvasPrivate *canvas)
- : m_canvas(canvas), m_eventSent(false) {}
+ QQuickWindowIncubationController(QQuickWindowPrivate *window)
+ : m_window(window), m_eventSent(false) {}
protected:
virtual bool event(QEvent *e)
{
if (e->type() == QEvent::User) {
Q_ASSERT(m_eventSent);
- volatile bool *amtp = m_canvas->windowManager->allowMainThreadProcessing();
+ volatile bool *amtp = m_window->windowManager->allowMainThreadProcessing();
while (incubatingObjectCount()) {
if (amtp)
incubateWhile(amtp, 2);
@@ -112,18 +112,18 @@ protected:
QCoreApplication::postEvent(this, new QEvent(QEvent::User));
}
// If no animations are running, the renderer may be waiting
- m_canvas->windowManager->wakeup();
+ m_window->windowManager->wakeup();
}
private:
- QQuickCanvasPrivate *m_canvas;
+ QQuickWindowPrivate *m_window;
bool m_eventSent;
};
#ifndef QT_NO_ACCESSIBILITY
-QAccessibleInterface *QQuickCanvas::accessibleRoot() const
+QAccessibleInterface *QQuickWindow::accessibleRoot() const
{
- return QAccessible::queryAccessibleInterface(const_cast<QQuickCanvas*>(this));
+ return QAccessible::queryAccessibleInterface(const_cast<QQuickWindow*>(this));
}
#endif
@@ -132,16 +132,16 @@ QAccessibleInterface *QQuickCanvas::accessibleRoot() const
Focus behavior
==============
-Prior to being added to a valid canvas items can set and clear focus with no
-effect. Only once items are added to a canvas (by way of having a parent set that
-already belongs to a canvas) do the focus rules apply. Focus goes back to
-having no effect if an item is removed from a canvas.
+Prior to being added to a valid window items can set and clear focus with no
+effect. Only once items are added to a window (by way of having a parent set that
+already belongs to a window) do the focus rules apply. Focus goes back to
+having no effect if an item is removed from a window.
-When an item is moved into a new focus scope (either being added to a canvas
+When an item is moved into a new focus scope (either being added to a window
for the first time, or having its parent changed), if the focus scope already has
a scope focused item that takes precedence over the item being added. Otherwise,
the focus of the added tree is used. In the case of of a tree of items being
-added to a canvas for the first time, which may have a conflicted focus state (two
+added to a window for the first time, which may have a conflicted focus state (two
or more items in one scope having focus set), the same rule is applied item by item -
thus the first item that has focus will get it (assuming the scope doesn't already
have a scope focused item), and the other items will have their focus cleared.
@@ -167,48 +167,48 @@ QQuickRootItem::QQuickRootItem()
}
/*! \reimp */
-void QQuickCanvas::exposeEvent(QExposeEvent *)
+void QQuickWindow::exposeEvent(QExposeEvent *)
{
- Q_D(QQuickCanvas);
+ Q_D(QQuickWindow);
d->windowManager->exposureChanged(this);
}
/*! \reimp */
-void QQuickCanvas::resizeEvent(QResizeEvent *)
+void QQuickWindow::resizeEvent(QResizeEvent *)
{
- Q_D(QQuickCanvas);
+ Q_D(QQuickWindow);
d->windowManager->resize(this, size());
}
/*! \reimp */
-void QQuickCanvas::showEvent(QShowEvent *)
+void QQuickWindow::showEvent(QShowEvent *)
{
d_func()->windowManager->show(this);
}
/*! \reimp */
-void QQuickCanvas::hideEvent(QHideEvent *)
+void QQuickWindow::hideEvent(QHideEvent *)
{
d_func()->windowManager->hide(this);
}
/*! \reimp */
-void QQuickCanvas::focusOutEvent(QFocusEvent *)
+void QQuickWindow::focusOutEvent(QFocusEvent *)
{
- Q_D(QQuickCanvas);
+ Q_D(QQuickWindow);
d->rootItem->setFocus(false);
}
/*! \reimp */
-void QQuickCanvas::focusInEvent(QFocusEvent *)
+void QQuickWindow::focusInEvent(QFocusEvent *)
{
- Q_D(QQuickCanvas);
+ Q_D(QQuickWindow);
d->rootItem->setFocus(true);
d->updateFocusItemTransform();
}
-void QQuickCanvasPrivate::polishItems()
+void QQuickWindowPrivate::polishItems()
{
int maxPolishCycles = 100000;
@@ -224,13 +224,13 @@ void QQuickCanvasPrivate::polishItems()
}
if (maxPolishCycles == 0)
- qWarning("QQuickCanvas: possible QQuickItem::polish() loop");
+ qWarning("QQuickWindow: possible QQuickItem::polish() loop");
updateFocusItemTransform();
}
/**
- * This parameter enables that this canvas can be rendered without
+ * This parameter enables that this window can be rendered without
* being shown on screen. This feature is very limited in what it supports.
*
* There needs to be another window actually showing that we can make current
@@ -238,12 +238,12 @@ void QQuickCanvasPrivate::polishItems()
* one needs to hook into beforeRender() and set the render tareget.
*
*/
-void QQuickCanvasPrivate::setRenderWithoutShowing(bool render)
+void QQuickWindowPrivate::setRenderWithoutShowing(bool render)
{
if (render == renderWithoutShowing)
return;
- Q_Q(QQuickCanvas);
+ Q_Q(QQuickWindow);
renderWithoutShowing = render;
if (render)
@@ -254,15 +254,15 @@ void QQuickCanvasPrivate::setRenderWithoutShowing(bool render)
/*!
- * Schedules the canvas to render another frame.
+ * Schedules the window to render another frame.
*
- * Calling QQuickCanvas::update() differs from QQuickItem::update() in that
+ * Calling QQuickWindow::update() differs from QQuickItem::update() in that
* it always triggers a repaint, regardless of changes in the underlying
* scene graph or not.
*/
-void QQuickCanvas::update()
+void QQuickWindow::update()
{
- Q_D(QQuickCanvas);
+ Q_D(QQuickWindow);
d->windowManager->update(this);
}
@@ -277,10 +277,10 @@ void forceUpdate(QQuickItem *item)
forceUpdate(items.at(i));
}
-void QQuickCanvasPrivate::syncSceneGraph()
+void QQuickWindowPrivate::syncSceneGraph()
{
QML_MEMORY_SCOPE_STRING("SceneGraph");
- Q_Q(QQuickCanvas);
+ Q_Q(QQuickWindow);
emit q->beforeSynchronizing();
if (!renderer) {
@@ -294,7 +294,7 @@ void QQuickCanvasPrivate::syncSceneGraph()
updateDirtyNodes();
- // Copy the current state of clearing from canvas into renderer.
+ // Copy the current state of clearing from window into renderer.
renderer->setClearColor(clearColor);
QSGRenderer::ClearMode mode = QSGRenderer::ClearStencilBuffer | QSGRenderer::ClearDepthBuffer;
if (clearBeforeRendering)
@@ -303,10 +303,10 @@ void QQuickCanvasPrivate::syncSceneGraph()
}
-void QQuickCanvasPrivate::renderSceneGraph(const QSize &size)
+void QQuickWindowPrivate::renderSceneGraph(const QSize &size)
{
QML_MEMORY_SCOPE_STRING("SceneGraph");
- Q_Q(QQuickCanvas);
+ Q_Q(QQuickWindow);
emit q->beforeRendering();
int fboId = 0;
renderer->setDeviceRect(QRect(QPoint(0, 0), size));
@@ -322,7 +322,7 @@ void QQuickCanvasPrivate::renderSceneGraph(const QSize &size)
emit q->afterRendering();
}
-QQuickCanvasPrivate::QQuickCanvasPrivate()
+QQuickWindowPrivate::QQuickWindowPrivate()
: rootItem(0)
, activeFocusItem(0)
, mouseGrabberItem(0)
@@ -344,27 +344,27 @@ QQuickCanvasPrivate::QQuickCanvasPrivate()
{
}
-QQuickCanvasPrivate::~QQuickCanvasPrivate()
+QQuickWindowPrivate::~QQuickWindowPrivate()
{
}
-void QQuickCanvasPrivate::init(QQuickCanvas *c)
+void QQuickWindowPrivate::init(QQuickWindow *c)
{
q_ptr = c;
- Q_Q(QQuickCanvas);
+ Q_Q(QQuickWindow);
rootItem = new QQuickRootItem;
QQmlEngine::setObjectOwnership(rootItem, QQmlEngine::CppOwnership);
QQuickItemPrivate *rootItemPrivate = QQuickItemPrivate::get(rootItem);
- rootItemPrivate->canvas = q;
- rootItemPrivate->canvasRefCount = 1;
+ rootItemPrivate->window = q;
+ rootItemPrivate->windowRefCount = 1;
rootItemPrivate->flags |= QQuickItem::ItemIsFocusScope;
// In the absence of a focus in event on some platforms assume the window will
// be activated immediately and set focus on the rootItem
// ### Remove when QTBUG-22415 is resolved.
- //It is important that this call happens after the rootItem has a canvas..
+ //It is important that this call happens after the rootItem has a window..
rootItem->setFocus(true);
windowManager = QQuickWindowManager::instance();
@@ -377,15 +377,15 @@ void QQuickCanvasPrivate::init(QQuickCanvas *c)
QObject::connect(context, SIGNAL(invalidated()), q, SLOT(cleanupSceneGraph()), Qt::DirectConnection);
}
-QQmlListProperty<QObject> QQuickCanvasPrivate::data()
+QQmlListProperty<QObject> QQuickWindowPrivate::data()
{
initRootItem();
return QQuickItemPrivate::get(rootItem)->data();
}
-void QQuickCanvasPrivate::initRootItem()
+void QQuickWindowPrivate::initRootItem()
{
- Q_Q(QQuickCanvas);
+ Q_Q(QQuickWindow);
q->connect(q, SIGNAL(widthChanged(int)),
rootItem, SLOT(setWidth(int)));
q->connect(q, SIGNAL(heightChanged(int)),
@@ -404,16 +404,16 @@ static QMouseEvent *touchToMouseEvent(QEvent::Type type, const QTouchEvent::Touc
QVector2D transformedVelocity = p.velocity();
if (transformNeeded) {
QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
- QMatrix4x4 transformMatrix(itemPrivate->canvasToItemTransform());
+ QMatrix4x4 transformMatrix(itemPrivate->windowToItemTransform());
transformedVelocity = transformMatrix.mapVector(p.velocity()).toVector2D();
}
QGuiApplicationPrivate::setMouseEventCapsAndVelocity(me, event->device()->capabilities(), transformedVelocity);
return me;
}
-bool QQuickCanvasPrivate::translateTouchToMouse(QQuickItem *item, QTouchEvent *event)
+bool QQuickWindowPrivate::translateTouchToMouse(QQuickItem *item, QTouchEvent *event)
{
- Q_Q(QQuickCanvas);
+ Q_Q(QQuickWindow);
// For each point, check if it is accepted, if not, try the next point.
// Any of the fingers can become the mouse one.
// This can happen because a mouse area might not accept an event at some point but another.
@@ -519,7 +519,7 @@ bool QQuickCanvasPrivate::translateTouchToMouse(QQuickItem *item, QTouchEvent *e
return false;
}
-void QQuickCanvasPrivate::transformTouchPoints(QList<QTouchEvent::TouchPoint> &touchPoints, const QTransform &transform)
+void QQuickWindowPrivate::transformTouchPoints(QList<QTouchEvent::TouchPoint> &touchPoints, const QTransform &transform)
{
QMatrix4x4 transformMatrix(transform);
for (int i=0; i<touchPoints.count(); i++) {
@@ -533,10 +533,10 @@ void QQuickCanvasPrivate::transformTouchPoints(QList<QTouchEvent::TouchPoint> &t
/*!
-Translates the data in \a touchEvent to this canvas. This method leaves the item local positions in
+Translates the data in \a touchEvent to this window. This method leaves the item local positions in
\a touchEvent untouched (these are filled in later).
*/
-void QQuickCanvasPrivate::translateTouchEvent(QTouchEvent *touchEvent)
+void QQuickWindowPrivate::translateTouchEvent(QTouchEvent *touchEvent)
{
QList<QTouchEvent::TouchPoint> touchPoints = touchEvent->touchPoints();
for (int i = 0; i < touchPoints.count(); ++i) {
@@ -556,15 +556,15 @@ void QQuickCanvasPrivate::translateTouchEvent(QTouchEvent *touchEvent)
touchEvent->setTouchPoints(touchPoints);
}
-void QQuickCanvasPrivate::setFocusInScope(QQuickItem *scope, QQuickItem *item, FocusOptions options)
+void QQuickWindowPrivate::setFocusInScope(QQuickItem *scope, QQuickItem *item, FocusOptions options)
{
- Q_Q(QQuickCanvas);
+ Q_Q(QQuickWindow);
Q_ASSERT(item);
Q_ASSERT(scope || item == rootItem);
#ifdef FOCUS_DEBUG
- qWarning() << "QQuickCanvasPrivate::setFocusInScope():";
+ qWarning() << "QQuickWindowPrivate::setFocusInScope():";
qWarning() << " scope:" << (QObject *)scope;
if (scope)
qWarning() << " scopeSubFocusItem:" << (QObject *)QQuickItemPrivate::get(scope)->subFocusItem;
@@ -652,15 +652,15 @@ void QQuickCanvasPrivate::setFocusInScope(QQuickItem *scope, QQuickItem *item, F
notifyFocusChangesRecur(changed.data(), changed.count() - 1);
}
-void QQuickCanvasPrivate::clearFocusInScope(QQuickItem *scope, QQuickItem *item, FocusOptions options)
+void QQuickWindowPrivate::clearFocusInScope(QQuickItem *scope, QQuickItem *item, FocusOptions options)
{
- Q_Q(QQuickCanvas);
+ Q_Q(QQuickWindow);
Q_ASSERT(item);
Q_ASSERT(scope || item == rootItem);
#ifdef FOCUS_DEBUG
- qWarning() << "QQuickCanvasPrivate::clearFocusInScope():";
+ qWarning() << "QQuickWindowPrivate::clearFocusInScope():";
qWarning() << " scope:" << (QObject *)scope;
qWarning() << " item:" << (QObject *)item;
qWarning() << " activeFocusItem:" << (QObject *)activeFocusItem;
@@ -733,7 +733,7 @@ void QQuickCanvasPrivate::clearFocusInScope(QQuickItem *scope, QQuickItem *item,
notifyFocusChangesRecur(changed.data(), changed.count() - 1);
}
-void QQuickCanvasPrivate::notifyFocusChangesRecur(QQuickItem **items, int remaining)
+void QQuickWindowPrivate::notifyFocusChangesRecur(QQuickItem **items, int remaining)
{
QQmlGuard<QQuickItem> item(*items);
@@ -756,15 +756,15 @@ void QQuickCanvasPrivate::notifyFocusChangesRecur(QQuickItem **items, int remain
}
}
-void QQuickCanvasPrivate::dirtyItem(QQuickItem *)
+void QQuickWindowPrivate::dirtyItem(QQuickItem *)
{
- Q_Q(QQuickCanvas);
+ Q_Q(QQuickWindow);
q->maybeUpdate();
}
-void QQuickCanvasPrivate::cleanup(QSGNode *n)
+void QQuickWindowPrivate::cleanup(QSGNode *n)
{
- Q_Q(QQuickCanvas);
+ Q_Q(QQuickWindow);
Q_ASSERT(!cleanupNodeList.contains(n));
cleanupNodeList.append(n);
@@ -787,7 +787,7 @@ void QQuickCanvasPrivate::cleanup(QSGNode *n)
*/
/*!
- \qmlclass Window QQuickCanvas
+ \qmlclass Window QQuickWindow
\inqmlmodule QtQuick.Window 2
\ingroup qtquick-visual
\brief Creates a new top-level window
@@ -803,24 +803,24 @@ void QQuickCanvasPrivate::cleanup(QSGNode *n)
Restricting this import will allow you to have a QML environment without access to window system features.
*/
/*!
- \class QQuickCanvas
+ \class QQuickWindow
\since QtQuick 2.0
\inmodule QtQuick
- \brief The QQuickCanvas class provides the canvas for displaying a graphical QML scene
+ \brief The QQuickWindow class provides the window for displaying a graphical QML scene
- QQuickCanvas provides the graphical scene management needed to interact with and display
+ QQuickWindow provides the graphical scene management needed to interact with and display
a scene of QQuickItems.
- A QQuickCanvas always has a single invisible root item. To add items to this canvas,
+ A QQuickWindow always has a single invisible root item. To add items to this window,
reparent the items to the root item or to an existing item in the scene.
For easily displaying a scene from a QML file, see \l{QQuickView}.
\section1 Scene Graph and Rendering
- The QQuickCanvas uses a scene graph on top of OpenGL to render. This scene graph is disconnected
+ The QQuickWindow uses a scene graph on top of OpenGL to render. This scene graph is disconnected
from the QML scene and potentially lives in another thread, depending on the platform
implementation. Since the rendering scene graph lives independently from the QML scene, it can
also be completely released without affecting the state of the QML scene.
@@ -834,7 +834,7 @@ void QQuickCanvasPrivate::cleanup(QSGNode *n)
\list 1
- \li The QQuickCanvas::beforeSynchronizing() signal is emitted.
+ \li The QQuickWindow::beforeSynchronizing() signal is emitted.
Applications can make direct connections (Qt::DirectConnection)
to this signal to do any preparation required before calls to
QQuickItem::updatePaintNode().
@@ -846,10 +846,10 @@ void QQuickCanvasPrivate::cleanup(QSGNode *n)
synchroniation. This is the only time the QML items and the nodes
in the scene graph interact.
- \li The canvas to be rendered is made current using
+ \li The window to be rendered is made current using
QOpenGLContext::makeCurrent().
- \li The QQuickCanvas::beforeRendering() signal is
+ \li The QQuickWindow::beforeRendering() signal is
emitted. Applications can make direct connections
(Qt::DirectConnection) to this signal to use custom OpenGL calls
which will then stack visually beneath the QML scene.
@@ -857,18 +857,18 @@ void QQuickCanvasPrivate::cleanup(QSGNode *n)
\li Items that have specified QSGNode::UsesPreprocess, will have their
QSGNode::preprocess() function invoked.
- \li The QQuickCanvas is cleared according to what is specified
- using QQuickCanvas::setClearBeforeRendering() and
- QQuickCanvas::setClearColor().
+ \li The QQuickWindow is cleared according to what is specified
+ using QQuickWindow::setClearBeforeRendering() and
+ QQuickWindow::setClearColor().
\li The scene graph is rendered.
- \li The QQuickCanvas::afterRendering() signal is
+ \li The QQuickWindow::afterRendering() signal is
emitted. Applications can make direct connections
(Qt::DirectConnection) to this signal to use custom OpenGL calls
which will then stack visually over the QML scene.
- \li The rendered frame is swapped and QQuickCanvas::frameSwapped()
+ \li The rendered frame is swapped and QQuickWindow::frameSwapped()
is emitted.
\endlist
@@ -879,7 +879,7 @@ void QQuickCanvasPrivate::cleanup(QSGNode *n)
for the next frame. This means that as long as users are not using scene graph API
directly, the added complexity of a rendering thread can be completely ignored.
- When a QQuickCanvas is programatically hidden with hide() or setVisible(false), it will
+ When a QQuickWindow is programatically hidden with hide() or setVisible(false), it will
stop rendering and its scene graph and OpenGL context might be released. The
sceneGraphInvalidated() signal will be emitted when this happens.
@@ -899,25 +899,25 @@ void QQuickCanvasPrivate::cleanup(QSGNode *n)
sceneGraphInvalidated() signal will be emitted when this happens.
*/
-QQuickCanvas::QQuickCanvas(QWindow *parent)
- : QWindow(*(new QQuickCanvasPrivate), parent)
+QQuickWindow::QQuickWindow(QWindow *parent)
+ : QWindow(*(new QQuickWindowPrivate), parent)
{
- Q_D(QQuickCanvas);
+ Q_D(QQuickWindow);
d->init(this);
}
-QQuickCanvas::QQuickCanvas(QQuickCanvasPrivate &dd, QWindow *parent)
+QQuickWindow::QQuickWindow(QQuickWindowPrivate &dd, QWindow *parent)
: QWindow(dd, parent)
{
- Q_D(QQuickCanvas);
+ Q_D(QQuickWindow);
d->init(this);
}
-QQuickCanvas::~QQuickCanvas()
+QQuickWindow::~QQuickWindow()
{
- Q_D(QQuickCanvas);
+ Q_D(QQuickWindow);
- d->windowManager->canvasDestroyed(this);
+ d->windowManager->windowDestroyed(this);
QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
delete d->incubationController; d->incubationController = 0;
@@ -940,9 +940,9 @@ QQuickCanvas::~QQuickCanvas()
\sa sceneGraphInvalidated(), setPersistentOpenGLContext(), setPersistentSceneGraph().
*/
-void QQuickCanvas::releaseResources()
+void QQuickWindow::releaseResources()
{
- Q_D(QQuickCanvas);
+ Q_D(QQuickWindow);
d->windowManager->releaseResources();
QQuickPixmap::purgeCache();
}
@@ -959,9 +959,9 @@ void QQuickCanvas::releaseResources()
\sa setPersistentSceneGraph()
*/
-void QQuickCanvas::setPersistentOpenGLContext(bool persistent)
+void QQuickWindow::setPersistentOpenGLContext(bool persistent)
{
- Q_D(QQuickCanvas);
+ Q_D(QQuickWindow);
d->persistentGLContext = persistent;
}
@@ -971,9 +971,9 @@ void QQuickCanvas::setPersistentOpenGLContext(bool persistent)
releaseResources().
*/
-bool QQuickCanvas::isPersistentOpenGLContext() const
+bool QQuickWindow::isPersistentOpenGLContext() const
{
- Q_D(const QQuickCanvas);
+ Q_D(const QQuickWindow);
return d->persistentGLContext;
}
@@ -989,9 +989,9 @@ bool QQuickCanvas::isPersistentOpenGLContext() const
\sa setPersistentOpenGLContext()
*/
-void QQuickCanvas::setPersistentSceneGraph(bool persistent)
+void QQuickWindow::setPersistentSceneGraph(bool persistent)
{
- Q_D(QQuickCanvas);
+ Q_D(QQuickWindow);
d->persistentSceneGraph = persistent;
}
@@ -1002,9 +1002,9 @@ void QQuickCanvas::setPersistentSceneGraph(bool persistent)
of a call to releaseResources().
*/
-bool QQuickCanvas::isPersistentSceneGraph() const
+bool QQuickWindow::isPersistentSceneGraph() const
{
- Q_D(const QQuickCanvas);
+ Q_D(const QQuickWindow);
return d->persistentSceneGraph;
}
@@ -1015,12 +1015,13 @@ bool QQuickCanvas::isPersistentSceneGraph() const
/*!
Returns the invisible root item of the scene.
- A QQuickCanvas always has a single invisible root item. To add items to this canvas,
- reparent the items to the root item or to an existing item in the scene.
+ A QQuickWindow always has a single invisible root item containing all of its content.
+ To add items to this window, reparent the items to the contentItem or to an existing
+ item in the scene.
*/
-QQuickItem *QQuickCanvas::rootItem() const
+QQuickItem *QQuickWindow::contentItem() const
{
- Q_D(const QQuickCanvas);
+ Q_D(const QQuickWindow);
return d->rootItem;
}
@@ -1028,29 +1029,33 @@ QQuickItem *QQuickCanvas::rootItem() const
/*!
Returns the item which currently has active focus.
*/
-QQuickItem *QQuickCanvas::activeFocusItem() const
+QQuickItem *QQuickWindow::activeFocusItem() const
{
- Q_D(const QQuickCanvas);
+ Q_D(const QQuickWindow);
return d->activeFocusItem;
}
-QObject *QQuickCanvas::focusObject() const
+/*!
+ \internal
+ \reimp
+*/
+QObject *QQuickWindow::focusObject() const
{
- Q_D(const QQuickCanvas);
+ Q_D(const QQuickWindow);
if (d->activeFocusItem)
return d->activeFocusItem;
- return const_cast<QQuickCanvas*>(this);
+ return const_cast<QQuickWindow*>(this);
}
/*!
Returns the item which currently has the mouse grab.
*/
-QQuickItem *QQuickCanvas::mouseGrabberItem() const
+QQuickItem *QQuickWindow::mouseGrabberItem() const
{
- Q_D(const QQuickCanvas);
+ Q_D(const QQuickWindow);
return d->mouseGrabberItem;
}
@@ -1064,9 +1069,9 @@ QQuickItem *QQuickCanvas::mouseGrabberItem() const
Setting this property is more efficient than using a separate Rectangle.
*/
-bool QQuickCanvasPrivate::clearHover()
+bool QQuickWindowPrivate::clearHover()
{
- Q_Q(QQuickCanvas);
+ Q_Q(QQuickWindow);
if (hoverItems.isEmpty())
return false;
@@ -1080,9 +1085,9 @@ bool QQuickCanvasPrivate::clearHover()
}
/*! \reimp */
-bool QQuickCanvas::event(QEvent *e)
+bool QQuickWindow::event(QEvent *e)
{
- Q_D(QQuickCanvas);
+ Q_D(QQuickWindow);
switch (e->type()) {
@@ -1126,24 +1131,24 @@ bool QQuickCanvas::event(QEvent *e)
}
/*! \reimp */
-void QQuickCanvas::keyPressEvent(QKeyEvent *e)
+void QQuickWindow::keyPressEvent(QKeyEvent *e)
{
- Q_D(QQuickCanvas);
+ Q_D(QQuickWindow);
if (d->activeFocusItem)
sendEvent(d->activeFocusItem, e);
}
/*! \reimp */
-void QQuickCanvas::keyReleaseEvent(QKeyEvent *e)
+void QQuickWindow::keyReleaseEvent(QKeyEvent *e)
{
- Q_D(QQuickCanvas);
+ Q_D(QQuickWindow);
if (d->activeFocusItem)
sendEvent(d->activeFocusItem, e);
}
-QMouseEvent *QQuickCanvasPrivate::cloneMouseEvent(QMouseEvent *event, QPointF *transformedLocalPos)
+QMouseEvent *QQuickWindowPrivate::cloneMouseEvent(QMouseEvent *event, QPointF *transformedLocalPos)
{
int caps = QGuiApplicationPrivate::mouseEventCaps(event);
QVector2D velocity = QGuiApplicationPrivate::mouseEventVelocity(event);
@@ -1156,9 +1161,9 @@ QMouseEvent *QQuickCanvasPrivate::cloneMouseEvent(QMouseEvent *event, QPointF *t
return me;
}
-bool QQuickCanvasPrivate::deliverInitialMousePressEvent(QQuickItem *item, QMouseEvent *event)
+bool QQuickWindowPrivate::deliverInitialMousePressEvent(QQuickItem *item, QMouseEvent *event)
{
- Q_Q(QQuickCanvas);
+ Q_Q(QQuickWindow);
QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
@@ -1195,9 +1200,9 @@ bool QQuickCanvasPrivate::deliverInitialMousePressEvent(QQuickItem *item, QMouse
return false;
}
-bool QQuickCanvasPrivate::deliverMouseEvent(QMouseEvent *event)
+bool QQuickWindowPrivate::deliverMouseEvent(QMouseEvent *event)
{
- Q_Q(QQuickCanvas);
+ Q_Q(QQuickWindow);
lastMousePosition = event->windowPos();
@@ -1225,22 +1230,22 @@ bool QQuickCanvasPrivate::deliverMouseEvent(QMouseEvent *event)
}
/*! \reimp */
-void QQuickCanvas::mousePressEvent(QMouseEvent *event)
+void QQuickWindow::mousePressEvent(QMouseEvent *event)
{
- Q_D(QQuickCanvas);
+ Q_D(QQuickWindow);
#ifdef MOUSE_DEBUG
- qWarning() << "QQuickCanvas::mousePressEvent()" << event->localPos() << event->button() << event->buttons();
+ qWarning() << "QQuickWindow::mousePressEvent()" << event->localPos() << event->button() << event->buttons();
#endif
d->deliverMouseEvent(event);
}
/*! \reimp */
-void QQuickCanvas::mouseReleaseEvent(QMouseEvent *event)
+void QQuickWindow::mouseReleaseEvent(QMouseEvent *event)
{
- Q_D(QQuickCanvas);
+ Q_D(QQuickWindow);
#ifdef MOUSE_DEBUG
- qWarning() << "QQuickCanvas::mouseReleaseEvent()" << event->localPos() << event->button() << event->buttons();
+ qWarning() << "QQuickWindow::mouseReleaseEvent()" << event->localPos() << event->button() << event->buttons();
#endif
if (!d->mouseGrabberItem) {
@@ -1254,11 +1259,11 @@ void QQuickCanvas::mouseReleaseEvent(QMouseEvent *event)
}
/*! \reimp */
-void QQuickCanvas::mouseDoubleClickEvent(QMouseEvent *event)
+void QQuickWindow::mouseDoubleClickEvent(QMouseEvent *event)
{
- Q_D(QQuickCanvas);
+ Q_D(QQuickWindow);
#ifdef MOUSE_DEBUG
- qWarning() << "QQuickCanvas::mouseDoubleClickEvent()" << event->localPos() << event->button() << event->buttons();
+ qWarning() << "QQuickWindow::mouseDoubleClickEvent()" << event->localPos() << event->button() << event->buttons();
#endif
if (!d->mouseGrabberItem && (event->buttons() & event->button()) == event->buttons()) {
@@ -1272,12 +1277,12 @@ void QQuickCanvas::mouseDoubleClickEvent(QMouseEvent *event)
d->deliverMouseEvent(event);
}
-bool QQuickCanvasPrivate::sendHoverEvent(QEvent::Type type, QQuickItem *item,
+bool QQuickWindowPrivate::sendHoverEvent(QEvent::Type type, QQuickItem *item,
const QPointF &scenePos, const QPointF &lastScenePos,
Qt::KeyboardModifiers modifiers, bool accepted)
{
- Q_Q(QQuickCanvas);
- const QTransform transform = QQuickItemPrivate::get(item)->canvasToItemTransform();
+ Q_Q(QQuickWindow);
+ const QTransform transform = QQuickItemPrivate::get(item)->windowToItemTransform();
//create copy of event
QHoverEvent hoverEvent(type, transform.map(scenePos), transform.map(lastScenePos), modifiers);
@@ -1289,11 +1294,11 @@ bool QQuickCanvasPrivate::sendHoverEvent(QEvent::Type type, QQuickItem *item,
}
/*! \reimp */
-void QQuickCanvas::mouseMoveEvent(QMouseEvent *event)
+void QQuickWindow::mouseMoveEvent(QMouseEvent *event)
{
- Q_D(QQuickCanvas);
+ Q_D(QQuickWindow);
#ifdef MOUSE_DEBUG
- qWarning() << "QQuickCanvas::mouseMoveEvent()" << event->localPos() << event->button() << event->buttons();
+ qWarning() << "QQuickWindow::mouseMoveEvent()" << event->localPos() << event->button() << event->buttons();
#endif
if (!d->mouseGrabberItem) {
@@ -1315,7 +1320,7 @@ void QQuickCanvas::mouseMoveEvent(QMouseEvent *event)
d->deliverMouseEvent(event);
}
-bool QQuickCanvasPrivate::deliverHoverEvent(QQuickItem *item, const QPointF &scenePos, const QPointF &lastScenePos,
+bool QQuickWindowPrivate::deliverHoverEvent(QQuickItem *item, const QPointF &scenePos, const QPointF &lastScenePos,
Qt::KeyboardModifiers modifiers, bool &accepted)
{
QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
@@ -1381,9 +1386,9 @@ bool QQuickCanvasPrivate::deliverHoverEvent(QQuickItem *item, const QPointF &sce
return false;
}
-bool QQuickCanvasPrivate::deliverWheelEvent(QQuickItem *item, QWheelEvent *event)
+bool QQuickWindowPrivate::deliverWheelEvent(QQuickItem *item, QWheelEvent *event)
{
- Q_Q(QQuickCanvas);
+ Q_Q(QQuickWindow);
QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
if (itemPrivate->flags & QQuickItem::ItemClipsChildrenToShape) {
@@ -1419,11 +1424,11 @@ bool QQuickCanvasPrivate::deliverWheelEvent(QQuickItem *item, QWheelEvent *event
#ifndef QT_NO_WHEELEVENT
/*! \reimp */
-void QQuickCanvas::wheelEvent(QWheelEvent *event)
+void QQuickWindow::wheelEvent(QWheelEvent *event)
{
- Q_D(QQuickCanvas);
+ Q_D(QQuickWindow);
#ifdef MOUSE_DEBUG
- qWarning() << "QQuickCanvas::wheelEvent()" << event->pixelDelta() << event->angleDelta();
+ qWarning() << "QQuickWindow::wheelEvent()" << event->pixelDelta() << event->angleDelta();
#endif
//if the actual wheel event was accepted, accept the compatability wheel event and return early
@@ -1437,12 +1442,12 @@ void QQuickCanvas::wheelEvent(QWheelEvent *event)
#endif // QT_NO_WHEELEVENT
-bool QQuickCanvasPrivate::deliverTouchCancelEvent(QTouchEvent *event)
+bool QQuickWindowPrivate::deliverTouchCancelEvent(QTouchEvent *event)
{
#ifdef TOUCH_DEBUG
qWarning("touchCancelEvent");
#endif
- Q_Q(QQuickCanvas);
+ Q_Q(QQuickWindow);
// A TouchCancel event will typically not contain any points.
// Deliver it to all items that have active touches.
QSet<QQuickItem *> cancelDelivered;
@@ -1462,7 +1467,7 @@ bool QQuickCanvasPrivate::deliverTouchCancelEvent(QTouchEvent *event)
// check what kind of touch we have (begin/update) and
// call deliverTouchPoints to actually dispatch the points
-bool QQuickCanvasPrivate::deliverTouchEvent(QTouchEvent *event)
+bool QQuickWindowPrivate::deliverTouchEvent(QTouchEvent *event)
{
#ifdef TOUCH_DEBUG
if (event->type() == QEvent::TouchBegin)
@@ -1525,7 +1530,7 @@ bool QQuickCanvasPrivate::deliverTouchEvent(QTouchEvent *event)
}
// This function recurses and sends the events to the individual items
-bool QQuickCanvasPrivate::deliverTouchPoints(QQuickItem *item, QTouchEvent *event, const QList<QTouchEvent::TouchPoint> &newPoints, QSet<int> *acceptedNewPoints, QHash<QQuickItem *, QList<QTouchEvent::TouchPoint> > *updatedPoints)
+bool QQuickWindowPrivate::deliverTouchPoints(QQuickItem *item, QTouchEvent *event, const QList<QTouchEvent::TouchPoint> &newPoints, QSet<int> *acceptedNewPoints, QHash<QQuickItem *, QList<QTouchEvent::TouchPoint> > *updatedPoints)
{
QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
@@ -1573,7 +1578,7 @@ bool QQuickCanvasPrivate::deliverTouchPoints(QQuickItem *item, QTouchEvent *even
}
// If there are no matching new points, and the existing points are all stationary,
// there's no need to send an event to this item. This is required by a test in
- // tst_qquickcanvas::touchEvent_basic:
+ // tst_qquickwindow::touchEvent_basic:
// a single stationary press on an item shouldn't cause an event
if (matchingNewPoints.isEmpty()) {
bool stationaryOnly = true;
@@ -1588,7 +1593,7 @@ bool QQuickCanvasPrivate::deliverTouchPoints(QQuickItem *item, QTouchEvent *even
// Now we know this item might be interested in the event. Copy and send it, but
// with only the subset of TouchPoints which are relevant to that item: that's matchingPoints.
QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
- transformTouchPoints(matchingPoints, itemPrivate->canvasToItemTransform());
+ transformTouchPoints(matchingPoints, itemPrivate->windowToItemTransform());
deliverMatchingPointsToItem(item, event, acceptedNewPoints, matchingNewPoints, matchingPoints);
}
@@ -1603,7 +1608,7 @@ bool QQuickCanvasPrivate::deliverTouchPoints(QQuickItem *item, QTouchEvent *even
// only the points that are relevant for this item. Thus the need for
// matchingPoints to already be that set of interesting points.
// They are all pre-transformed, too.
-bool QQuickCanvasPrivate::deliverMatchingPointsToItem(QQuickItem *item, QTouchEvent *event, QSet<int> *acceptedNewPoints, const QSet<int> &matchingNewPoints, const QList<QTouchEvent::TouchPoint> &matchingPoints)
+bool QQuickWindowPrivate::deliverMatchingPointsToItem(QQuickItem *item, QTouchEvent *event, QSet<int> *acceptedNewPoints, const QSet<int> &matchingNewPoints, const QList<QTouchEvent::TouchPoint> &matchingPoints)
{
QScopedPointer<QTouchEvent> touchEvent(touchEventWithPoints(*event, matchingPoints));
touchEvent.data()->setTarget(item);
@@ -1650,7 +1655,7 @@ bool QQuickCanvasPrivate::deliverMatchingPointsToItem(QQuickItem *item, QTouchEv
return touchEventAccepted;
}
-QTouchEvent *QQuickCanvasPrivate::touchEventForItemBounds(QQuickItem *target, const QTouchEvent &originalEvent)
+QTouchEvent *QQuickWindowPrivate::touchEventForItemBounds(QQuickItem *target, const QTouchEvent &originalEvent)
{
const QList<QTouchEvent::TouchPoint> &touchPoints = originalEvent.touchPoints();
QList<QTouchEvent::TouchPoint> pointsInBounds;
@@ -1666,7 +1671,7 @@ QTouchEvent *QQuickCanvasPrivate::touchEventForItemBounds(QQuickItem *target, co
pointsInBounds.append(tp);
}
}
- transformTouchPoints(pointsInBounds, QQuickItemPrivate::get(target)->canvasToItemTransform());
+ transformTouchPoints(pointsInBounds, QQuickItemPrivate::get(target)->windowToItemTransform());
}
QTouchEvent* touchEvent = touchEventWithPoints(originalEvent, pointsInBounds);
@@ -1674,7 +1679,7 @@ QTouchEvent *QQuickCanvasPrivate::touchEventForItemBounds(QQuickItem *target, co
return touchEvent;
}
-QTouchEvent *QQuickCanvasPrivate::touchEventWithPoints(const QTouchEvent &event, const QList<QTouchEvent::TouchPoint> &newPoints)
+QTouchEvent *QQuickWindowPrivate::touchEventWithPoints(const QTouchEvent &event, const QList<QTouchEvent::TouchPoint> &newPoints)
{
Qt::TouchPointStates eventStates;
for (int i=0; i<newPoints.count(); i++)
@@ -1706,9 +1711,9 @@ QTouchEvent *QQuickCanvasPrivate::touchEventWithPoints(const QTouchEvent &event,
}
#ifndef QT_NO_DRAGANDDROP
-void QQuickCanvasPrivate::deliverDragEvent(QQuickDragGrabber *grabber, QEvent *event)
+void QQuickWindowPrivate::deliverDragEvent(QQuickDragGrabber *grabber, QEvent *event)
{
- Q_Q(QQuickCanvas);
+ Q_Q(QQuickWindow);
grabber->resetTarget();
QQuickDragGrabber::iterator grabItem = grabber->begin();
if (grabItem != grabber->end()) {
@@ -1777,9 +1782,9 @@ void QQuickCanvasPrivate::deliverDragEvent(QQuickDragGrabber *grabber, QEvent *e
}
}
-bool QQuickCanvasPrivate::deliverDragEvent(QQuickDragGrabber *grabber, QQuickItem *item, QDragMoveEvent *event)
+bool QQuickWindowPrivate::deliverDragEvent(QQuickDragGrabber *grabber, QQuickItem *item, QDragMoveEvent *event)
{
- Q_Q(QQuickCanvas);
+ Q_Q(QQuickWindow);
bool accepted = false;
QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
if (!item->isVisible() || !item->isEnabled())
@@ -1827,7 +1832,7 @@ bool QQuickCanvasPrivate::deliverDragEvent(QQuickDragGrabber *grabber, QQuickIte
}
#endif // QT_NO_DRAGANDDROP
-bool QQuickCanvasPrivate::sendFilteredTouchEvent(QQuickItem *target, QQuickItem *item, QTouchEvent *event)
+bool QQuickWindowPrivate::sendFilteredTouchEvent(QQuickItem *target, QQuickItem *item, QTouchEvent *event)
{
if (!target)
return false;
@@ -1880,7 +1885,7 @@ bool QQuickCanvasPrivate::sendFilteredTouchEvent(QQuickItem *target, QQuickItem
return sendFilteredTouchEvent(target->parentItem(), item, event);
}
-bool QQuickCanvasPrivate::sendFilteredMouseEvent(QQuickItem *target, QQuickItem *item, QEvent *event)
+bool QQuickWindowPrivate::sendFilteredMouseEvent(QQuickItem *target, QQuickItem *item, QEvent *event)
{
if (!target)
return false;
@@ -1896,7 +1901,7 @@ bool QQuickCanvasPrivate::sendFilteredMouseEvent(QQuickItem *target, QQuickItem
return false;
}
-bool QQuickCanvasPrivate::dragOverThreshold(qreal d, Qt::Axis axis, QMouseEvent *event)
+bool QQuickWindowPrivate::dragOverThreshold(qreal d, Qt::Axis axis, QMouseEvent *event)
{
QStyleHints *styleHints = qApp->styleHints();
int caps = QGuiApplicationPrivate::mouseEventCaps(event);
@@ -1912,14 +1917,14 @@ bool QQuickCanvasPrivate::dragOverThreshold(qreal d, Qt::Axis axis, QMouseEvent
}
/*!
- Propagates an event to a QQuickItem on the canvas
+ Propagates an event to a QQuickItem on the window
*/
-bool QQuickCanvas::sendEvent(QQuickItem *item, QEvent *e)
+bool QQuickWindow::sendEvent(QQuickItem *item, QEvent *e)
{
- Q_D(QQuickCanvas);
+ Q_D(QQuickWindow);
if (!item) {
- qWarning("QQuickCanvas::sendEvent: Cannot send event to a null item");
+ qWarning("QQuickWindow::sendEvent: Cannot send event to a null item");
return false;
}
@@ -1987,14 +1992,14 @@ bool QQuickCanvas::sendEvent(QQuickItem *item, QEvent *e)
return false;
}
-void QQuickCanvasPrivate::cleanupNodes()
+void QQuickWindowPrivate::cleanupNodes()
{
for (int ii = 0; ii < cleanupNodeList.count(); ++ii)
delete cleanupNodeList.at(ii);
cleanupNodeList.clear();
}
-void QQuickCanvasPrivate::cleanupNodesOnShutdown(QQuickItem *item)
+void QQuickWindowPrivate::cleanupNodesOnShutdown(QQuickItem *item)
{
QQuickItemPrivate *p = QQuickItemPrivate::get(item);
if (p->itemNodeInstance) {
@@ -2016,9 +2021,9 @@ void QQuickCanvasPrivate::cleanupNodesOnShutdown(QQuickItem *item)
}
// This must be called from the render thread, with the main thread frozen
-void QQuickCanvasPrivate::cleanupNodesOnShutdown()
+void QQuickWindowPrivate::cleanupNodesOnShutdown()
{
- Q_Q(QQuickCanvas);
+ Q_Q(QQuickWindow);
cleanupNodes();
cleanupNodesOnShutdown(rootItem);
QSet<QQuickItem *>::const_iterator it = parentlessItems.begin();
@@ -2027,10 +2032,10 @@ void QQuickCanvasPrivate::cleanupNodesOnShutdown()
q->cleanupSceneGraph();
}
-void QQuickCanvasPrivate::updateDirtyNodes()
+void QQuickWindowPrivate::updateDirtyNodes()
{
#ifdef DIRTY_DEBUG
- qWarning() << "QQuickCanvasPrivate::updateDirtyNodes():";
+ qWarning() << "QQuickWindowPrivate::updateDirtyNodes():";
#endif
cleanupNodes();
@@ -2051,7 +2056,7 @@ void QQuickCanvasPrivate::updateDirtyNodes()
}
}
-void QQuickCanvasPrivate::updateDirtyNode(QQuickItem *item)
+void QQuickWindowPrivate::updateDirtyNode(QQuickItem *item)
{
#ifdef QML_RUNTIME_TESTING
bool didFlash = false;
@@ -2086,10 +2091,10 @@ void QQuickCanvasPrivate::updateDirtyNode(QQuickItem *item)
itemPriv->itemNode()->setMatrix(matrix);
}
- bool clipEffectivelyChanged = (dirty & (QQuickItemPrivate::Clip | QQuickItemPrivate::Canvas)) &&
+ bool clipEffectivelyChanged = (dirty & (QQuickItemPrivate::Clip | QQuickItemPrivate::Window)) &&
((item->clip() == false) != (itemPriv->clipNode() == 0));
int effectRefCount = itemPriv->extra.isAllocated()?itemPriv->extra->effectRefCount:0;
- bool effectRefEffectivelyChanged = (dirty & (QQuickItemPrivate::EffectReference | QQuickItemPrivate::Canvas)) &&
+ bool effectRefEffectivelyChanged = (dirty & (QQuickItemPrivate::EffectReference | QQuickItemPrivate::Window)) &&
((effectRefCount == 0) != (itemPriv->rootNode() == 0));
if (clipEffectivelyChanged) {
@@ -2197,7 +2202,7 @@ void QQuickCanvasPrivate::updateDirtyNode(QQuickItem *item)
}
if (dirty & (QQuickItemPrivate::OpacityValue | QQuickItemPrivate::Visible
- | QQuickItemPrivate::HideReference | QQuickItemPrivate::Canvas))
+ | QQuickItemPrivate::HideReference | QQuickItemPrivate::Window))
{
qreal opacity = itemPriv->explicitVisible && (!itemPriv->extra.isAllocated() || itemPriv->extra->hideRefCount == 0)
? itemPriv->opacity() : qreal(0);
@@ -2287,7 +2292,7 @@ void QQuickCanvasPrivate::updateDirtyNode(QQuickItem *item)
itemPriv->childContainerNode()->appendChildNode(flash);
didFlash = true;
}
- Q_Q(QQuickCanvas);
+ Q_Q(QQuickWindow);
if (didFlash) {
q->maybeUpdate();
}
@@ -2295,15 +2300,15 @@ void QQuickCanvasPrivate::updateDirtyNode(QQuickItem *item)
}
-void QQuickCanvas::maybeUpdate()
+void QQuickWindow::maybeUpdate()
{
- Q_D(QQuickCanvas);
+ Q_D(QQuickWindow);
d->windowManager->maybeUpdate(this);
}
-void QQuickCanvas::cleanupSceneGraph()
+void QQuickWindow::cleanupSceneGraph()
{
- Q_D(QQuickCanvas);
+ Q_D(QQuickWindow);
if (!d->renderer)
return;
@@ -2322,9 +2327,9 @@ void QQuickCanvas::cleanupSceneGraph()
\sa sceneGraphInitialized(), sceneGraphInvalidated()
*/
-QOpenGLContext *QQuickCanvas::openglContext() const
+QOpenGLContext *QQuickWindow::openglContext() const
{
- Q_D(const QQuickCanvas);
+ Q_D(const QQuickWindow);
if (d->context->isReady())
return d->context->glContext();
return 0;
@@ -2355,9 +2360,9 @@ QOpenGLContext *QQuickCanvas::openglContext() const
/*!
- Sets the render target for this canvas to be \a fbo.
+ Sets the render target for this window to be \a fbo.
- The specified fbo must be created in the context of the canvas
+ The specified fbo must be created in the context of the window
or one that shares with it.
\warning
@@ -2365,11 +2370,11 @@ QOpenGLContext *QQuickCanvas::openglContext() const
the rendering.
*/
-void QQuickCanvas::setRenderTarget(QOpenGLFramebufferObject *fbo)
+void QQuickWindow::setRenderTarget(QOpenGLFramebufferObject *fbo)
{
- Q_D(QQuickCanvas);
+ Q_D(QQuickWindow);
if (d->context && d->context && QThread::currentThread() != d->context->thread()) {
- qWarning("QQuickCanvas::setRenderThread: Cannot set render target from outside the rendering thread");
+ qWarning("QQuickWindow::setRenderThread: Cannot set render target from outside the rendering thread");
return;
}
@@ -2386,11 +2391,11 @@ void QQuickCanvas::setRenderTarget(QOpenGLFramebufferObject *fbo)
/*!
\overload
*/
-void QQuickCanvas::setRenderTarget(uint fboId, const QSize &size)
+void QQuickWindow::setRenderTarget(uint fboId, const QSize &size)
{
- Q_D(QQuickCanvas);
+ Q_D(QQuickWindow);
if (d->context && d->context && QThread::currentThread() != d->context->thread()) {
- qWarning("QQuickCanvas::setRenderThread: Cannot set render target from outside the rendering thread");
+ qWarning("QQuickWindow::setRenderThread: Cannot set render target from outside the rendering thread");
return;
}
@@ -2405,18 +2410,18 @@ void QQuickCanvas::setRenderTarget(uint fboId, const QSize &size)
/*!
Returns the FBO id of the render target when set; otherwise returns 0.
*/
-uint QQuickCanvas::renderTargetId() const
+uint QQuickWindow::renderTargetId() const
{
- Q_D(const QQuickCanvas);
+ Q_D(const QQuickWindow);
return d->renderTargetId;
}
/*!
Returns the size of the currently set render target; otherwise returns an enpty size.
*/
-QSize QQuickCanvas::renderTargetSize() const
+QSize QQuickWindow::renderTargetSize() const
{
- Q_D(const QQuickCanvas);
+ Q_D(const QQuickWindow);
return d->renderTargetSize;
}
@@ -2424,54 +2429,54 @@ QSize QQuickCanvas::renderTargetSize() const
/*!
- Returns the render target for this canvas.
+ Returns the render target for this window.
- The default is to render to the surface of the canvas, in which
+ The default is to render to the surface of the window, in which
case the render target is 0.
*/
-QOpenGLFramebufferObject *QQuickCanvas::renderTarget() const
+QOpenGLFramebufferObject *QQuickWindow::renderTarget() const
{
- Q_D(const QQuickCanvas);
+ Q_D(const QQuickWindow);
return d->renderTarget;
}
/*!
- Grabs the contents of the framebuffer and returns it as an image.
+ Grabs the contents of the window and returns it as an image.
- This function might not work if the view is not visible.
+ This function might not work if the window is not visible.
\warning Calling this function will cause performance problems.
\warning This function can only be called from the GUI thread.
*/
-QImage QQuickCanvas::grabFrameBuffer()
+QImage QQuickWindow::grabWindow()
{
- Q_D(QQuickCanvas);
+ Q_D(QQuickWindow);
return d->windowManager->grab(this);
}
/*!
Returns an incubation controller that splices incubation between frames
- for this canvas. QQuickView automatically installs this controller for you,
+ for this window. QQuickView automatically installs this controller for you,
otherwise you will need to install it yourself using \l{QQmlEngine::setIncubationController}
- The controller is owned by the canvas and will be destroyed when the canvas
+ The controller is owned by the window and will be destroyed when the window
is deleted.
*/
-QQmlIncubationController *QQuickCanvas::incubationController() const
+QQmlIncubationController *QQuickWindow::incubationController() const
{
- Q_D(const QQuickCanvas);
+ Q_D(const QQuickWindow);
if (!d->incubationController)
- d->incubationController = new QQuickCanvasIncubationController(const_cast<QQuickCanvasPrivate *>(d));
+ d->incubationController = new QQuickWindowIncubationController(const_cast<QQuickWindowPrivate *>(d));
return d->incubationController;
}
/*!
- \enum QQuickCanvas::CreateTextureOption
+ \enum QQuickWindow::CreateTextureOption
The CreateTextureOption enums are used to customize a texture is wrapped.
@@ -2486,7 +2491,7 @@ QQmlIncubationController *QQuickCanvas::incubationController() const
*/
/*!
- \fn void QQuickCanvas::beforeRendering()
+ \fn void QQuickWindow::beforeRendering()
This signal is emitted before the scene starts rendering.
@@ -2505,7 +2510,7 @@ QQmlIncubationController *QQuickCanvas::incubationController() const
*/
/*!
- \fn void QQuickCanvas::afterRendering()
+ \fn void QQuickWindow::afterRendering()
This signal is emitted after the scene has completed rendering, before swapbuffers is called.
@@ -2536,9 +2541,9 @@ QQmlIncubationController *QQuickCanvas::incubationController() const
\sa beforeRendering()
*/
-void QQuickCanvas::setClearBeforeRendering(bool enabled)
+void QQuickWindow::setClearBeforeRendering(bool enabled)
{
- Q_D(QQuickCanvas);
+ Q_D(QQuickWindow);
d->clearBeforeRendering = enabled;
}
@@ -2548,9 +2553,9 @@ void QQuickCanvas::setClearBeforeRendering(bool enabled)
Returns weither clearing of the color buffer is done before rendering or not.
*/
-bool QQuickCanvas::clearBeforeRendering() const
+bool QQuickWindow::clearBeforeRendering() const
{
- Q_D(const QQuickCanvas);
+ Q_D(const QQuickWindow);
return d->clearBeforeRendering;
}
@@ -2582,9 +2587,9 @@ bool QQuickCanvas::clearBeforeRendering() const
\sa sceneGraphInitialized()
*/
-QSGTexture *QQuickCanvas::createTextureFromImage(const QImage &image) const
+QSGTexture *QQuickWindow::createTextureFromImage(const QImage &image) const
{
- Q_D(const QQuickCanvas);
+ Q_D(const QQuickWindow);
if (d->context && d->context->isReady())
return d->context->createTexture(image);
else
@@ -2605,9 +2610,9 @@ QSGTexture *QQuickCanvas::createTextureFromImage(const QImage &image) const
\sa sceneGraphInitialized()
*/
-QSGTexture *QQuickCanvas::createTextureFromId(uint id, const QSize &size, CreateTextureOptions options) const
+QSGTexture *QQuickWindow::createTextureFromId(uint id, const QSize &size, CreateTextureOptions options) const
{
- Q_D(const QQuickCanvas);
+ Q_D(const QQuickWindow);
if (d->context && d->context->isReady()) {
QSGPlainTexture *texture = new QSGPlainTexture();
texture->setTextureId(id);
@@ -2629,14 +2634,14 @@ QSGTexture *QQuickCanvas::createTextureFromId(uint id, const QSize &size, Create
\sa setClearBeforeRendering()
*/
-void QQuickCanvas::setClearColor(const QColor &color)
+void QQuickWindow::setColor(const QColor &color)
{
- Q_D(QQuickCanvas);
+ Q_D(QQuickWindow);
if (color == d->clearColor)
return;
d->clearColor = color;
- emit clearColorChanged(color);
+ emit colorChanged(color);
}
@@ -2645,13 +2650,13 @@ void QQuickCanvas::setClearColor(const QColor &color)
Returns the color used to clear the opengl context.
*/
-QColor QQuickCanvas::clearColor() const
+QColor QQuickWindow::color() const
{
return d_func()->clearColor;
}
-#include "moc_qquickcanvas.cpp"
+#include "moc_qquickwindow.cpp"
QT_END_NAMESPACE
diff --git a/src/quick/items/qquickwindow.h b/src/quick/items/qquickwindow.h
new file mode 100644
index 0000000000..9e351ed412
--- /dev/null
+++ b/src/quick/items/qquickwindow.h
@@ -0,0 +1,181 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKWINDOW_H
+#define QQUICKWINDOW_H
+
+#include <QtQuick/qtquickglobal.h>
+#include <QtCore/qmetatype.h>
+#include <QtGui/qopengl.h>
+#include <QtGui/qwindow.h>
+#include <QtGui/qevent.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+class QQuickItem;
+class QSGTexture;
+class QInputMethodEvent;
+class QQuickWindowPrivate;
+class QOpenGLFramebufferObject;
+class QQmlIncubationController;
+class QInputMethodEvent;
+
+class Q_QUICK_EXPORT QQuickWindow : public QWindow
+{
+ Q_OBJECT
+ Q_PRIVATE_PROPERTY(QQuickWindow::d_func(), QQmlListProperty<QObject> data READ data DESIGNABLE false)
+ Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
+ Q_PROPERTY(QQuickItem* contentItem READ contentItem CONSTANT FINAL)
+ Q_CLASSINFO("DefaultProperty", "data")
+ Q_DECLARE_PRIVATE(QQuickWindow)
+public:
+ enum CreateTextureOption {
+ TextureHasAlphaChannel = 0x0001,
+ TextureHasMipmaps = 0x0002,
+ TextureOwnsGLTexture = 0x0004
+ };
+
+ Q_DECLARE_FLAGS(CreateTextureOptions, CreateTextureOption)
+
+ QQuickWindow(QWindow *parent = 0);
+
+ virtual ~QQuickWindow();
+
+ QQuickItem *contentItem() const;
+ //XXX rootItem renamed contentItem - this function must be removed before 5.0
+ QQuickItem *rootItem() const { return contentItem(); }
+
+ QQuickItem *activeFocusItem() const;
+ QObject *focusObject() const;
+
+ QQuickItem *mouseGrabberItem() const;
+
+ bool sendEvent(QQuickItem *, QEvent *);
+
+ QImage grabWindow();
+
+ void setRenderTarget(QOpenGLFramebufferObject *fbo);
+ QOpenGLFramebufferObject *renderTarget() const;
+
+ void setRenderTarget(uint fboId, const QSize &size);
+ uint renderTargetId() const;
+ QSize renderTargetSize() const;
+
+ QQmlIncubationController *incubationController() const;
+
+#ifndef QT_NO_ACCESSIBILITY
+ virtual QAccessibleInterface *accessibleRoot() const;
+#endif
+
+ // Scene graph specific functions
+ QSGTexture *createTextureFromImage(const QImage &image) const;
+ QSGTexture *createTextureFromId(uint id, const QSize &size, CreateTextureOptions options = CreateTextureOption(0)) const;
+
+ void setClearBeforeRendering(bool enabled);
+ bool clearBeforeRendering() const;
+
+ void setColor(const QColor &color);
+ QColor color() const;
+
+ void setPersistentOpenGLContext(bool persistent);
+ bool isPersistentOpenGLContext() const;
+
+ void setPersistentSceneGraph(bool persistent);
+ bool isPersistentSceneGraph() const;
+
+ QOpenGLContext *openglContext() const;
+
+Q_SIGNALS:
+ void frameSwapped();
+ void sceneGraphInitialized();
+ void sceneGraphInvalidated();
+ void beforeSynchronizing();
+ void beforeRendering();
+ void afterRendering();
+ void colorChanged(const QColor &);
+
+public Q_SLOTS:
+ void update();
+ void releaseResources();
+
+protected:
+ QQuickWindow(QQuickWindowPrivate &dd, QWindow *parent = 0);
+
+ virtual void exposeEvent(QExposeEvent *);
+ virtual void resizeEvent(QResizeEvent *);
+
+ virtual void showEvent(QShowEvent *);
+ virtual void hideEvent(QHideEvent *);
+
+ virtual void focusInEvent(QFocusEvent *);
+ virtual void focusOutEvent(QFocusEvent *);
+
+ virtual bool event(QEvent *);
+ virtual void keyPressEvent(QKeyEvent *);
+ virtual void keyReleaseEvent(QKeyEvent *);
+ virtual void mousePressEvent(QMouseEvent *);
+ virtual void mouseReleaseEvent(QMouseEvent *);
+ virtual void mouseDoubleClickEvent(QMouseEvent *);
+ virtual void mouseMoveEvent(QMouseEvent *);
+#ifndef QT_NO_WHEELEVENT
+ virtual void wheelEvent(QWheelEvent *);
+#endif
+
+private Q_SLOTS:
+ void maybeUpdate();
+ void cleanupSceneGraph();
+
+private:
+ friend class QQuickItem;
+ friend class QQuickWindowRenderLoop;
+ Q_DISABLE_COPY(QQuickWindow)
+};
+
+QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(QQuickWindow *)
+
+QT_END_HEADER
+
+#endif // QQUICKWINDOW_H
+
diff --git a/src/quick/items/qquickcanvas_p.h b/src/quick/items/qquickwindow_p.h
index b93bf5a8dc..52e46ca6a8 100644
--- a/src/quick/items/qquickcanvas_p.h
+++ b/src/quick/items/qquickwindow_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QQUICKCANVAS_P_H
-#define QQUICKCANVAS_P_H
+#ifndef QQUICKWINDOW_P_H
+#define QQUICKWINDOW_P_H
//
// W A R N I N G
@@ -54,7 +54,7 @@
//
#include "qquickitem.h"
-#include "qquickcanvas.h"
+#include "qquickwindow.h"
#include <private/qqmlguard_p.h>
#include <QtQuick/private/qsgcontext_p.h>
@@ -86,23 +86,23 @@ public Q_SLOTS:
};
class QQuickItemPrivate;
-class QQuickCanvasPrivate;
+class QQuickWindowPrivate;
class QTouchEvent;
-class QQuickCanvasRenderLoop;
-class QQuickCanvasIncubationController;
+class QQuickWindowRenderLoop;
+class QQuickWindowIncubationController;
-class Q_QUICK_PRIVATE_EXPORT QQuickCanvasPrivate : public QWindowPrivate
+class Q_QUICK_PRIVATE_EXPORT QQuickWindowPrivate : public QWindowPrivate
{
public:
- Q_DECLARE_PUBLIC(QQuickCanvas)
+ Q_DECLARE_PUBLIC(QQuickWindow)
- static inline QQuickCanvasPrivate *get(QQuickCanvas *c) { return c->d_func(); }
+ static inline QQuickWindowPrivate *get(QQuickWindow *c) { return c->d_func(); }
- QQuickCanvasPrivate();
- virtual ~QQuickCanvasPrivate();
+ QQuickWindowPrivate();
+ virtual ~QQuickWindowPrivate();
- void init(QQuickCanvas *);
+ void init(QQuickWindow *);
void initRootItem();//Currently only used if items added in QML
QQuickRootItem *rootItem;
@@ -208,7 +208,7 @@ public:
// Keeps track of which touch point (int) was last accepted by which item
QHash<int, QQuickItem *> itemForTouchPointId;
- mutable QQuickCanvasIncubationController *incubationController;
+ mutable QQuickWindowIncubationController *incubationController;
static bool dragOverThreshold(qreal d, Qt::Axis axis, QMouseEvent *event);
@@ -217,8 +217,8 @@ private:
};
-Q_DECLARE_OPERATORS_FOR_FLAGS(QQuickCanvasPrivate::FocusOptions)
+Q_DECLARE_OPERATORS_FOR_FLAGS(QQuickWindowPrivate::FocusOptions)
QT_END_NAMESPACE
-#endif // QQUICKCANVAS_P_H
+#endif // QQUICKWINDOW_P_H
diff --git a/src/quick/items/qquickwindowmanager.cpp b/src/quick/items/qquickwindowmanager.cpp
index 3cfa871526..28a1e666e7 100644
--- a/src/quick/items/qquickwindowmanager.cpp
+++ b/src/quick/items/qquickwindowmanager.cpp
@@ -53,8 +53,8 @@
#include <QtQml/private/qqmlglobal_p.h>
-#include <QtQuick/QQuickCanvas>
-#include <QtQuick/private/qquickcanvas_p.h>
+#include <QtQuick/QQuickWindow>
+#include <QtQuick/private/qquickwindow_p.h>
#include <QtQuick/private/qsgcontext_p.h>
QT_BEGIN_NAMESPACE
@@ -63,9 +63,9 @@ const QEvent::Type QEvent_Sync = QEvent::Type(QEvent::User);
const QEvent::Type QEvent_DeferredUpdate = QEvent::Type(QEvent::User + 1);
-#define QQUICK_CANVAS_TIMING
-#ifdef QQUICK_CANVAS_TIMING
-static bool qquick_canvas_timing = !qgetenv("QML_CANVAS_TIMING").isEmpty();
+#define QQUICK_RENDER_TIMING
+#ifdef QQUICK_RENDER_TIMING
+static bool qquick_render_timing = !qgetenv("QML_RENDER_TIMING").isEmpty();
static QTime threadTimer;
static int syncTime;
static int renderTime;
@@ -163,7 +163,7 @@ public:
, shouldExit(false)
, hasExited(false)
, isDeferredUpdatePosted(false)
- , canvasToGrab(0)
+ , windowToGrab(0)
{
sg->moveToThread(this);
@@ -177,17 +177,17 @@ public:
void releaseResources() { }
- void show(QQuickCanvas *canvas);
- void hide(QQuickCanvas *canvas);
+ void show(QQuickWindow *window);
+ void hide(QQuickWindow *window);
- void canvasDestroyed(QQuickCanvas *canvas);
+ void windowDestroyed(QQuickWindow *window);
- void exposureChanged(QQuickCanvas *canvas);
- QImage grab(QQuickCanvas *canvas);
- void resize(QQuickCanvas *canvas, const QSize &size);
+ void exposureChanged(QQuickWindow *window);
+ QImage grab(QQuickWindow *window);
+ void resize(QQuickWindow *window, const QSize &size);
void handleDeferredUpdate();
- void maybeUpdate(QQuickCanvas *canvas);
- void update(QQuickCanvas *canvas) { maybeUpdate(canvas); } // identical for this implementation
+ void maybeUpdate(QQuickWindow *window);
+ void update(QQuickWindow *window) { maybeUpdate(window); } // identical for this implementation
void wakeup();
void startRendering();
@@ -211,9 +211,9 @@ public:
void run();
- QQuickCanvas *masterCanvas() {
- QQuickCanvas *win = 0;
- for (QHash<QQuickCanvas *, CanvasData *>::const_iterator it = m_rendered_windows.constBegin();
+ QQuickWindow *masterWindow() {
+ QQuickWindow *win = 0;
+ for (QHash<QQuickWindow *, WindowData *>::const_iterator it = m_rendered_windows.constBegin();
it != m_rendered_windows.constEnd() && !win; ++it) {
if (it.value()->isVisible)
win = it.key();
@@ -224,11 +224,11 @@ public:
public slots:
void animationStarted();
void animationStopped();
- void canvasVisibilityChanged();
+ void windowVisibilityChanged();
private:
void handleAddedWindows();
- void handleAddedWindow(QQuickCanvas *canvas);
+ void handleAddedWindow(QQuickWindow *window);
void handleRemovedWindows(bool clearGLContext = true);
QSGContext *sg;
@@ -252,10 +252,10 @@ private:
uint hasExited : 1;
uint isDeferredUpdatePosted : 1;
- QQuickCanvas *canvasToGrab;
+ QQuickWindow *windowToGrab;
QImage grabContent;
- struct CanvasData {
+ struct WindowData {
QSize renderedSize;
QSize windowSize;
QSize viewportSize;
@@ -264,18 +264,18 @@ private:
uint isVisible : 1;
};
- QHash<QQuickCanvas *, CanvasData *> m_rendered_windows;
+ QHash<QQuickWindow *, WindowData *> m_rendered_windows;
- struct CanvasTracker {
- QQuickCanvas *canvas;
+ struct WindowTracker {
+ QQuickWindow *window;
uint isVisible : 1;
uint toBeRemoved : 1;
};
- QList<CanvasTracker> m_tracked_windows;
+ QList<WindowTracker> m_tracked_windows;
- QList<QQuickCanvas *> m_removed_windows;
- QList<QQuickCanvas *> m_added_windows;
+ QList<QQuickWindow *> m_removed_windows;
+ QList<QQuickWindow *> m_added_windows;
};
@@ -284,20 +284,20 @@ class QQuickTrivialWindowManager : public QObject, public QQuickWindowManager
public:
QQuickTrivialWindowManager();
- void show(QQuickCanvas *canvas);
- void hide(QQuickCanvas *canvas);
+ void show(QQuickWindow *window);
+ void hide(QQuickWindow *window);
- void canvasDestroyed(QQuickCanvas *canvas);
+ void windowDestroyed(QQuickWindow *window);
void initializeGL();
- void renderCanvas(QQuickCanvas *canvas);
- void exposureChanged(QQuickCanvas *canvas);
- QImage grab(QQuickCanvas *canvas);
- void resize(QQuickCanvas *canvas, const QSize &size);
+ void renderWindow(QQuickWindow *window);
+ void exposureChanged(QQuickWindow *window);
+ QImage grab(QQuickWindow *window);
+ void resize(QQuickWindow *window, const QSize &size);
void wakeup();
- void maybeUpdate(QQuickCanvas *canvas);
- void update(QQuickCanvas *canvas) { maybeUpdate(canvas); } // identical for this implementation.
+ void maybeUpdate(QQuickWindow *window);
+ void update(QQuickWindow *window) { maybeUpdate(window); } // identical for this implementation.
void releaseResources() { }
@@ -307,12 +307,12 @@ public:
bool event(QEvent *);
- struct CanvasData {
+ struct WindowData {
bool updatePending : 1;
bool grabOnly : 1;
};
- QHash<QQuickCanvas *, CanvasData> m_windows;
+ QHash<QQuickWindow *, WindowData> m_windows;
QOpenGLContext *gl;
QSGContext *sg;
@@ -366,7 +366,7 @@ void QQuickRenderThreadSingleContextWindowManager::initialize()
{
Q_ASSERT(m_rendered_windows.size());
- QQuickCanvas *win = masterCanvas();
+ QQuickWindow *win = masterWindow();
if (!win)
return;
@@ -375,7 +375,7 @@ void QQuickRenderThreadSingleContextWindowManager::initialize()
gl->setFormat(win->requestedFormat());
gl->create();
if (!gl->makeCurrent(win))
- qWarning("QQuickCanvas: makeCurrent() failed...");
+ qWarning("QQuickWindow: makeCurrent() failed...");
Q_ASSERT(!sg->isReady());
sg->initialize(gl);
@@ -383,42 +383,42 @@ void QQuickRenderThreadSingleContextWindowManager::initialize()
/*!
- This function is called when the canvas is created to register the canvas with
+ This function is called when the window is created to register the window with
the window manager.
Called on GUI Thread.
*/
-void QQuickRenderThreadSingleContextWindowManager::show(QQuickCanvas *canvas)
+void QQuickRenderThreadSingleContextWindowManager::show(QQuickWindow *window)
{
#ifdef THREAD_DEBUG
- printf("GUI: Canvas added to windowing system, %p, %dx%d\n", canvas, canvas->width(), canvas->height());
+ printf("GUI: Window added to windowing system, %p, %dx%d\n", window, window->width(), window->height());
#endif
- CanvasTracker tracker;
- tracker.canvas = canvas;
+ WindowTracker tracker;
+ tracker.window = window;
tracker.isVisible = false;
tracker.toBeRemoved = false;
m_tracked_windows << tracker;
- connect(canvas, SIGNAL(widthChanged(int)), this, SLOT(canvasVisibilityChanged()), Qt::DirectConnection);
- connect(canvas, SIGNAL(heightChanged(int)), this, SLOT(canvasVisibilityChanged()), Qt::DirectConnection);
+ connect(window, SIGNAL(widthChanged(int)), this, SLOT(windowVisibilityChanged()), Qt::DirectConnection);
+ connect(window, SIGNAL(heightChanged(int)), this, SLOT(windowVisibilityChanged()), Qt::DirectConnection);
- canvasVisibilityChanged();
+ windowVisibilityChanged();
}
-void QQuickRenderThreadSingleContextWindowManager::handleAddedWindow(QQuickCanvas *canvas)
+void QQuickRenderThreadSingleContextWindowManager::handleAddedWindow(QQuickWindow *window)
{
#ifdef THREAD_DEBUG
- printf(" RenderThread: adding canvas: %p\n", canvas);
+ printf(" RenderThread: adding window: %p\n", window);
#endif
- CanvasData *data = new CanvasData;
+ WindowData *data = new WindowData;
data->sizeWasChanged = false;
- data->windowSize = canvas->size();
- data->isVisible = canvas->isVisible();
- m_rendered_windows[canvas] = data;
+ data->windowSize = window->size();
+ data->isVisible = window->isVisible();
+ m_rendered_windows[window] = data;
isExternalUpdatePending = true;
}
@@ -434,23 +434,23 @@ void QQuickRenderThreadSingleContextWindowManager::handleAddedWindows()
#endif
while (m_added_windows.size()) {
- QQuickCanvas *canvas = m_added_windows.takeLast();
- handleAddedWindow(canvas);
+ QQuickWindow *window = m_added_windows.takeLast();
+ handleAddedWindow(window);
}
}
/*!
- Called on the GUI Thread, from the canvas' destructor
+ Called on the GUI Thread, from the window' destructor
*/
-void QQuickRenderThreadSingleContextWindowManager::canvasDestroyed(QQuickCanvas *canvas)
+void QQuickRenderThreadSingleContextWindowManager::windowDestroyed(QQuickWindow *window)
{
#ifdef THREAD_DEBUG
- printf("GUI: Canvas destroyed: %p\n", canvas);
+ printf("GUI: Window destroyed: %p\n", window);
#endif
- hide(canvas);
+ hide(window);
}
@@ -458,15 +458,15 @@ void QQuickRenderThreadSingleContextWindowManager::canvasDestroyed(QQuickCanvas
Called on GUI Thread
*/
-void QQuickRenderThreadSingleContextWindowManager::hide(QQuickCanvas *canvas)
+void QQuickRenderThreadSingleContextWindowManager::hide(QQuickWindow *window)
{
#ifdef THREAD_DEBUG
- printf("GUI: Canvas hidden: %p\n", canvas);
+ printf("GUI: Window hidden: %p\n", window);
#endif
int position = -1;
for (int i=0; i<m_tracked_windows.size(); ++i) {
- if (m_tracked_windows.at(i).canvas == canvas) {
+ if (m_tracked_windows.at(i).window == window) {
m_tracked_windows[i].toBeRemoved = true;
position = i;
break;
@@ -474,14 +474,14 @@ void QQuickRenderThreadSingleContextWindowManager::hide(QQuickCanvas *canvas)
}
if (position >= 0) {
- disconnect(canvas, SIGNAL(widthChanged(int)), this, SLOT(canvasVisibilityChanged()));
- disconnect(canvas, SIGNAL(heightChanged(int)), this, SLOT(canvasVisibilityChanged()));
- canvasVisibilityChanged();
+ disconnect(window, SIGNAL(widthChanged(int)), this, SLOT(windowVisibilityChanged()));
+ disconnect(window, SIGNAL(heightChanged(int)), this, SLOT(windowVisibilityChanged()));
+ windowVisibilityChanged();
m_tracked_windows.removeAt(position);
}
#ifdef THREAD_DEBUG
- printf("GUI: Canvas removal completed... %p\n", canvas);
+ printf("GUI: Window removal completed... %p\n", window);
#endif
}
@@ -496,13 +496,13 @@ void QQuickRenderThreadSingleContextWindowManager::handleRemovedWindows(bool cle
bool removedAnything = false;
while (m_removed_windows.size()) {
- QQuickCanvas *canvas = m_removed_windows.takeLast();
+ QQuickWindow *window = m_removed_windows.takeLast();
#ifdef THREAD_DEBUG
- printf(" RenderThread: removing %p\n", canvas);
+ printf(" RenderThread: removing %p\n", window);
#endif
- QQuickCanvasPrivate::get(canvas)->cleanupNodesOnShutdown();
- delete m_rendered_windows.take(canvas);
+ QQuickWindowPrivate::get(window)->cleanupNodesOnShutdown();
+ delete m_rendered_windows.take(window);
removedAnything = true;
}
@@ -519,26 +519,26 @@ void QQuickRenderThreadSingleContextWindowManager::handleRemovedWindows(bool cle
Called on GUI Thread
*/
-void QQuickRenderThreadSingleContextWindowManager::canvasVisibilityChanged()
+void QQuickRenderThreadSingleContextWindowManager::windowVisibilityChanged()
{
bool anyoneShowing = false;
- QList<QQuickCanvas *> toAdd, toRemove;
+ QList<QQuickWindow *> toAdd, toRemove;
// Not optimal, but also not frequently used...
for (int i=0; i<m_tracked_windows.size(); ++i) {
- CanvasTracker &t = const_cast<CanvasTracker &>(m_tracked_windows.at(i));
- QQuickCanvas *win = t.canvas;
+ WindowTracker &t = const_cast<WindowTracker &>(m_tracked_windows.at(i));
+ QQuickWindow *win = t.window;
- Q_ASSERT(win->isVisible() || QQuickCanvasPrivate::get(win)->renderWithoutShowing || t.toBeRemoved);
- bool canvasVisible = win->width() > 0 && win->height() > 0;
- anyoneShowing |= (canvasVisible && !t.toBeRemoved);
+ Q_ASSERT(win->isVisible() || QQuickWindowPrivate::get(win)->renderWithoutShowing || t.toBeRemoved);
+ bool windowVisible = win->width() > 0 && win->height() > 0;
+ anyoneShowing |= (windowVisible && !t.toBeRemoved);
- if ((!canvasVisible && t.isVisible) || t.toBeRemoved) {
+ if ((!windowVisible && t.isVisible) || t.toBeRemoved) {
toRemove << win;
- } else if (canvasVisible && !t.isVisible) {
+ } else if (windowVisible && !t.isVisible) {
toAdd << win;
}
- t.isVisible = canvasVisible;
+ t.isVisible = windowVisible;
}
if (isRunning()) {
@@ -616,39 +616,39 @@ void QQuickRenderThreadSingleContextWindowManager::run()
#ifdef THREAD_DEBUG
printf(" RenderThread: Doing locked sync\n");
#endif
-#ifdef QQUICK_CANVAS_TIMING
- if (qquick_canvas_timing)
+#ifdef QQUICK_RENDER_TIMING
+ if (qquick_render_timing)
threadTimer.start();
#endif
inSync = true;
- for (QHash<QQuickCanvas *, CanvasData *>::const_iterator it = m_rendered_windows.constBegin();
+ for (QHash<QQuickWindow *, WindowData *>::const_iterator it = m_rendered_windows.constBegin();
it != m_rendered_windows.constEnd(); ++it) {
- QQuickCanvas *canvas = it.key();
+ QQuickWindow *window = it.key();
#ifdef THREAD_DEBUG
- printf(" RenderThread: Syncing canvas: %p\n", canvas);
+ printf(" RenderThread: Syncing window: %p\n", window);
#endif
- CanvasData *canvasData = it.value();
- QQuickCanvasPrivate *canvasPrivate = QQuickCanvasPrivate::get(canvas);
+ WindowData *windowData = it.value();
+ QQuickWindowPrivate *windowPrivate = QQuickWindowPrivate::get(window);
- Q_ASSERT(canvasData->windowSize.width() > 0 && canvasData->windowSize.height() > 0);
+ Q_ASSERT(windowData->windowSize.width() > 0 && windowData->windowSize.height() > 0);
- if (!canvasData->isVisible)
- gl->makeCurrent(masterCanvas());
+ if (!windowData->isVisible)
+ gl->makeCurrent(masterWindow());
else
- gl->makeCurrent(canvas);
+ gl->makeCurrent(window);
- if (canvasData->viewportSize != canvasData->windowSize) {
+ if (windowData->viewportSize != windowData->windowSize) {
#ifdef THREAD_DEBUG
printf(" RenderThread: --- window has changed size...\n");
#endif
- canvasData->viewportSize = canvasData->windowSize;
- canvasData->sizeWasChanged = true;
- glViewport(0, 0, canvasData->viewportSize.width(), canvasData->viewportSize.height());
+ windowData->viewportSize = windowData->windowSize;
+ windowData->sizeWasChanged = true;
+ glViewport(0, 0, windowData->viewportSize.width(), windowData->viewportSize.height());
}
- canvasPrivate->syncSceneGraph();
+ windowPrivate->syncSceneGraph();
}
inSync = false;
@@ -659,65 +659,65 @@ void QQuickRenderThreadSingleContextWindowManager::run()
#ifdef THREAD_DEBUG
printf(" RenderThread: sync done\n");
#endif
-#ifdef QQUICK_CANVAS_TIMING
- if (qquick_canvas_timing)
+#ifdef QQUICK_RENDER_TIMING
+ if (qquick_render_timing)
syncTime = threadTimer.elapsed();
#endif
- for (QHash<QQuickCanvas *, CanvasData *>::const_iterator it = m_rendered_windows.constBegin();
+ for (QHash<QQuickWindow *, WindowData *>::const_iterator it = m_rendered_windows.constBegin();
it != m_rendered_windows.constEnd(); ++it) {
- QQuickCanvas *canvas = it.key();
- CanvasData *canvasData = it.value();
- QQuickCanvasPrivate *canvasPrivate = QQuickCanvasPrivate::get(canvas);
+ QQuickWindow *window = it.key();
+ WindowData *windowData = it.value();
+ QQuickWindowPrivate *windowPrivate = QQuickWindowPrivate::get(window);
#ifdef THREAD_DEBUG
- printf(" RenderThread: Rendering canvas %p\n", canvas);
+ printf(" RenderThread: Rendering window %p\n", window);
#endif
- Q_ASSERT(canvasData->windowSize.width() > 0 && canvasData->windowSize.height() > 0);
+ Q_ASSERT(windowData->windowSize.width() > 0 && windowData->windowSize.height() > 0);
#ifdef THREAD_DEBUG
printf(" RenderThread: --- rendering at size %dx%d\n",
- canvasData->viewportSize.width(), canvasData->viewportSize.height()
+ windowData->viewportSize.width(), windowData->viewportSize.height()
);
#endif
// We only need to re-makeCurrent when we have multiple surfaces.
if (m_rendered_windows.size() > 1)
- gl->makeCurrent(canvas);
+ gl->makeCurrent(window);
- canvasPrivate->renderSceneGraph(canvasData->viewportSize);
-#ifdef QQUICK_CANVAS_TIMING
- if (qquick_canvas_timing)
+ windowPrivate->renderSceneGraph(windowData->viewportSize);
+#ifdef QQUICK_RENDER_TIMING
+ if (qquick_render_timing)
renderTime = threadTimer.elapsed() - syncTime;
#endif
// The content of the target buffer is undefined after swap() so grab needs
// to happen before swap();
- if (canvas == canvasToGrab) {
+ if (window == windowToGrab) {
#ifdef THREAD_DEBUG
printf(" RenderThread: --- grabbing...\n");
#endif
- grabContent = qt_gl_read_framebuffer(canvasData->windowSize, false, false);
- canvasToGrab = 0;
+ grabContent = qt_gl_read_framebuffer(windowData->windowSize, false, false);
+ windowToGrab = 0;
}
#ifdef THREAD_DEBUG
printf(" RenderThread: --- wait for swap...\n");
#endif
- if (canvasData->isVisible && canvas->isExposed())
- gl->swapBuffers(canvas);
+ if (windowData->isVisible && window->isExposed())
+ gl->swapBuffers(window);
- canvasPrivate->fireFrameSwapped();
+ windowPrivate->fireFrameSwapped();
#ifdef THREAD_DEBUG
printf(" RenderThread: --- swap complete...\n");
#endif
}
-#ifdef QQUICK_CANVAS_TIMING
- if (qquick_canvas_timing) {
+#ifdef QQUICK_RENDER_TIMING
+ if (qquick_render_timing) {
swapTime = threadTimer.elapsed() - renderTime;
qDebug() << "- Breakdown of frame time; sync:" << syncTime
<< "ms render:" << renderTime << "ms swap:" << swapTime
@@ -730,12 +730,12 @@ void QQuickRenderThreadSingleContextWindowManager::run()
handleRemovedWindows();
// Update sizes...
- for (QHash<QQuickCanvas *, CanvasData *>::const_iterator it = m_rendered_windows.constBegin();
+ for (QHash<QQuickWindow *, WindowData *>::const_iterator it = m_rendered_windows.constBegin();
it != m_rendered_windows.constEnd(); ++it) {
- CanvasData *canvasData = it.value();
- if (canvasData->sizeWasChanged) {
- canvasData->renderedSize = canvasData->viewportSize;
- canvasData->sizeWasChanged = false;
+ WindowData *windowData = it.value();
+ if (windowData->sizeWasChanged) {
+ windowData->renderedSize = windowData->viewportSize;
+ windowData->sizeWasChanged = false;
}
}
@@ -746,7 +746,7 @@ void QQuickRenderThreadSingleContextWindowManager::run()
// but we don't want to lock an extra time.
wake();
- if (!animationRunning && !isExternalUpdatePending && !shouldExit && !canvasToGrab) {
+ if (!animationRunning && !isExternalUpdatePending && !shouldExit && !windowToGrab) {
#ifdef THREAD_DEBUG
printf(" RenderThread: nothing to do, going to sleep...\n");
#endif
@@ -800,7 +800,7 @@ bool QQuickRenderThreadSingleContextWindowManager::event(QEvent *e)
if (e->type() == QEvent_Sync) {
- // If all canvases have been hidden, ignore the event
+ // If all windows have been hidden, ignore the event
if (!isRunning())
return true;
@@ -855,9 +855,9 @@ void QQuickRenderThreadSingleContextWindowManager::sync(bool guiAlreadyLocked)
if (!guiAlreadyLocked)
lockInGui();
- for (QHash<QQuickCanvas *, CanvasData *>::const_iterator it = m_rendered_windows.constBegin();
+ for (QHash<QQuickWindow *, WindowData *>::const_iterator it = m_rendered_windows.constBegin();
it != m_rendered_windows.constEnd(); ++it) {
- QQuickCanvasPrivate::get(it.key())->polishItems();
+ QQuickWindowPrivate::get(it.key())->polishItems();
}
wake();
@@ -943,42 +943,42 @@ void QQuickRenderThreadSingleContextWindowManager::animationStopped()
}
-void QQuickRenderThreadSingleContextWindowManager::exposureChanged(QQuickCanvas *canvas)
+void QQuickRenderThreadSingleContextWindowManager::exposureChanged(QQuickWindow *window)
{
- Q_UNUSED(canvas);
+ Q_UNUSED(window);
#ifdef THREAD_DEBUG
- printf("GUI: exposure changed: %p\n", canvas);
+ printf("GUI: exposure changed: %p\n", window);
#endif
- if (canvas->isExposed())
- maybeUpdate(canvas);
+ if (window->isExposed())
+ maybeUpdate(window);
#ifdef THREAD_DEBUG
- printf("GUI: exposure changed done: %p\n", canvas);
+ printf("GUI: exposure changed done: %p\n", window);
#endif
}
-void QQuickRenderThreadSingleContextWindowManager::resize(QQuickCanvas *canvas, const QSize &size)
+void QQuickRenderThreadSingleContextWindowManager::resize(QQuickWindow *window, const QSize &size)
{
#ifdef THREAD_DEBUG
- printf("GUI: Resize Event: %p = %dx%d\n", canvas, size.width(), size.height());
+ printf("GUI: Resize Event: %p = %dx%d\n", window, size.width(), size.height());
#endif
// If the rendering thread is not running we do not need to do anything.
- // Also if the canvas is being resized to an invalid size, it will be removed
- // by the canvasVisibilityChanged slot as result of width/heightcChanged()
+ // Also if the window is being resized to an invalid size, it will be removed
+ // by the windowVisibilityChanged slot as result of width/heightcChanged()
if (!isRunning() || size.width() <= 0 || size.height() <= 0)
return;
lockInGui();
exhaustSyncEvent();
- CanvasData *canvasData = m_rendered_windows.value(canvas);
- if (canvasData) {
- canvasData->windowSize = size;
- while (isRunning() && canvasData->renderedSize != size && size.width() > 0 && size.height() > 0) {
+ WindowData *windowData = m_rendered_windows.value(window);
+ if (windowData) {
+ windowData->windowSize = size;
+ while (isRunning() && windowData->renderedSize != size && size.width() > 0 && size.height() > 0) {
if (isRenderBlocked)
wake();
wait();
@@ -987,7 +987,7 @@ void QQuickRenderThreadSingleContextWindowManager::resize(QQuickCanvas *canvas,
unlockInGui();
#ifdef THREAD_DEBUG
- printf("GUI: Resize done: %p\n", canvas);
+ printf("GUI: Resize done: %p\n", window);
#endif
}
@@ -1066,13 +1066,13 @@ void QQuickRenderThreadSingleContextWindowManager::stopRendering()
-QImage QQuickRenderThreadSingleContextWindowManager::grab(QQuickCanvas *canvas)
+QImage QQuickRenderThreadSingleContextWindowManager::grab(QQuickWindow *window)
{
if (!isRunning())
return QImage();
if (QThread::currentThread() != qApp->thread()) {
- qWarning("QQuickCanvas::grabFrameBuffer: can only be called from the GUI thread");
+ qWarning("QQuickWindow::grabFrameBuffer: can only be called from the GUI thread");
return QImage();
}
@@ -1083,8 +1083,8 @@ QImage QQuickRenderThreadSingleContextWindowManager::grab(QQuickCanvas *canvas)
lockInGui();
exhaustSyncEvent();
- canvasToGrab = canvas;
- while (isRunning() && canvasToGrab) {
+ windowToGrab = window;
+ while (isRunning() && windowToGrab) {
if (isRenderBlocked)
wake();
wait();
@@ -1114,10 +1114,10 @@ void QQuickRenderThreadSingleContextWindowManager::handleDeferredUpdate()
unlockInGui();
}
-void QQuickRenderThreadSingleContextWindowManager::maybeUpdate(QQuickCanvas *)
+void QQuickRenderThreadSingleContextWindowManager::maybeUpdate(QQuickWindow *)
{
Q_ASSERT_X(QThread::currentThread() == QCoreApplication::instance()->thread() || inSync,
- "QQuickCanvas::update",
+ "QQuickWindow::update",
"Function can only be called from GUI thread or during QQuickItem::updatePaintNode()");
if (inSync) {
@@ -1150,23 +1150,23 @@ QQuickTrivialWindowManager::QQuickTrivialWindowManager()
}
-void QQuickTrivialWindowManager::show(QQuickCanvas *canvas)
+void QQuickTrivialWindowManager::show(QQuickWindow *window)
{
- CanvasData data;
+ WindowData data;
data.updatePending = false;
data.grabOnly = false;
- m_windows[canvas] = data;
+ m_windows[window] = data;
- maybeUpdate(canvas);
+ maybeUpdate(window);
}
-void QQuickTrivialWindowManager::hide(QQuickCanvas *canvas)
+void QQuickTrivialWindowManager::hide(QQuickWindow *window)
{
- if (!m_windows.contains(canvas))
+ if (!m_windows.contains(window))
return;
- m_windows.remove(canvas);
- QQuickCanvasPrivate *cd = QQuickCanvasPrivate::get(canvas);
+ m_windows.remove(window);
+ QQuickWindowPrivate *cd = QQuickWindowPrivate::get(window);
cd->cleanupNodesOnShutdown();
if (m_windows.size() == 0) {
@@ -1176,81 +1176,81 @@ void QQuickTrivialWindowManager::hide(QQuickCanvas *canvas)
}
}
-void QQuickTrivialWindowManager::canvasDestroyed(QQuickCanvas *canvas)
+void QQuickTrivialWindowManager::windowDestroyed(QQuickWindow *window)
{
- hide(canvas);
+ hide(window);
}
-void QQuickTrivialWindowManager::renderCanvas(QQuickCanvas *canvas)
+void QQuickTrivialWindowManager::renderWindow(QQuickWindow *window)
{
- if (!canvas->isExposed() || !m_windows.contains(canvas))
+ if (!window->isExposed() || !m_windows.contains(window))
return;
- CanvasData &data = const_cast<CanvasData &>(m_windows[canvas]);
+ WindowData &data = const_cast<WindowData &>(m_windows[window]);
- QQuickCanvas *masterCanvas = 0;
- if (!canvas->isVisible()) {
+ QQuickWindow *masterWindow = 0;
+ if (!window->isVisible()) {
// Find a "proper surface" to bind...
- for (QHash<QQuickCanvas *, CanvasData>::const_iterator it = m_windows.constBegin();
- it != m_windows.constEnd() && !masterCanvas; ++it) {
+ for (QHash<QQuickWindow *, WindowData>::const_iterator it = m_windows.constBegin();
+ it != m_windows.constEnd() && !masterWindow; ++it) {
if (it.key()->isVisible())
- masterCanvas = it.key();
+ masterWindow = it.key();
}
} else {
- masterCanvas = canvas;
+ masterWindow = window;
}
- if (!masterCanvas)
+ if (!masterWindow)
return;
if (!gl) {
gl = new QOpenGLContext();
- gl->setFormat(masterCanvas->requestedFormat());
+ gl->setFormat(masterWindow->requestedFormat());
gl->create();
- if (!gl->makeCurrent(masterCanvas))
- qWarning("QQuickCanvas: makeCurrent() failed...");
+ if (!gl->makeCurrent(masterWindow))
+ qWarning("QQuickWindow: makeCurrent() failed...");
sg->initialize(gl);
} else {
- gl->makeCurrent(masterCanvas);
+ gl->makeCurrent(masterWindow);
}
bool alsoSwap = data.updatePending;
data.updatePending = false;
- QQuickCanvasPrivate *cd = QQuickCanvasPrivate::get(canvas);
+ QQuickWindowPrivate *cd = QQuickWindowPrivate::get(window);
cd->polishItems();
cd->syncSceneGraph();
- cd->renderSceneGraph(canvas->size());
+ cd->renderSceneGraph(window->size());
if (data.grabOnly) {
- grabContent = qt_gl_read_framebuffer(canvas->size(), false, false);
+ grabContent = qt_gl_read_framebuffer(window->size(), false, false);
data.grabOnly = false;
}
- if (alsoSwap && canvas->isVisible()) {
- gl->swapBuffers(canvas);
+ if (alsoSwap && window->isVisible()) {
+ gl->swapBuffers(window);
cd->fireFrameSwapped();
}
// Might have been set during syncSceneGraph()
if (data.updatePending)
- maybeUpdate(canvas);
+ maybeUpdate(window);
}
-void QQuickTrivialWindowManager::exposureChanged(QQuickCanvas *canvas)
+void QQuickTrivialWindowManager::exposureChanged(QQuickWindow *window)
{
- if (canvas->isExposed())
- maybeUpdate(canvas);
+ if (window->isExposed())
+ maybeUpdate(window);
}
-QImage QQuickTrivialWindowManager::grab(QQuickCanvas *canvas)
+QImage QQuickTrivialWindowManager::grab(QQuickWindow *window)
{
- if (!m_windows.contains(canvas))
+ if (!m_windows.contains(window))
return QImage();
- m_windows[canvas].grabOnly = true;
+ m_windows[window].grabOnly = true;
- renderCanvas(canvas);
+ renderWindow(window);
QImage grabbed = grabContent;
grabContent = QImage();
@@ -1259,18 +1259,18 @@ QImage QQuickTrivialWindowManager::grab(QQuickCanvas *canvas)
-void QQuickTrivialWindowManager::resize(QQuickCanvas *, const QSize &)
+void QQuickTrivialWindowManager::resize(QQuickWindow *, const QSize &)
{
}
-void QQuickTrivialWindowManager::maybeUpdate(QQuickCanvas *canvas)
+void QQuickTrivialWindowManager::maybeUpdate(QQuickWindow *window)
{
- if (!m_windows.contains(canvas))
+ if (!m_windows.contains(window))
return;
- m_windows[canvas].updatePending = true;
+ m_windows[window].updatePending = true;
if (!eventPending) {
QCoreApplication::postEvent(this, new QEvent(QEvent::User));
@@ -1299,11 +1299,11 @@ bool QQuickTrivialWindowManager::event(QEvent *e)
{
if (e->type() == QEvent::User) {
eventPending = false;
- for (QHash<QQuickCanvas *, CanvasData>::const_iterator it = m_windows.constBegin();
+ for (QHash<QQuickWindow *, WindowData>::const_iterator it = m_windows.constBegin();
it != m_windows.constEnd(); ++it) {
- const CanvasData &data = it.value();
+ const WindowData &data = it.value();
if (data.updatePending)
- renderCanvas(it.key());
+ renderWindow(it.key());
}
return true;
}
diff --git a/src/quick/items/qquickwindowmanager_p.h b/src/quick/items/qquickwindowmanager_p.h
index 553501928d..ccad33cd20 100644
--- a/src/quick/items/qquickwindowmanager_p.h
+++ b/src/quick/items/qquickwindowmanager_p.h
@@ -47,7 +47,7 @@
QT_BEGIN_NAMESPACE
-class QQuickCanvas;
+class QQuickWindow;
class QSGContext;
class Q_QUICK_PRIVATE_EXPORT QQuickWindowManager
@@ -55,17 +55,17 @@ class Q_QUICK_PRIVATE_EXPORT QQuickWindowManager
public:
virtual ~QQuickWindowManager();
- virtual void show(QQuickCanvas *canvas) = 0;
- virtual void hide(QQuickCanvas *canvas) = 0;
+ virtual void show(QQuickWindow *window) = 0;
+ virtual void hide(QQuickWindow *window) = 0;
- virtual void canvasDestroyed(QQuickCanvas *canvas) = 0;
+ virtual void windowDestroyed(QQuickWindow *window) = 0;
- virtual void exposureChanged(QQuickCanvas *canvas) = 0;
- virtual QImage grab(QQuickCanvas *canvas) = 0;
- virtual void resize(QQuickCanvas *canvas, const QSize &size) = 0;
+ virtual void exposureChanged(QQuickWindow *window) = 0;
+ virtual QImage grab(QQuickWindow *window) = 0;
+ virtual void resize(QQuickWindow *window, const QSize &size) = 0;
- virtual void update(QQuickCanvas *canvas) = 0;
- virtual void maybeUpdate(QQuickCanvas *canvas) = 0;
+ virtual void update(QQuickWindow *window) = 0;
+ virtual void maybeUpdate(QQuickWindow *window) = 0;
virtual void wakeup() = 0;
virtual volatile bool *allowMainThreadProcessing() = 0;
diff --git a/src/quick/items/qquickwindowmodule.cpp b/src/quick/items/qquickwindowmodule.cpp
index 4c9620748a..97911c01e5 100644
--- a/src/quick/items/qquickwindowmodule.cpp
+++ b/src/quick/items/qquickwindowmodule.cpp
@@ -41,7 +41,7 @@
#include "qquickwindowmodule_p.h"
#include "qquickscreen_p.h"
-#include <QtQuick/QQuickCanvas>
+#include <QtQuick/QQuickWindow>
QT_BEGIN_NAMESPACE
@@ -49,7 +49,7 @@ void QQuickWindowModule::defineModule()
{
const char uri[] = "QtQuick.Window";
- qmlRegisterType<QQuickCanvas>(uri, 2, 0, "Window");
+ qmlRegisterType<QQuickWindow>(uri, 2, 0, "Window");
qmlRegisterUncreatableType<QQuickScreen>(uri, 2, 0, "Screen", QStringLiteral("Screen can only be used via the attached property."));
}