diff options
author | Damian Jansen <damian.jansen@nokia.com> | 2011-08-30 16:18:20 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-09-05 03:09:09 +0200 |
commit | 76dd4f8af9c48a685cb50bfa02389b392bc12a5a (patch) | |
tree | 959044545ec8b8b5d6ef40489c02d4885d4ec619 /examples/declarative/tutorials/extending/chapter6-plugins | |
parent | f22ae0f5f18a354bf3addd8023ad8b8810e42bac (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/declarative/tutorials/extending/chapter6-plugins')
8 files changed, 20 insertions, 24 deletions
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 |