diff options
Diffstat (limited to 'examples/qml')
4 files changed, 17 insertions, 8 deletions
diff --git a/examples/qml/qmlextensionplugins/plugin.cpp b/examples/qml/qmlextensionplugins/plugin.cpp index 56057b7f06..e04cfa57d8 100644 --- a/examples/qml/qmlextensionplugins/plugin.cpp +++ b/examples/qml/qmlextensionplugins/plugin.cpp @@ -141,7 +141,7 @@ MinuteTimer *TimeModel::timer=0; class QExampleQmlPlugin : public QQmlExtensionPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: void registerTypes(const char *uri) diff --git a/examples/qml/tutorials/extending-qml/chapter6-plugins/app.pro b/examples/qml/tutorials/extending-qml/chapter6-plugins/app.pro index c55db00d27..4d0e807417 100644 --- a/examples/qml/tutorials/extending-qml/chapter6-plugins/app.pro +++ b/examples/qml/tutorials/extending-qml/chapter6-plugins/app.pro @@ -1,10 +1,15 @@ TARGET = chapter6-plugins QT += qml quick -# Avoid going to debug/release subdirectory -# so that our application will see the -# import path for the Charts module. +# Ensure that the application will see the import path for the Charts module: +# * On Windows, do not build into a debug/release subdirectory. +# * On OS X, add the plugin files into the bundle. win32: DESTDIR = ./ +osx { + charts.files = $$OUT_PWD/Charts + charts.path = Contents/PlugIns + QMAKE_BUNDLE_DATA += charts +} SOURCES += main.cpp RESOURCES += app.qrc diff --git a/examples/qml/tutorials/extending-qml/chapter6-plugins/import/chartsplugin.h b/examples/qml/tutorials/extending-qml/chapter6-plugins/import/chartsplugin.h index 3c0f84fe34..2a9c2446bd 100644 --- a/examples/qml/tutorials/extending-qml/chapter6-plugins/import/chartsplugin.h +++ b/examples/qml/tutorials/extending-qml/chapter6-plugins/import/chartsplugin.h @@ -46,7 +46,7 @@ class ChartsPlugin : public QQmlExtensionPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: void registerTypes(const char *uri); diff --git a/examples/qml/tutorials/extending-qml/chapter6-plugins/main.cpp b/examples/qml/tutorials/extending-qml/chapter6-plugins/main.cpp index b20ae35f92..d165513861 100644 --- a/examples/qml/tutorials/extending-qml/chapter6-plugins/main.cpp +++ b/examples/qml/tutorials/extending-qml/chapter6-plugins/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. @@ -37,17 +37,21 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -//![0] #include <QtQuick/QQuickView> #include <QGuiApplication> +#include <QQmlEngine> int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); +//![0] QQuickView view; +#ifdef Q_OS_OSX + view.engine()->addImportPath(app.applicationDirPath() + "/../PlugIns"); +#endif +//![0] view.setResizeMode(QQuickView::SizeRootObjectToView); view.setSource(QUrl("qrc:///app.qml")); view.show(); return app.exec(); } -//![0] |