diff options
author | Gunnar Sletta <gunnar.sletta@nokia.com> | 2011-09-12 08:12:58 +0200 |
---|---|---|
committer | Gunnar Sletta <gunnar.sletta@nokia.com> | 2011-09-12 08:12:58 +0200 |
commit | d77218522eb480c8d528de18049cd7b604cdeb2a (patch) | |
tree | a6433a8e9205a95006eae10b53285a0e3487423d /examples/declarative/tutorials | |
parent | 589c8445e2623ef8e0b8294d7c558a2948b2a5e3 (diff) | |
parent | d5686fa2ac2248d5a31237573fa08697f18f035f (diff) |
Merge branch 'master' into refactor
Conflicts:
examples/declarative/cppextensions/qwidgets/qwidgets.pro
examples/declarative/minehunt/main.cpp
examples/declarative/minehunt/minehunt.pro
src/declarative/items/context2d/qsgcontext2d.cpp
src/declarative/items/qsgflickable.cpp
src/declarative/items/qsgtextedit.cpp
src/declarative/items/qsgtextinput.cpp
src/declarative/particles/qsgangleddirection.cpp
src/declarative/particles/qsgcumulativedirection.cpp
src/declarative/particles/qsgcumulativedirection_p.h
src/declarative/particles/qsgfollowemitter.cpp
src/declarative/particles/qsgmodelparticle.cpp
src/declarative/particles/qsgparticlesystem.cpp
src/qtquick1/util/qdeclarativeview.h
tests/auto/declarative/examples/examples.pro
tests/auto/declarative/qsgfocusscope/tst_qsgfocusscope.cpp
Change-Id: Ib4be2a5e742dee1a399d73da97161736f77448e5
Diffstat (limited to 'examples/declarative/tutorials')
37 files changed, 95 insertions, 113 deletions
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 |