summaryrefslogtreecommitdiffstats
path: root/examples/declarative/imageprovider
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-03-04 14:08:21 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-03-04 14:08:21 (GMT)
commit48edd0b663b29413452389c906487cc9b0408b29 (patch)
tree0b5e3e9de4c45adec46a80845ed640ee16ba46b1 /examples/declarative/imageprovider
parent8bc0456491e5a7e1fc677fce6e76932ab0d923e8 (diff)
parent6f09fc3a475eb2e1c843f4aebe7ea0d15182ac1d (diff)
downloadQt-48edd0b663b29413452389c906487cc9b0408b29.zip
Qt-48edd0b663b29413452389c906487cc9b0408b29.tar.gz
Qt-48edd0b663b29413452389c906487cc9b0408b29.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: (100 commits) Update QML PropertyAnimation::easing docs Add testcase for QTBUG-7730 Add autotests for tab and backtab in Keys and KeyNavigation. Run signal expressions on attached property objects in correct scope Fixup test Add support for tab and backtab in KeyNavigation Mark QGraphicsItem position properties as FINAL Move the multimedia files to the correct place. Fix grammar stringifying "on" as "readonly" Improve grouped property error messages Don't mess with highlight size if highlightFollowsCurrentItem is false. Fix ListView contentHeight calculation. Remove Qt.playSound() Add formatting functions to QML's global Qt object. Signal handler requires exactly one value. QDeclarativeContext::contextProperty() should also access ids Compile without QVariant::EasingCurve in Qt 4.6.2. Documented view behavior when items are removed from start of view. Fix tests failing due to javascript eval errors. Remove unnecessary additional hash of QDeclarativeGridViewAttached ...
Diffstat (limited to 'examples/declarative/imageprovider')
-rw-r--r--examples/declarative/imageprovider/ImageProviderCore/qmldir2
-rw-r--r--examples/declarative/imageprovider/imageprovider.cpp (renamed from examples/declarative/imageprovider/main.cpp)49
-rw-r--r--examples/declarative/imageprovider/imageprovider.pro14
-rw-r--r--examples/declarative/imageprovider/imageprovider.qml (renamed from examples/declarative/imageprovider/view.qml)1
-rw-r--r--examples/declarative/imageprovider/imageprovider.qrc5
5 files changed, 40 insertions, 31 deletions
diff --git a/examples/declarative/imageprovider/ImageProviderCore/qmldir b/examples/declarative/imageprovider/ImageProviderCore/qmldir
new file mode 100644
index 0000000..1028590
--- /dev/null
+++ b/examples/declarative/imageprovider/ImageProviderCore/qmldir
@@ -0,0 +1,2 @@
+plugin imageprovider
+
diff --git a/examples/declarative/imageprovider/main.cpp b/examples/declarative/imageprovider/imageprovider.cpp
index d9d4c1a..253dbf5 100644
--- a/examples/declarative/imageprovider/main.cpp
+++ b/examples/declarative/imageprovider/imageprovider.cpp
@@ -39,7 +39,8 @@
**
****************************************************************************/
-#include <QApplication>
+
+#include <qdeclarativeextensionplugin.h>
#include <qdeclarativeengine.h>
#include <qdeclarativecontext.h>
@@ -70,29 +71,37 @@ public:
}
};
-int main(int argc, char ** argv)
+
+class ImageProviderExtensionPlugin : public QDeclarativeExtensionPlugin
{
- QApplication app(argc, argv);
+ Q_OBJECT
+public:
+ void registerTypes(const char *uri) {
+ Q_UNUSED(uri);
+
+ }
- QDeclarativeView view;
+ void initializeEngine(QDeclarativeEngine *engine, const char *uri) {
+ Q_UNUSED(uri);
- view.engine()->addImageProvider("colors", new ColorImageProvider);
+ engine->addImageProvider("colors", new ColorImageProvider);
- QStringList dataList;
- dataList.append("image://colors/red");
- dataList.append("image://colors/green");
- dataList.append("image://colors/blue");
- dataList.append("image://colors/brown");
- dataList.append("image://colors/orange");
- dataList.append("image://colors/purple");
- dataList.append("image://colors/yellow");
+ QStringList dataList;
+ dataList.append("image://colors/red");
+ dataList.append("image://colors/green");
+ dataList.append("image://colors/blue");
+ dataList.append("image://colors/brown");
+ dataList.append("image://colors/orange");
+ dataList.append("image://colors/purple");
+ dataList.append("image://colors/yellow");
- QDeclarativeContext *ctxt = view.rootContext();
- ctxt->setContextProperty("myModel", QVariant::fromValue(dataList));
+ QDeclarativeContext *ctxt = engine->rootContext();
+ ctxt->setContextProperty("myModel", QVariant::fromValue(dataList));
+ }
- view.setSource(QUrl("qrc:view.qml"));
- view.show();
+};
+
+#include "imageprovider.moc"
+
+Q_EXPORT_PLUGIN(ImageProviderExtensionPlugin);
- return app.exec();
-}
-//![0]
diff --git a/examples/declarative/imageprovider/imageprovider.pro b/examples/declarative/imageprovider/imageprovider.pro
index 60423ab..e403bf8 100644
--- a/examples/declarative/imageprovider/imageprovider.pro
+++ b/examples/declarative/imageprovider/imageprovider.pro
@@ -1,9 +1,11 @@
-TEMPLATE = app
-TARGET = imageprovider
-DEPENDPATH += .
-INCLUDEPATH += .
+TEMPLATE = lib
+TARGET = imageprovider
QT += declarative
+CONFIG += qt plugin
+
+TARGET = $$qtLibraryTarget($$TARGET)
+DESTDIR = ImageProviderCore
# Input
-SOURCES += main.cpp
-RESOURCES += imageprovider.qrc
+SOURCES += imageprovider.cpp
+
diff --git a/examples/declarative/imageprovider/view.qml b/examples/declarative/imageprovider/imageprovider.qml
index 2ab729d..f899b1e 100644
--- a/examples/declarative/imageprovider/view.qml
+++ b/examples/declarative/imageprovider/imageprovider.qml
@@ -1,4 +1,5 @@
import Qt 4.6
+import "ImageProviderCore"
//![0]
ListView {
width: 100
diff --git a/examples/declarative/imageprovider/imageprovider.qrc b/examples/declarative/imageprovider/imageprovider.qrc
deleted file mode 100644
index 17e9301..0000000
--- a/examples/declarative/imageprovider/imageprovider.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource>
- <file>view.qml</file>
-</qresource>
-</RCC>