diff options
author | Alan Alpert <alan.alpert@nokia.com> | 2011-11-18 19:32:56 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-11-29 03:29:53 +0100 |
commit | ba0d63fd220ff215150e827a21a42c8de3372dd4 (patch) | |
tree | 7182b6234404ce421c14338170e27d72223510e6 /src/declarative/items/qquickcanvas.cpp | |
parent | 6a198083e5f61fb51c5f1c5d77366edd404bc7c2 (diff) |
Initial window implementation
Includes adding a color property on QQuickCanvas. Note that most Window
related properties come from the QWindow inheritance.
Task-number: QTBUG-19799
Change-Id: I00f6c90a1e2a5c85d787793d6edac2cd7d5309ab
Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
Diffstat (limited to 'src/declarative/items/qquickcanvas.cpp')
-rw-r--r-- | src/declarative/items/qquickcanvas.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/declarative/items/qquickcanvas.cpp b/src/declarative/items/qquickcanvas.cpp index c6969b5cda..8022af98f4 100644 --- a/src/declarative/items/qquickcanvas.cpp +++ b/src/declarative/items/qquickcanvas.cpp @@ -532,6 +532,23 @@ void QQuickCanvasPrivate::init(QQuickCanvas *c) q->setFormat(context->defaultSurfaceFormat()); } +QDeclarativeListProperty<QObject> QQuickCanvasPrivate::data() +{ + initRootItem(); + return QQuickItemPrivate::get(rootItem)->data(); +} + +void QQuickCanvasPrivate::initRootItem() +{ + Q_Q(QQuickCanvas); + q->connect(q, SIGNAL(widthChanged(int)), + rootItem, SLOT(setWidth(int))); + q->connect(q, SIGNAL(heightChanged(int)), + rootItem, SLOT(setHeight(int))); + rootItem->setWidth(q->width()); + rootItem->setHeight(q->height()); +} + void QQuickCanvasPrivate::transformTouchPoints(QList<QTouchEvent::TouchPoint> &touchPoints, const QTransform &transform) { for (int i=0; i<touchPoints.count(); i++) { @@ -815,6 +832,14 @@ void QQuickCanvasPrivate::cleanup(QSGNode *n) /*! + \qmlclass Window QQuickCanvas + \inqmlmodule QtQuick.Window 2 + \brief The Window object creates a new top-level window. + + The Window object creates a new top-level window for a QtQuick scene. It automatically sets up the + window for use with QtQuick 2.0 graphical elements. +*/ +/*! \class QQuickCanvas \since QtQuick 2.0 \brief The QQuickCanvas class provides the canvas for displaying a graphical QML scene @@ -894,6 +919,14 @@ QQuickItem *QQuickCanvas::mouseGrabberItem() const } +/*! + \qmlproperty color QtQuick2.Window::Window::color + + The background color for the window. + + Setting this property is more efficient than using a separate Rectangle. +*/ + bool QQuickCanvasPrivate::clearHover() { if (hoverItems.isEmpty()) @@ -2131,7 +2164,10 @@ QSGTexture *QQuickCanvas::createTextureFromId(uint id, const QSize &size, Create void QQuickCanvas::setClearColor(const QColor &color) { + if (color == d_func()->clearColor) + return; d_func()->clearColor = color; + emit clearColorChanged(color); } |