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 <riitta-leena.miettinen@digia.com>
Reviewed-by: default avatarVenugopal Shivashankar <venugopal.shivashankar@digia.com>
Reviewed-by: default avatarAlessandro Portale <alessandro.portale@digia.com>
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"
featuresRequired="QtSupport.Wizards.FeatureQtQuick,QtSupport.Wizards.FeatureQtQuick.1">
<icon>lib.png</icon>
<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>
<displaycategory>Libraries</displaycategory>
<files>
<file source="qmldir" target="qmldir"/>
......
#include "%ObjectName:l%.%CppHeaderSuffix%"
%ObjectName%::%ObjectName%(QQuickItem *parent):
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);
}
%ObjectName%::~%ObjectName%()
{
}
#ifndef %ObjectName:u%_H
#define %ObjectName:u%_H
#include <QQuickItem>
class %ObjectName% : public QQuickItem
{
Q_OBJECT
Q_DISABLE_COPY(%ObjectName%)
public:
%ObjectName%(QQuickItem *parent = 0);
~%ObjectName%();
};
QML_DECLARE_TYPE(%ObjectName%)
#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_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
public:
void registerTypes(const char *uri);
};
#endif // %ProjectName:h%_PLUGIN_H
TEMPLATE = lib
TARGET = %ProjectName%
QT += qml quick
CONFIG += qt plugin
TARGET = $$qtLibraryTarget($$TARGET)
uri = %Uri%
# Input
SOURCES += \
%ProjectName:l%_plugin.%CppSourceSuffix% \
%ObjectName:l%.%CppSourceSuffix%
HEADERS += \
%ProjectName:l%_plugin.%CppHeaderSuffix% \
%ObjectName:l%.%CppHeaderSuffix%
OTHER_FILES = qmldir
!equals(_PRO_FILE_PWD_, $$OUT_PWD) {
copy_qmldir.target = $$OUT_PWD/qmldir
copy_qmldir.depends = $$_PRO_FILE_PWD_/qmldir
copy_qmldir.commands = $(COPY_FILE) \"$$replace(copy_qmldir.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_qmldir.target, /, $$QMAKE_DIR_SEP)\"
QMAKE_EXTRA_TARGETS += copy_qmldir
PRE_TARGETDEPS += $$copy_qmldir.target
}
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: http://www.qt-project.org/legal
**
** 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 http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** 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: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** 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"
featuresRequired="QtSupport.Wizards.FeatureQtQuick,QtSupport.Wizards.FeatureQtQuick.2">
<icon>lib.png</icon>
<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>
<displaycategory>Libraries</displaycategory>
<files>
<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="project.pro" target="%ProjectName:l%.pro" openproject="true"/>
</files>
<!-- Create a 2nd wizard page with parameters -->
<fieldpagetitle>Custom QML Extension Plugin Parameters</fieldpagetitle>
<fields>
<field mandatory="true" name="ObjectName">
<fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9_]+$' defaulttext="MyItem"/>
<fielddescription>Object Class-name:</fielddescription>
</field>
<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"/>
<fielddescription>URI:</fielddescription>
</field>
</fields>
<validationrules>
<validationrule condition='"%ObjectName%" != "%ProjectName%_plugin"'>
<message>The project name and the object class-name cannot be the same.</message>
</validationrule>
</validationrules>
</wizard>
......@@ -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: [
"lib.png",
"object.cpp",
"object.h",
"plugin.cpp",
"plugin.h",
"project.pro",
"qmldir",
"wizard.xml",
]
}
Group {
qbs.installDir: "share/qtcreator/templates/wizards/qtquick2-extension"
fileTags: ["install"]
prefix: "qtcreator/templates/wizards/qtquick2-extension/"
files: [
"lib.png",
"object.cpp",
......
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