diff --git a/share/qtcreator/templates/wizards/README.txt b/share/qtcreator/templates/wizards/README.txt new file mode 100644 index 0000000000000000000000000000000000000000..891ad644062f815d8327d9fbc9fb5e70c52de9f1 --- /dev/null +++ b/share/qtcreator/templates/wizards/README.txt @@ -0,0 +1,5 @@ +Qt Creator custom wizard are located in this directory. + +The subdirectories 'helloworld' and 'listmodel' are provided as examples. +To see how they work in Qt Creator, rename the 'wizard_sample.xml' files +to 'wizard.xml'. diff --git a/share/qtcreator/templates/wizards/helloworld/console.png b/share/qtcreator/templates/wizards/helloworld/console.png new file mode 100644 index 0000000000000000000000000000000000000000..7569a988f4a09ad0a72d7250b47db99c88471a79 Binary files /dev/null and b/share/qtcreator/templates/wizards/helloworld/console.png differ diff --git a/share/qtcreator/templates/wizards/helloworld/main.cpp b/share/qtcreator/templates/wizards/helloworld/main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c68f1dcdce02bd3be1a8c7eee01f515ea559d175 --- /dev/null +++ b/share/qtcreator/templates/wizards/helloworld/main.cpp @@ -0,0 +1,7 @@ +#include <cstdio> + +int main(int, char **) +{ + std::printf("%MESSAGE%\n"); + return 0; +} diff --git a/share/qtcreator/templates/wizards/helloworld/project.pro b/share/qtcreator/templates/wizards/helloworld/project.pro new file mode 100644 index 0000000000000000000000000000000000000000..4385bce0d4b56eb32f3db38e3be475bb3916dee3 --- /dev/null +++ b/share/qtcreator/templates/wizards/helloworld/project.pro @@ -0,0 +1,6 @@ +QT -= core +CONFIG += console +CONFIG -= app_bundle + +TEMPLATE = app +SOURCES += main.cpp diff --git a/share/qtcreator/templates/wizards/helloworld/wizard_sample.xml b/share/qtcreator/templates/wizards/helloworld/wizard_sample.xml new file mode 100644 index 0000000000000000000000000000000000000000..58e7748bccc6c7bf4e27563ff022c973f52f963a --- /dev/null +++ b/share/qtcreator/templates/wizards/helloworld/wizard_sample.xml @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** +**************************************************************************/ + +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="A.HelloWorld" category="B.CustomProjects"> + <icon>console.png</icon> + <description>Creates a hello-world-project with custom message.</description> + <description xml:lang="de">Erzeugt ein Hello-Welt-Projekt mit einer Nachricht.</description> + <displayName>Hello World</displayName>; + <displayName xml:lang="de">Hallo Welt</displayName>; + <displayCategory>Custom Projects</displayCategory> + <displayCategory xml:lang="de">Benutzerdefinierte Projekte</displayCategory> + <files> + <file source="main.cpp"/> + <file source="project.pro" target="%ProjectName%.pro"/> + </files> + <!-- Create a 2nd wizard page with parameters --> + <fieldpagetitle>Hello World Parameters</fieldpagetitle> + <fieldpagetitle xml:lang="de">Hallo Welt Parameter</fieldpagetitle> + <fields> + <field mandatory="true" name="MESSAGE"> + <fieldcontrol class="QLineEdit" validator='^[^"]+$' defaulttext="Hello world!" /> + <fielddescription>Hello world message:</fielddescription> + <fielddescription xml:lang="de">Hallo-Welt-Nachricht:</fielddescription> + </field> + </fields> +</wizard> diff --git a/share/qtcreator/templates/wizards/listmodel/listmodel.cpp b/share/qtcreator/templates/wizards/listmodel/listmodel.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8f10b68f04d5c70f84da2b6a8de2339a396201a1 --- /dev/null +++ b/share/qtcreator/templates/wizards/listmodel/listmodel.cpp @@ -0,0 +1,23 @@ +#include "%ClassName:l%.%CppHeaderSuffix%" + +%ClassName%::%ClassName%(QObject *parent) : + QAbstractListModel(parent) +{ +} + +void %ClassName%::addItems(const QList<%Datatype%> &newItems) +{ + beginInsertRows(QModelIndex(), items.size(), items.size() + newItems.size()); + items.append(newItems); + endInsertRows(); +} + +int %ClassName%::rowCount(const QModelIndex &) const +{ + return items.size(); +} + +QVariant %ClassName%::data(const QModelIndex &index, int) +{ + return items.at(index.row()); +} diff --git a/share/qtcreator/templates/wizards/listmodel/listmodel.h b/share/qtcreator/templates/wizards/listmodel/listmodel.h new file mode 100644 index 0000000000000000000000000000000000000000..25219f635cdccee0a706138e691af8335e04cfb9 --- /dev/null +++ b/share/qtcreator/templates/wizards/listmodel/listmodel.h @@ -0,0 +1,21 @@ +#ifndef %ClassName:u%_H +#define %ClassName:u%_H + +#include <QAbstractListModel> +#include <QList> + +class %ClassName% : public QAbstractListModel { + Q_OBJECT +public: + explicit %ClassName%(QObject *parent); + void addItems(const QList<%Datatype%> &items); + + virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; + virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole); + +private: + QList<%Datatype%> items; +}; + +#endif // %ClassName:u%_H + diff --git a/share/qtcreator/templates/wizards/listmodel/wizard_sample.xml b/share/qtcreator/templates/wizards/listmodel/wizard_sample.xml new file mode 100644 index 0000000000000000000000000000000000000000..c924b896db045ac6f22e60faebbaa695bcda53b3 --- /dev/null +++ b/share/qtcreator/templates/wizards/listmodel/wizard_sample.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** +**************************************************************************/ + +Custom class wizard example configuration file. --> +<wizard version="1" kind="class" id="A.ListModel" category="B.CustomClasses"> + <description>Creates a QAbstractListModel implementation.</description> + <description xml:lang="de">Erzeugt eine Implementierung von QAbstractListModel.</description> + <displayName>QAbstractListModel implementation</displayName>; + <displayName xml:lang="de">Implementierung von QAbstractListModel</displayName>; + <displayCategory>Custom Classes</displayCategory> + <displayCategory xml:lang="de">Benutzerdefinierte Klassen</displayCategory> + <files> + <file source="listmodel.cpp" target="%ClassName:l%.%CppSourceSuffix%"/> + <file source="listmodel.h" target="%ClassName:l%.%CppHeaderSuffix%"/> + </files> + <!-- Create parameter wizard page --> + <fieldpagetitle>ListModel parameters</fieldpagetitle> + <fieldpagetitle xml:lang="de">Parameter des ListModel</fieldpagetitle> + <fields> + <field name="ClassName"> + <fieldcontrol class="QLineEdit" validator="^[a-zA-Z0-9_]+$" defaulttext="MyListModel" /> + <fielddescription>Class name:</fielddescription> + <fielddescription xml:lang="de">Klassenname:</fielddescription> + </field> + <field name="Datatype"> + <fieldcontrol class="QComboBox" combochoices="QString,int" defaultindex="0" /> + <fielddescription>Data type:</fielddescription> + <fielddescription xml:lang="de">Datentyp:</fielddescription> + </field> + </fields> +</wizard>