Commit 62b20005 authored by Kai Koehne's avatar Kai Koehne
Browse files

Split up QML Extension wizard in Qt Quick 1 and Qt Quick 2 one

Task-number: QTCREATORBUG-8269
Change-Id: I6b4a4d54499302354606f9446f68b9088daad1e8
Reviewed-by: default avatarLeena Miettinen <>
Reviewed-by: default avatarVenugopal Shivashankar <>
Reviewed-by: default avatarAlessandro Portale <>
parent 536bea2d
......@@ -36,11 +36,11 @@ leave room for the Qt 4 target page.
<wizard version="1" kind="project"
class="qt4project" firstpage="10"
id="QmlExtensionPlugin" category="G.Libraries"
id="QtQuick1ExtensionPlugin" category="G.Libraries"
<description>Creates a C++ plugin that makes it possible to offer extensions that can be loaded dynamically into applications using the QDeclarativeEngine class.</description>
<displayname>Custom QML Extension Plugin</displayname>
<displayname>Qt Quick 1 Extension Plugin</displayname>
<file source="qmldir" target="qmldir"/>
#include "%ObjectName:l%.%CppHeaderSuffix%"
%ObjectName%::%ObjectName%(QQuickItem *parent):
// By default, QQuickItem does not draw anything. If you subclass
// QQuickItem to create a visual item, you will need to uncomment the
// following line and re-implement updatePaintNode()
// setFlag(ItemHasContents, true);
#ifndef %ObjectName:u%_H
#define %ObjectName:u%_H
#include <QQuickItem>
class %ObjectName% : public QQuickItem
%ObjectName%(QQuickItem *parent = 0);
#endif // %ObjectName:u%_H
#include "%ProjectName:l%_plugin.%CppHeaderSuffix%"
#include "%ObjectName:l%.%CppHeaderSuffix%"
#include <qqml.h>
void %ProjectName:s%Plugin::registerTypes(const char *uri)
// @uri %Uri%
qmlRegisterType<%ObjectName%>(uri, 1, 0, "%ObjectName%");
#ifndef %ProjectName:h%_PLUGIN_H
#define %ProjectName:h%_PLUGIN_H
#include <QQmlExtensionPlugin>
class %ProjectName:s%Plugin : public QQmlExtensionPlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
void registerTypes(const char *uri);
#endif // %ProjectName:h%_PLUGIN_H
TARGET = %ProjectName%
QT += qml quick
CONFIG += qt plugin
TARGET = $$qtLibraryTarget($$TARGET)
uri = %Uri%
# Input
%ProjectName:l%_plugin.%CppSourceSuffix% \
%ProjectName:l%_plugin.%CppHeaderSuffix% \
OTHER_FILES = qmldir
!equals(_PRO_FILE_PWD_, $$OUT_PWD) { = $$OUT_PWD/qmldir
copy_qmldir.depends = $$_PRO_FILE_PWD_/qmldir
copy_qmldir.commands = $(COPY_FILE) \"$$replace(copy_qmldir.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(, /, $$QMAKE_DIR_SEP)\"
QMAKE_EXTRA_TARGETS += copy_qmldir
qmldir.files = qmldir
unix {
installPath = $$[QT_INSTALL_IMPORTS]/$$replace(uri, \\., /)
qmldir.path = $$installPath
target.path = $$installPath
INSTALLS += target qmldir
<?xml version="1.0" encoding="UTF-8"?>
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact:
** This file is part of Qt Creator.
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see For further information
** use the contact form at
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met:
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
Custom project wizard configuration example file. Note that by convention,
the project file goes last.
The "class" and "firstpage" attributes specify that it is a Qt 4 wizard and
leave room for the Qt 4 target page.
<wizard version="1" kind="project"
class="qt4project" firstpage="10"
id="QtQuick2ExtensionPlugin" category="G.Libraries"
<description>Creates a C++ plugin that makes it possible to offer extensions that can be loaded dynamically into applications using the QQmlEngine class.</description>
<displayname>Qt Quick 2 Extension Plugin</displayname>
<file source="qmldir" target="qmldir"/>
<file source="plugin.h" target="%ProjectName:l%_plugin.%CppHeaderSuffix%"/>
<file source="plugin.cpp" target="%ProjectName:l%_plugin.%CppSourceSuffix%"/>
<file source="object.h" target="%ObjectName:l%.%CppHeaderSuffix%"/>
<file source="object.cpp" target="%ObjectName:l%.%CppSourceSuffix%" openeditor="true"/>
<file source="" target="" openproject="true"/>
<!-- Create a 2nd wizard page with parameters -->
<fieldpagetitle>Custom QML Extension Plugin Parameters</fieldpagetitle>
<field mandatory="true" name="ObjectName">
<fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9_]+$' defaulttext="MyItem"/>
<fielddescription>Object Class-name:</fielddescription>
<field mandatory="true" name="Uri">
<fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9]+([A-Za-z0-9-]*[A-Za-z0-9]+)?(\.[A-Za-z0-9]+([-A-Za-z0-9]*[A-Za-z0-9]+)?)*$' defaulttext="com.mycompany.qmlcomponents"/>
<validationrule condition='"%ObjectName%" != "%ProjectName%_plugin"'>
<message>The project name and the object class-name cannot be the same.</message>
......@@ -1143,9 +1143,25 @@ Product {
Group {
qbs.installDir: "share/qtcreator/templates/wizards/qml-extension"
qbs.installDir: "share/qtcreator/templates/wizards/qtquick1-extension"
fileTags: ["install"]
prefix: "qtcreator/templates/wizards/qml-extension/"
prefix: "qtcreator/templates/wizards/qtquick1-extension/"
files: [
Group {
qbs.installDir: "share/qtcreator/templates/wizards/qtquick2-extension"
fileTags: ["install"]
prefix: "qtcreator/templates/wizards/qtquick2-extension/"
files: [
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment