aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorDamian Jansen <damian.jansen@nokia.com>2011-08-30 16:18:20 +1000
committerQt by Nokia <qt-info@nokia.com>2011-09-05 03:09:09 +0200
commit76dd4f8af9c48a685cb50bfa02389b392bc12a5a (patch)
tree959044545ec8b8b5d6ef40489c02d4885d4ec619 /examples
parentf22ae0f5f18a354bf3addd8023ad8b8810e42bac (diff)
Update extension tutorials and examples to QtQuick2
Also add missing licence header and update example tests Change-Id: Ic2dc8c893ddf22f646eaeba86b6f3b4a2772726c Reviewed-on: http://codereview.qt.nokia.com/3844 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Glenn Watson <glenn.watson@nokia.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/declarative/cppextensions/imageprovider/imageprovider-example.qml6
-rw-r--r--examples/declarative/cppextensions/imageprovider/imageprovider.cpp3
-rw-r--r--examples/declarative/cppextensions/imageprovider/imageprovider.pro2
-rw-r--r--examples/declarative/cppextensions/networkaccessmanagerfactory/main.cpp4
-rw-r--r--examples/declarative/cppextensions/networkaccessmanagerfactory/networkaccessmanagerfactory.pro2
-rw-r--r--examples/declarative/cppextensions/networkaccessmanagerfactory/view.qml2
-rw-r--r--examples/declarative/cppextensions/plugins/README2
-rw-r--r--examples/declarative/cppextensions/plugins/com/nokia/TimeExample/Clock.qml2
-rw-r--r--examples/declarative/cppextensions/plugins/plugins.qml1
-rw-r--r--examples/declarative/cppextensions/referenceexamples/methods/example.qml2
-rw-r--r--examples/declarative/dragtarget/text/dragtext.qml40
-rw-r--r--examples/declarative/tutorials/extending/chapter1-basics/app.qml2
-rw-r--r--examples/declarative/tutorials/extending/chapter1-basics/chapter1-basics.pro2
-rw-r--r--examples/declarative/tutorials/extending/chapter1-basics/main.cpp6
-rw-r--r--examples/declarative/tutorials/extending/chapter1-basics/piechart.cpp10
-rw-r--r--examples/declarative/tutorials/extending/chapter1-basics/piechart.h8
-rw-r--r--examples/declarative/tutorials/extending/chapter2-methods/app.qml2
-rw-r--r--examples/declarative/tutorials/extending/chapter2-methods/chapter2-methods.pro2
-rw-r--r--examples/declarative/tutorials/extending/chapter2-methods/main.cpp6
-rw-r--r--examples/declarative/tutorials/extending/chapter2-methods/piechart.cpp11
-rw-r--r--examples/declarative/tutorials/extending/chapter2-methods/piechart.h8
-rw-r--r--examples/declarative/tutorials/extending/chapter3-bindings/app.qml2
-rw-r--r--examples/declarative/tutorials/extending/chapter3-bindings/chapter3-bindings.pro2
-rw-r--r--examples/declarative/tutorials/extending/chapter3-bindings/main.cpp6
-rw-r--r--examples/declarative/tutorials/extending/chapter3-bindings/piechart.cpp11
-rw-r--r--examples/declarative/tutorials/extending/chapter3-bindings/piechart.h8
-rw-r--r--examples/declarative/tutorials/extending/chapter4-customPropertyTypes/app.qml2
-rw-r--r--examples/declarative/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pro2
-rw-r--r--examples/declarative/tutorials/extending/chapter4-customPropertyTypes/main.cpp6
-rw-r--r--examples/declarative/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp6
-rw-r--r--examples/declarative/tutorials/extending/chapter4-customPropertyTypes/piechart.h6
-rw-r--r--examples/declarative/tutorials/extending/chapter4-customPropertyTypes/pieslice.cpp10
-rw-r--r--examples/declarative/tutorials/extending/chapter4-customPropertyTypes/pieslice.h8
-rw-r--r--examples/declarative/tutorials/extending/chapter5-listproperties/app.qml2
-rw-r--r--examples/declarative/tutorials/extending/chapter5-listproperties/chapter5-listproperties.pro2
-rw-r--r--examples/declarative/tutorials/extending/chapter5-listproperties/main.cpp6
-rw-r--r--examples/declarative/tutorials/extending/chapter5-listproperties/piechart.cpp4
-rw-r--r--examples/declarative/tutorials/extending/chapter5-listproperties/piechart.h6
-rw-r--r--examples/declarative/tutorials/extending/chapter5-listproperties/pieslice.cpp10
-rw-r--r--examples/declarative/tutorials/extending/chapter5-listproperties/pieslice.h8
-rw-r--r--examples/declarative/tutorials/extending/chapter6-plugins/ChartsPlugin/qmldir1
-rw-r--r--examples/declarative/tutorials/extending/chapter6-plugins/app.qml3
-rw-r--r--examples/declarative/tutorials/extending/chapter6-plugins/chapter6-plugins.pro11
-rw-r--r--examples/declarative/tutorials/extending/chapter6-plugins/piechart.cpp4
-rw-r--r--examples/declarative/tutorials/extending/chapter6-plugins/piechart.h6
-rw-r--r--examples/declarative/tutorials/extending/chapter6-plugins/pieslice.cpp10
-rw-r--r--examples/declarative/tutorials/extending/chapter6-plugins/pieslice.h8
-rw-r--r--examples/declarative/tutorials/extending/chapter6-plugins/qmldir1
48 files changed, 147 insertions, 127 deletions
diff --git a/examples/declarative/cppextensions/imageprovider/imageprovider-example.qml b/examples/declarative/cppextensions/imageprovider/imageprovider-example.qml
index f8f7b0ee55..f4e374191f 100644
--- a/examples/declarative/cppextensions/imageprovider/imageprovider-example.qml
+++ b/examples/declarative/cppextensions/imageprovider/imageprovider-example.qml
@@ -37,13 +37,13 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-import QtQuick 1.0
+import QtQuick 2.0
import "ImageProviderCore" // import the plugin that registers the color image provider
//![0]
Column {
- Image { source: "source://colors/yellow" }
- Image { source: "source://colors/red" }
+ Image { source: "image://colors/yellow" }
+ Image { source: "image://colors/red" }
}
//![0]
diff --git a/examples/declarative/cppextensions/imageprovider/imageprovider.cpp b/examples/declarative/cppextensions/imageprovider/imageprovider.cpp
index 730ce4b2b6..5078a97b44 100644
--- a/examples/declarative/cppextensions/imageprovider/imageprovider.cpp
+++ b/examples/declarative/cppextensions/imageprovider/imageprovider.cpp
@@ -42,10 +42,7 @@
#include <qdeclarativeextensionplugin.h>
#include <qdeclarativeengine.h>
-#include <qdeclarative.h>
-#include <qdeclarativeitem.h>
#include <qdeclarativeimageprovider.h>
-#include <qdeclarativeview.h>
#include <QImage>
#include <QPainter>
diff --git a/examples/declarative/cppextensions/imageprovider/imageprovider.pro b/examples/declarative/cppextensions/imageprovider/imageprovider.pro
index 5a915034dc..eaa48cd901 100644
--- a/examples/declarative/cppextensions/imageprovider/imageprovider.pro
+++ b/examples/declarative/cppextensions/imageprovider/imageprovider.pro
@@ -1,6 +1,6 @@
TEMPLATE = lib
CONFIG += qt plugin
-QT += declarative qtquick1
+QT += declarative
DESTDIR = ImageProviderCore
TARGET = qmlimageproviderplugin
diff --git a/examples/declarative/cppextensions/networkaccessmanagerfactory/main.cpp b/examples/declarative/cppextensions/networkaccessmanagerfactory/main.cpp
index 665feac8e3..2da6e3c8fe 100644
--- a/examples/declarative/cppextensions/networkaccessmanagerfactory/main.cpp
+++ b/examples/declarative/cppextensions/networkaccessmanagerfactory/main.cpp
@@ -44,7 +44,7 @@
#include <QDeclarativeEngine>
#include <QDeclarativeNetworkAccessManagerFactory>
-#include <QDeclarativeView>
+#include <QSGView>
/*
@@ -97,7 +97,7 @@ int main(int argc, char ** argv)
}
}
- QDeclarativeView view;
+ QSGView view;
view.engine()->setNetworkAccessManagerFactory(new MyNetworkAccessManagerFactory);
view.setSource(source);
diff --git a/examples/declarative/cppextensions/networkaccessmanagerfactory/networkaccessmanagerfactory.pro b/examples/declarative/cppextensions/networkaccessmanagerfactory/networkaccessmanagerfactory.pro
index ba0498eaf8..74d8db321d 100644
--- a/examples/declarative/cppextensions/networkaccessmanagerfactory/networkaccessmanagerfactory.pro
+++ b/examples/declarative/cppextensions/networkaccessmanagerfactory/networkaccessmanagerfactory.pro
@@ -2,7 +2,7 @@ TEMPLATE = app
TARGET = networkaccessmanagerfactory
DEPENDPATH += .
INCLUDEPATH += .
-QT += declarative network qtquick1
+QT += declarative network
# Input
SOURCES += main.cpp
diff --git a/examples/declarative/cppextensions/networkaccessmanagerfactory/view.qml b/examples/declarative/cppextensions/networkaccessmanagerfactory/view.qml
index e002ef60e3..e335396f88 100644
--- a/examples/declarative/cppextensions/networkaccessmanagerfactory/view.qml
+++ b/examples/declarative/cppextensions/networkaccessmanagerfactory/view.qml
@@ -38,7 +38,7 @@
**
****************************************************************************/
-import QtQuick 1.0
+import QtQuick 2.0
Image {
width: 100
diff --git a/examples/declarative/cppextensions/plugins/README b/examples/declarative/cppextensions/plugins/README
index 95e0eea849..f4f9074059 100644
--- a/examples/declarative/cppextensions/plugins/README
+++ b/examples/declarative/cppextensions/plugins/README
@@ -5,5 +5,5 @@ by a C++ plugin (providing the "Time" type), and by QML files (providing the
To run:
make install
- qmlviewer -I . plugins.qml
+ QML_IMPORT_PATH=$PWD qmlscene plugins.qml
diff --git a/examples/declarative/cppextensions/plugins/com/nokia/TimeExample/Clock.qml b/examples/declarative/cppextensions/plugins/com/nokia/TimeExample/Clock.qml
index 465f164dae..59a78946ca 100644
--- a/examples/declarative/cppextensions/plugins/com/nokia/TimeExample/Clock.qml
+++ b/examples/declarative/cppextensions/plugins/com/nokia/TimeExample/Clock.qml
@@ -38,7 +38,7 @@
**
****************************************************************************/
-import QtQuick 1.0
+import QtQuick 2.0
Rectangle {
id: clock
diff --git a/examples/declarative/cppextensions/plugins/plugins.qml b/examples/declarative/cppextensions/plugins/plugins.qml
index a61af15c9f..4a6f25fe7c 100644
--- a/examples/declarative/cppextensions/plugins/plugins.qml
+++ b/examples/declarative/cppextensions/plugins/plugins.qml
@@ -48,5 +48,6 @@ Clock { // this class is defined in QML (com/nokia/TimeExample/Clock.qml)
hours: time.hour
minutes: time.minute
+
}
//![0]
diff --git a/examples/declarative/cppextensions/referenceexamples/methods/example.qml b/examples/declarative/cppextensions/referenceexamples/methods/example.qml
index 868473a7c4..c32ce4a786 100644
--- a/examples/declarative/cppextensions/referenceexamples/methods/example.qml
+++ b/examples/declarative/cppextensions/referenceexamples/methods/example.qml
@@ -38,7 +38,7 @@
**
****************************************************************************/
-import QtQuick 1.0
+import QtQuick 2.0
import People 1.0
// ![0]
diff --git a/examples/declarative/dragtarget/text/dragtext.qml b/examples/declarative/dragtarget/text/dragtext.qml
index c4a4f24f74..49858d1fc4 100644
--- a/examples/declarative/dragtarget/text/dragtext.qml
+++ b/examples/declarative/dragtarget/text/dragtext.qml
@@ -1,3 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
import QtQuick 2.0
Item {
diff --git a/examples/declarative/tutorials/extending/chapter1-basics/app.qml b/examples/declarative/tutorials/extending/chapter1-basics/app.qml
index f42ec1e8fc..92dd147bab 100644
--- a/examples/declarative/tutorials/extending/chapter1-basics/app.qml
+++ b/examples/declarative/tutorials/extending/chapter1-basics/app.qml
@@ -39,7 +39,7 @@
****************************************************************************/
//![0]
import Charts 1.0
-import QtQuick 1.0
+import QtQuick 2.0
Item {
width: 300; height: 200
diff --git a/examples/declarative/tutorials/extending/chapter1-basics/chapter1-basics.pro b/examples/declarative/tutorials/extending/chapter1-basics/chapter1-basics.pro
index 77cc4cdfca..0f0416718c 100644
--- a/examples/declarative/tutorials/extending/chapter1-basics/chapter1-basics.pro
+++ b/examples/declarative/tutorials/extending/chapter1-basics/chapter1-basics.pro
@@ -1,4 +1,4 @@
-QT += declarative qtquick1
+QT += declarative
HEADERS += piechart.h
SOURCES += piechart.cpp \
diff --git a/examples/declarative/tutorials/extending/chapter1-basics/main.cpp b/examples/declarative/tutorials/extending/chapter1-basics/main.cpp
index 2ab2e2b8b9..4c11768e18 100644
--- a/examples/declarative/tutorials/extending/chapter1-basics/main.cpp
+++ b/examples/declarative/tutorials/extending/chapter1-basics/main.cpp
@@ -39,8 +39,7 @@
****************************************************************************/
//![0]
#include "piechart.h"
-#include <qdeclarative.h>
-#include <QDeclarativeView>
+#include <QSGView>
#include <QApplication>
int main(int argc, char *argv[])
@@ -49,7 +48,8 @@ int main(int argc, char *argv[])
qmlRegisterType<PieChart>("Charts", 1, 0, "PieChart");
- QDeclarativeView view;
+ QSGView view;
+ view.setResizeMode(QSGView::SizeRootObjectToView);
view.setSource(QUrl::fromLocalFile("app.qml"));
view.show();
return app.exec();
diff --git a/examples/declarative/tutorials/extending/chapter1-basics/piechart.cpp b/examples/declarative/tutorials/extending/chapter1-basics/piechart.cpp
index bfc1645f57..5820c5626c 100644
--- a/examples/declarative/tutorials/extending/chapter1-basics/piechart.cpp
+++ b/examples/declarative/tutorials/extending/chapter1-basics/piechart.cpp
@@ -41,11 +41,9 @@
#include <QPainter>
//![0]
-PieChart::PieChart(QDeclarativeItem *parent)
- : QDeclarativeItem(parent)
+PieChart::PieChart(QSGItem *parent)
+ : QSGPaintedItem(parent)
{
- // need to disable this flag to draw inside a QDeclarativeItem
- setFlag(QGraphicsItem::ItemHasNoContents, false);
}
//![0]
@@ -70,11 +68,11 @@ void PieChart::setColor(const QColor &color)
}
//![1]
-void PieChart::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
+void PieChart::paint(QPainter *painter)
{
QPen pen(m_color, 2);
painter->setPen(pen);
- painter->setRenderHints(QPainter::Antialiasing, true);
+ painter->setRenderHints(QPainter::HighQualityAntialiasing, true);
painter->drawPie(boundingRect(), 90 * 16, 290 * 16);
}
//![1]
diff --git a/examples/declarative/tutorials/extending/chapter1-basics/piechart.h b/examples/declarative/tutorials/extending/chapter1-basics/piechart.h
index c873f6a780..a5afec5252 100644
--- a/examples/declarative/tutorials/extending/chapter1-basics/piechart.h
+++ b/examples/declarative/tutorials/extending/chapter1-basics/piechart.h
@@ -41,17 +41,17 @@
#define PIECHART_H
//![0]
-#include <QDeclarativeItem>
+#include <QtDeclarative/QSGPaintedItem>
#include <QColor>
-class PieChart : public QDeclarativeItem
+class PieChart : public QSGPaintedItem
{
Q_OBJECT
Q_PROPERTY(QString name READ name WRITE setName)
Q_PROPERTY(QColor color READ color WRITE setColor)
public:
- PieChart(QDeclarativeItem *parent = 0);
+ PieChart(QSGItem *parent = 0);
QString name() const;
void setName(const QString &name);
@@ -59,7 +59,7 @@ public:
QColor color() const;
void setColor(const QColor &color);
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
+ void paint(QPainter *painter);
private:
QString m_name;
diff --git a/examples/declarative/tutorials/extending/chapter2-methods/app.qml b/examples/declarative/tutorials/extending/chapter2-methods/app.qml
index e2f34c7f7b..05f5952fd6 100644
--- a/examples/declarative/tutorials/extending/chapter2-methods/app.qml
+++ b/examples/declarative/tutorials/extending/chapter2-methods/app.qml
@@ -39,7 +39,7 @@
****************************************************************************/
//![0]
import Charts 1.0
-import QtQuick 1.0
+import QtQuick 2.0
Item {
width: 300; height: 200
diff --git a/examples/declarative/tutorials/extending/chapter2-methods/chapter2-methods.pro b/examples/declarative/tutorials/extending/chapter2-methods/chapter2-methods.pro
index 77cc4cdfca..0f0416718c 100644
--- a/examples/declarative/tutorials/extending/chapter2-methods/chapter2-methods.pro
+++ b/examples/declarative/tutorials/extending/chapter2-methods/chapter2-methods.pro
@@ -1,4 +1,4 @@
-QT += declarative qtquick1
+QT += declarative
HEADERS += piechart.h
SOURCES += piechart.cpp \
diff --git a/examples/declarative/tutorials/extending/chapter2-methods/main.cpp b/examples/declarative/tutorials/extending/chapter2-methods/main.cpp
index 2ab2e2b8b9..4c11768e18 100644
--- a/examples/declarative/tutorials/extending/chapter2-methods/main.cpp
+++ b/examples/declarative/tutorials/extending/chapter2-methods/main.cpp
@@ -39,8 +39,7 @@
****************************************************************************/
//![0]
#include "piechart.h"
-#include <qdeclarative.h>
-#include <QDeclarativeView>
+#include <QSGView>
#include <QApplication>
int main(int argc, char *argv[])
@@ -49,7 +48,8 @@ int main(int argc, char *argv[])
qmlRegisterType<PieChart>("Charts", 1, 0, "PieChart");
- QDeclarativeView view;
+ QSGView view;
+ view.setResizeMode(QSGView::SizeRootObjectToView);
view.setSource(QUrl::fromLocalFile("app.qml"));
view.show();
return app.exec();
diff --git a/examples/declarative/tutorials/extending/chapter2-methods/piechart.cpp b/examples/declarative/tutorials/extending/chapter2-methods/piechart.cpp
index 78970e536f..86407f1f17 100644
--- a/examples/declarative/tutorials/extending/chapter2-methods/piechart.cpp
+++ b/examples/declarative/tutorials/extending/chapter2-methods/piechart.cpp
@@ -39,13 +39,10 @@
****************************************************************************/
#include "piechart.h"
#include <QPainter>
-#include <QDebug>
-PieChart::PieChart(QDeclarativeItem *parent)
- : QDeclarativeItem(parent)
+PieChart::PieChart(QSGItem *parent)
+ : QSGPaintedItem(parent)
{
- // need to disable this flag to draw inside a QDeclarativeItem
- setFlag(QGraphicsItem::ItemHasNoContents, false);
}
QString PieChart::name() const
@@ -68,11 +65,11 @@ void PieChart::setColor(const QColor &color)
m_color = color;
}
-void PieChart::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
+void PieChart::paint(QPainter *painter)
{
QPen pen(m_color, 2);
painter->setPen(pen);
- painter->setRenderHints(QPainter::Antialiasing, true);
+ painter->setRenderHints(QPainter::HighQualityAntialiasing, true);
painter->drawPie(boundingRect(), 90 * 16, 290 * 16);
}
diff --git a/examples/declarative/tutorials/extending/chapter2-methods/piechart.h b/examples/declarative/tutorials/extending/chapter2-methods/piechart.h
index bfcbd80ab1..38f5c0553f 100644
--- a/examples/declarative/tutorials/extending/chapter2-methods/piechart.h
+++ b/examples/declarative/tutorials/extending/chapter2-methods/piechart.h
@@ -40,11 +40,11 @@
#ifndef PIECHART_H
#define PIECHART_H
-#include <QDeclarativeItem>
+#include <QtDeclarative/QSGPaintedItem>
#include <QColor>
//![0]
-class PieChart : public QDeclarativeItem
+class PieChart : public QSGPaintedItem
{
//![0]
Q_OBJECT
@@ -55,7 +55,7 @@ class PieChart : public QDeclarativeItem
public:
//![1]
- PieChart(QDeclarativeItem *parent = 0);
+ PieChart(QSGItem *parent = 0);
QString name() const;
void setName(const QString &name);
@@ -63,7 +63,7 @@ public:
QColor color() const;
void setColor(const QColor &color);
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
+ void paint(QPainter *painter);
//![2]
Q_INVOKABLE void clearChart();
diff --git a/examples/declarative/tutorials/extending/chapter3-bindings/app.qml b/examples/declarative/tutorials/extending/chapter3-bindings/app.qml
index b4ad5efb56..996a828c34 100644
--- a/examples/declarative/tutorials/extending/chapter3-bindings/app.qml
+++ b/examples/declarative/tutorials/extending/chapter3-bindings/app.qml
@@ -39,7 +39,7 @@
****************************************************************************/
//![0]
import Charts 1.0
-import QtQuick 1.0
+import QtQuick 2.0
Item {
width: 300; height: 200
diff --git a/examples/declarative/tutorials/extending/chapter3-bindings/chapter3-bindings.pro b/examples/declarative/tutorials/extending/chapter3-bindings/chapter3-bindings.pro
index 77cc4cdfca..0f0416718c 100644
--- a/examples/declarative/tutorials/extending/chapter3-bindings/chapter3-bindings.pro
+++ b/examples/declarative/tutorials/extending/chapter3-bindings/chapter3-bindings.pro
@@ -1,4 +1,4 @@
-QT += declarative qtquick1
+QT += declarative
HEADERS += piechart.h
SOURCES += piechart.cpp \
diff --git a/examples/declarative/tutorials/extending/chapter3-bindings/main.cpp b/examples/declarative/tutorials/extending/chapter3-bindings/main.cpp
index 2ab2e2b8b9..4c11768e18 100644
--- a/examples/declarative/tutorials/extending/chapter3-bindings/main.cpp
+++ b/examples/declarative/tutorials/extending/chapter3-bindings/main.cpp
@@ -39,8 +39,7 @@
****************************************************************************/
//![0]
#include "piechart.h"
-#include <qdeclarative.h>
-#include <QDeclarativeView>
+#include <QSGView>
#include <QApplication>
int main(int argc, char *argv[])
@@ -49,7 +48,8 @@ int main(int argc, char *argv[])
qmlRegisterType<PieChart>("Charts", 1, 0, "PieChart");
- QDeclarativeView view;
+ QSGView view;
+ view.setResizeMode(QSGView::SizeRootObjectToView);
view.setSource(QUrl::fromLocalFile("app.qml"));
view.show();
return app.exec();
diff --git a/examples/declarative/tutorials/extending/chapter3-bindings/piechart.cpp b/examples/declarative/tutorials/extending/chapter3-bindings/piechart.cpp
index 375025e694..86ad6a7fe0 100644
--- a/examples/declarative/tutorials/extending/chapter3-bindings/piechart.cpp
+++ b/examples/declarative/tutorials/extending/chapter3-bindings/piechart.cpp
@@ -39,13 +39,10 @@
****************************************************************************/
#include "piechart.h"
#include <QPainter>
-#include <QDebug>
-PieChart::PieChart(QDeclarativeItem *parent)
- : QDeclarativeItem(parent)
+PieChart::PieChart(QSGItem *parent)
+ : QSGPaintedItem(parent)
{
- // need to disable this flag to draw inside a QDeclarativeItem
- setFlag(QGraphicsItem::ItemHasNoContents, false);
}
QString PieChart::name() const
@@ -74,11 +71,11 @@ void PieChart::setColor(const QColor &color)
}
//![0]
-void PieChart::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
+void PieChart::paint(QPainter *painter)
{
QPen pen(m_color, 2);
painter->setPen(pen);
- painter->setRenderHints(QPainter::Antialiasing, true);
+ painter->setRenderHints(QPainter::HighQualityAntialiasing, true);
painter->drawPie(boundingRect(), 90 * 16, 290 * 16);
}
diff --git a/examples/declarative/tutorials/extending/chapter3-bindings/piechart.h b/examples/declarative/tutorials/extending/chapter3-bindings/piechart.h
index feff9c42fb..5208f81d27 100644
--- a/examples/declarative/tutorials/extending/chapter3-bindings/piechart.h
+++ b/examples/declarative/tutorials/extending/chapter3-bindings/piechart.h
@@ -40,11 +40,11 @@
#ifndef PIECHART_H
#define PIECHART_H
-#include <QDeclarativeItem>
#include <QColor>
+#include <QtDeclarative/QSGPaintedItem>
//![0]
-class PieChart : public QDeclarativeItem
+class PieChart : public QSGPaintedItem
{
//![0]
Q_OBJECT
@@ -55,7 +55,7 @@ class PieChart : public QDeclarativeItem
public:
//![1]
- PieChart(QDeclarativeItem *parent = 0);
+ PieChart(QSGItem *parent = 0);
QString name() const;
void setName(const QString &name);
@@ -63,7 +63,7 @@ public:
QColor color() const;
void setColor(const QColor &color);
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
+ void paint(QPainter *painter);
Q_INVOKABLE void clearChart();
diff --git a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/app.qml b/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/app.qml
index 187095a769..68f667a812 100644
--- a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/app.qml
+++ b/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/app.qml
@@ -39,7 +39,7 @@
****************************************************************************/
//![0]
import Charts 1.0
-import QtQuick 1.0
+import QtQuick 2.0
Item {
width: 300; height: 200
diff --git a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pro b/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pro
index 9942ccd0a9..c3f5402aea 100644
--- a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pro
+++ b/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pro
@@ -1,4 +1,4 @@
-QT += declarative qtquick1
+QT += declarative
HEADERS += piechart.h \
pieslice.h
diff --git a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/main.cpp b/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/main.cpp
index dcb3481ac1..1113cc55cb 100644
--- a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/main.cpp
+++ b/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/main.cpp
@@ -40,8 +40,7 @@
#include "piechart.h"
#include "pieslice.h"
-#include <qdeclarative.h>
-#include <QDeclarativeView>
+#include <QSGView>
#include <QApplication>
//![0]
@@ -56,7 +55,8 @@ int main(int argc, char *argv[])
qmlRegisterType<PieSlice>("Charts", 1, 0, "PieSlice");
//![1]
- QDeclarativeView view;
+ QSGView view;
+ view.setResizeMode(QSGView::SizeRootObjectToView);
view.setSource(QUrl::fromLocalFile("app.qml"));
view.show();
return app.exec();
diff --git a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp b/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp
index b1f4278a95..5911f4dd49 100644
--- a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp
+++ b/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp
@@ -40,11 +40,9 @@
#include "piechart.h"
#include "pieslice.h"
-PieChart::PieChart(QDeclarativeItem *parent)
- : QDeclarativeItem(parent)
+PieChart::PieChart(QSGItem *parent)
+ : QSGItem(parent)
{
- // this doesn't need to disable QGraphicsItem::ItemHasNoContents
- // anymore since the drawing is now done in PieSlice
}
QString PieChart::name() const
diff --git a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/piechart.h b/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/piechart.h
index d7f4473ef0..9e8139846b 100644
--- a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/piechart.h
+++ b/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/piechart.h
@@ -40,12 +40,12 @@
#ifndef PIECHART_H
#define PIECHART_H
-#include <QDeclarativeItem>
+#include <QtDeclarative/QSGItem>
class PieSlice;
//![0]
-class PieChart : public QDeclarativeItem
+class PieChart : public QSGItem
{
Q_OBJECT
Q_PROPERTY(PieSlice* pieSlice READ pieSlice WRITE setPieSlice)
@@ -56,7 +56,7 @@ class PieChart : public QDeclarativeItem
public:
//![1]
- PieChart(QDeclarativeItem *parent = 0);
+ PieChart(QSGItem *parent = 0);
QString name() const;
void setName(const QString &name);
diff --git a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/pieslice.cpp b/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/pieslice.cpp
index f36c8ce3f4..764ef23944 100644
--- a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/pieslice.cpp
+++ b/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/pieslice.cpp
@@ -41,11 +41,9 @@
#include <QPainter>
-PieSlice::PieSlice(QDeclarativeItem *parent)
- : QDeclarativeItem(parent)
+PieSlice::PieSlice(QSGItem *parent)
+ : QSGPaintedItem(parent)
{
- // need to disable this flag to draw inside a QDeclarativeItem
- setFlag(QGraphicsItem::ItemHasNoContents, false);
}
QColor PieSlice::color() const
@@ -58,11 +56,11 @@ void PieSlice::setColor(const QColor &color)
m_color = color;
}
-void PieSlice::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
+void PieSlice::paint(QPainter *painter)
{
QPen pen(m_color, 2);
painter->setPen(pen);
- painter->setRenderHints(QPainter::Antialiasing, true);
+ painter->setRenderHints(QPainter::HighQualityAntialiasing, true);
painter->drawPie(boundingRect(), 90 * 16, 290 * 16);
}
diff --git a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/pieslice.h b/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/pieslice.h
index 6e5707f3e3..7163864fac 100644
--- a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/pieslice.h
+++ b/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/pieslice.h
@@ -40,22 +40,22 @@
#ifndef PIESLICE_H
#define PIESLICE_H
-#include <QDeclarativeItem>
+#include <QtDeclarative/QSGPaintedItem>
#include <QColor>
//![0]
-class PieSlice : public QDeclarativeItem
+class PieSlice : public QSGPaintedItem
{
Q_OBJECT
Q_PROPERTY(QColor color READ color WRITE setColor)
public:
- PieSlice(QDeclarativeItem *parent = 0);
+ PieSlice(QSGItem *parent = 0);
QColor color() const;
void setColor(const QColor &color);
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
+ void paint(QPainter *painter);
private:
QColor m_color;
diff --git a/examples/declarative/tutorials/extending/chapter5-listproperties/app.qml b/examples/declarative/tutorials/extending/chapter5-listproperties/app.qml
index 0fc8558187..99bc1c5d2d 100644
--- a/examples/declarative/tutorials/extending/chapter5-listproperties/app.qml
+++ b/examples/declarative/tutorials/extending/chapter5-listproperties/app.qml
@@ -39,7 +39,7 @@
****************************************************************************/
//![0]
import Charts 1.0
-import QtQuick 1.0
+import QtQuick 2.0
Item {
width: 300; height: 200
diff --git a/examples/declarative/tutorials/extending/chapter5-listproperties/chapter5-listproperties.pro b/examples/declarative/tutorials/extending/chapter5-listproperties/chapter5-listproperties.pro
index 9942ccd0a9..c3f5402aea 100644
--- a/examples/declarative/tutorials/extending/chapter5-listproperties/chapter5-listproperties.pro
+++ b/examples/declarative/tutorials/extending/chapter5-listproperties/chapter5-listproperties.pro
@@ -1,4 +1,4 @@
-QT += declarative qtquick1
+QT += declarative
HEADERS += piechart.h \
pieslice.h
diff --git a/examples/declarative/tutorials/extending/chapter5-listproperties/main.cpp b/examples/declarative/tutorials/extending/chapter5-listproperties/main.cpp
index 5a50567e35..1c43a090ca 100644
--- a/examples/declarative/tutorials/extending/chapter5-listproperties/main.cpp
+++ b/examples/declarative/tutorials/extending/chapter5-listproperties/main.cpp
@@ -40,8 +40,7 @@
#include "piechart.h"
#include "pieslice.h"
-#include <qdeclarative.h>
-#include <QDeclarativeView>
+#include <QSGView>
#include <QApplication>
int main(int argc, char *argv[])
@@ -51,7 +50,8 @@ int main(int argc, char *argv[])
qmlRegisterType<PieChart>("Charts", 1, 0, "PieChart");
qmlRegisterType<PieSlice>("Charts", 1, 0, "PieSlice");
- QDeclarativeView view;
+ QSGView view;
+ view.setResizeMode(QSGView::SizeRootObjectToView);
view.setSource(QUrl::fromLocalFile("app.qml"));
view.show();
return app.exec();
diff --git a/examples/declarative/tutorials/extending/chapter5-listproperties/piechart.cpp b/examples/declarative/tutorials/extending/chapter5-listproperties/piechart.cpp
index ea70ff2f76..248f4a2096 100644
--- a/examples/declarative/tutorials/extending/chapter5-listproperties/piechart.cpp
+++ b/examples/declarative/tutorials/extending/chapter5-listproperties/piechart.cpp
@@ -40,8 +40,8 @@
#include "piechart.h"
#include "pieslice.h"
-PieChart::PieChart(QDeclarativeItem *parent)
- : QDeclarativeItem(parent)
+PieChart::PieChart(QSGItem *parent)
+ : QSGItem(parent)
{
}
diff --git a/examples/declarative/tutorials/extending/chapter5-listproperties/piechart.h b/examples/declarative/tutorials/extending/chapter5-listproperties/piechart.h
index ad15a24161..e95b02f38c 100644
--- a/examples/declarative/tutorials/extending/chapter5-listproperties/piechart.h
+++ b/examples/declarative/tutorials/extending/chapter5-listproperties/piechart.h
@@ -40,12 +40,12 @@
#ifndef PIECHART_H
#define PIECHART_H
-#include <QDeclarativeItem>
+#include <QSGItem>
class PieSlice;
//![0]
-class PieChart : public QDeclarativeItem
+class PieChart : public QSGItem
{
Q_OBJECT
Q_PROPERTY(QDeclarativeListProperty<PieSlice> slices READ slices)
@@ -55,7 +55,7 @@ class PieChart : public QDeclarativeItem
//![1]
public:
//![1]
- PieChart(QDeclarativeItem *parent = 0);
+ PieChart(QSGItem *parent = 0);
QString name() const;
void setName(const QString &name);
diff --git a/examples/declarative/tutorials/extending/chapter5-listproperties/pieslice.cpp b/examples/declarative/tutorials/extending/chapter5-listproperties/pieslice.cpp
index 16f4bae11b..70338f08a0 100644
--- a/examples/declarative/tutorials/extending/chapter5-listproperties/pieslice.cpp
+++ b/examples/declarative/tutorials/extending/chapter5-listproperties/pieslice.cpp
@@ -41,11 +41,9 @@
#include <QPainter>
-PieSlice::PieSlice(QDeclarativeItem *parent)
- : QDeclarativeItem(parent)
+PieSlice::PieSlice(QSGItem *parent)
+ : QSGPaintedItem(parent)
{
- // need to disable this flag to draw inside a QDeclarativeItem
- setFlag(QGraphicsItem::ItemHasNoContents, false);
}
QColor PieSlice::color() const
@@ -78,11 +76,11 @@ void PieSlice::setAngleSpan(int angle)
m_angleSpan = angle;
}
-void PieSlice::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
+void PieSlice::paint(QPainter *painter)
{
QPen pen(m_color, 2);
painter->setPen(pen);
- painter->setRenderHints(QPainter::Antialiasing, true);
+ painter->setRenderHints(QPainter::HighQualityAntialiasing, true);
painter->drawPie(boundingRect(), m_fromAngle * 16, m_angleSpan * 16);
}
diff --git a/examples/declarative/tutorials/extending/chapter5-listproperties/pieslice.h b/examples/declarative/tutorials/extending/chapter5-listproperties/pieslice.h
index 877f54b10f..1204f9adf2 100644
--- a/examples/declarative/tutorials/extending/chapter5-listproperties/pieslice.h
+++ b/examples/declarative/tutorials/extending/chapter5-listproperties/pieslice.h
@@ -40,11 +40,11 @@
#ifndef PIESLICE_H
#define PIESLICE_H
-#include <QDeclarativeItem>
+#include <QtDeclarative/QSGPaintedItem>
#include <QColor>
//![0]
-class PieSlice : public QDeclarativeItem
+class PieSlice : public QSGPaintedItem
{
Q_OBJECT
Q_PROPERTY(QColor color READ color WRITE setColor)
@@ -53,7 +53,7 @@ class PieSlice : public QDeclarativeItem
//![0]
public:
- PieSlice(QDeclarativeItem *parent = 0);
+ PieSlice(QSGItem *parent = 0);
QColor color() const;
void setColor(const QColor &color);
@@ -64,7 +64,7 @@ public:
int angleSpan() const;
void setAngleSpan(int span);
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
+ void paint(QPainter *painter);
private:
QColor m_color;
diff --git a/examples/declarative/tutorials/extending/chapter6-plugins/ChartsPlugin/qmldir b/examples/declarative/tutorials/extending/chapter6-plugins/ChartsPlugin/qmldir
new file mode 100644
index 0000000000..72650d8243
--- /dev/null
+++ b/examples/declarative/tutorials/extending/chapter6-plugins/ChartsPlugin/qmldir
@@ -0,0 +1 @@
+plugin chartsplugin \ No newline at end of file
diff --git a/examples/declarative/tutorials/extending/chapter6-plugins/app.qml b/examples/declarative/tutorials/extending/chapter6-plugins/app.qml
index a8e13b2c4a..67df25a1e1 100644
--- a/examples/declarative/tutorials/extending/chapter6-plugins/app.qml
+++ b/examples/declarative/tutorials/extending/chapter6-plugins/app.qml
@@ -37,7 +37,8 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-import QtQuick 1.0
+import QtQuick 2.0
+import "ChartsPlugin" 1.0
Item {
width: 300; height: 200
diff --git a/examples/declarative/tutorials/extending/chapter6-plugins/chapter6-plugins.pro b/examples/declarative/tutorials/extending/chapter6-plugins/chapter6-plugins.pro
index e5963ee3e5..47fe0a2fde 100644
--- a/examples/declarative/tutorials/extending/chapter6-plugins/chapter6-plugins.pro
+++ b/examples/declarative/tutorials/extending/chapter6-plugins/chapter6-plugins.pro
@@ -1,8 +1,10 @@
TEMPLATE = lib
CONFIG += qt plugin
-QT += declarative qtquick1
+QT += declarative
+
+DESTDIR = ChartsPlugin
+TARGET = chartsplugin
-DESTDIR = lib
OBJECTS_DIR = tmp
MOC_DIR = tmp
@@ -14,8 +16,3 @@ SOURCES += piechart.cpp \
pieslice.cpp \
chartsplugin.cpp
-symbian {
- CONFIG += qt_example
- TARGET.EPOCALLOWDLLDATA = 1
-}
-maemo5: CONFIG += qt_example
diff --git a/examples/declarative/tutorials/extending/chapter6-plugins/piechart.cpp b/examples/declarative/tutorials/extending/chapter6-plugins/piechart.cpp
index 27086f1d73..5aa4a78035 100644
--- a/examples/declarative/tutorials/extending/chapter6-plugins/piechart.cpp
+++ b/examples/declarative/tutorials/extending/chapter6-plugins/piechart.cpp
@@ -40,8 +40,8 @@
#include "piechart.h"
#include "pieslice.h"
-PieChart::PieChart(QDeclarativeItem *parent)
- : QDeclarativeItem(parent)
+PieChart::PieChart(QSGItem *parent)
+ : QSGItem(parent)
{
}
diff --git a/examples/declarative/tutorials/extending/chapter6-plugins/piechart.h b/examples/declarative/tutorials/extending/chapter6-plugins/piechart.h
index 1338cad67b..1e4f1226dc 100644
--- a/examples/declarative/tutorials/extending/chapter6-plugins/piechart.h
+++ b/examples/declarative/tutorials/extending/chapter6-plugins/piechart.h
@@ -40,18 +40,18 @@
#ifndef PIECHART_H
#define PIECHART_H
-#include <QDeclarativeItem>
+#include <QSGItem>
class PieSlice;
-class PieChart : public QDeclarativeItem
+class PieChart : public QSGItem
{
Q_OBJECT
Q_PROPERTY(QDeclarativeListProperty<PieSlice> slices READ slices)
Q_PROPERTY(QString name READ name WRITE setName)
public:
- PieChart(QDeclarativeItem *parent = 0);
+ PieChart(QSGItem *parent = 0);
QString name() const;
void setName(const QString &name);
diff --git a/examples/declarative/tutorials/extending/chapter6-plugins/pieslice.cpp b/examples/declarative/tutorials/extending/chapter6-plugins/pieslice.cpp
index 16f4bae11b..70338f08a0 100644
--- a/examples/declarative/tutorials/extending/chapter6-plugins/pieslice.cpp
+++ b/examples/declarative/tutorials/extending/chapter6-plugins/pieslice.cpp
@@ -41,11 +41,9 @@
#include <QPainter>
-PieSlice::PieSlice(QDeclarativeItem *parent)
- : QDeclarativeItem(parent)
+PieSlice::PieSlice(QSGItem *parent)
+ : QSGPaintedItem(parent)
{
- // need to disable this flag to draw inside a QDeclarativeItem
- setFlag(QGraphicsItem::ItemHasNoContents, false);
}
QColor PieSlice::color() const
@@ -78,11 +76,11 @@ void PieSlice::setAngleSpan(int angle)
m_angleSpan = angle;
}
-void PieSlice::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
+void PieSlice::paint(QPainter *painter)
{
QPen pen(m_color, 2);
painter->setPen(pen);
- painter->setRenderHints(QPainter::Antialiasing, true);
+ painter->setRenderHints(QPainter::HighQualityAntialiasing, true);
painter->drawPie(boundingRect(), m_fromAngle * 16, m_angleSpan * 16);
}
diff --git a/examples/declarative/tutorials/extending/chapter6-plugins/pieslice.h b/examples/declarative/tutorials/extending/chapter6-plugins/pieslice.h
index 83b728aaa1..3096ee6570 100644
--- a/examples/declarative/tutorials/extending/chapter6-plugins/pieslice.h
+++ b/examples/declarative/tutorials/extending/chapter6-plugins/pieslice.h
@@ -40,10 +40,10 @@
#ifndef PIESLICE_H
#define PIESLICE_H
-#include <QDeclarativeItem>
+#include <QtDeclarative/QSGPaintedItem>
#include <QColor>
-class PieSlice : public QDeclarativeItem
+class PieSlice : public QSGPaintedItem
{
Q_OBJECT
Q_PROPERTY(QColor color READ color WRITE setColor)
@@ -51,7 +51,7 @@ class PieSlice : public QDeclarativeItem
Q_PROPERTY(int angleSpan READ angleSpan WRITE setAngleSpan)
public:
- PieSlice(QDeclarativeItem *parent = 0);
+ PieSlice(QSGItem *parent = 0);
QColor color() const;
void setColor(const QColor &color);
@@ -62,7 +62,7 @@ public:
int angleSpan() const;
void setAngleSpan(int span);
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
+ void paint(QPainter *painter);
private:
QColor m_color;
diff --git a/examples/declarative/tutorials/extending/chapter6-plugins/qmldir b/examples/declarative/tutorials/extending/chapter6-plugins/qmldir
deleted file mode 100644
index a83bf85ddb..0000000000
--- a/examples/declarative/tutorials/extending/chapter6-plugins/qmldir
+++ /dev/null
@@ -1 +0,0 @@
-plugin chapter6-plugins lib