examples: Make qmlextensionplugins example usable without installation

The qmldir file as well as the .qml files have to be placed next to the
plugin, the import path has to be added to the .qmlproject, we want the
.qmltypes file added to the same place, and the plugins.qml should also
be available in the destination directory.

Change-Id: I82b369693e612779c6213345cc8f6a30b16d41b4
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
Ulf Hermann 2019-11-15 12:23:49 +01:00
parent 3dc5b937c4
commit da4cdfec98
2 changed files with 17 additions and 6 deletions

View File

@ -13,4 +13,6 @@ Project {
ImageFiles {
directory: "."
}
importPaths: [ "imports" ]
}

View File

@ -7,6 +7,7 @@ QML_IMPORT_MAJOR_VERSION = 1
DESTDIR = imports/$$QML_IMPORT_NAME
TARGET = qmlqtimeexampleplugin
QMLTYPES_FILENAME = $$DESTDIR/plugins.qmltypes
SOURCES += \
plugin.cpp \
@ -23,14 +24,22 @@ PLUGINFILES = \
imports/$$QML_IMPORT_NAME/hour.png \
imports/$$QML_IMPORT_NAME/minute.png
pluginfiles.files += $$PLUGINFILES
target.path = $$[QT_INSTALL_EXAMPLES]/qml/qmlextensionplugins/imports/$$QML_IMPORT_NAME
qml.files = plugins.qml
qml.path += $$[QT_INSTALL_EXAMPLES]/qml/qmlextensionplugins
target.path += $$[QT_INSTALL_EXAMPLES]/qml/qmlextensionplugins/imports/$$QML_IMPORT_NAME
pluginfiles.path += $$[QT_INSTALL_EXAMPLES]/qml/qmlextensionplugins/imports/$$QML_IMPORT_NAME
pluginfiles_copy.files = $$PLUGINFILES
pluginfiles_copy.path = $$DESTDIR
INSTALLS += target qml pluginfiles
pluginfiles_install.files = $$PLUGINFILES $$OUT_PWD/$$DESTDIR/plugins.qmltypes
pluginfiles_install.path = $$[QT_INSTALL_EXAMPLES]/qml/qmlextensionplugins/imports/$$QML_IMPORT_NAME
qml_copy.files = plugins.qml plugins.qmlproject
qml_copy.path = $$OUT_PWD
qml_install.files = plugins.qml plugins.qmlproject
qml_install.path = $$[QT_INSTALL_EXAMPLES]/qml/qmlextensionplugins
INSTALLS += target qml_install pluginfiles_install
COPIES += qml_copy pluginfiles_copy
OTHER_FILES += $$PLUGINFILES plugins.qml