Commit fecbfcea authored by Erik Verbruggen's avatar Erik Verbruggen
Browse files

QML: tweaked the generated extension plugin wizard.

parent 24edd898
#include "%ObjectName:l%.%CppHeaderSuffix%"
#include <QtCore/QTime>
#include <QtDeclarative/qdeclarative.h>
%ObjectName%::%ObjectName%(QObject *parent):
QObject(parent)
%ObjectName%::%ObjectName%(QDeclarativeItem *parent):
QDeclarativeItem(parent)
{
// By default, QDeclarativeItem does not draw anything. If you subclass
// QDeclarativeItem to create a visual item, you will need to uncomment the
// following line:
// setFlag(ItemHasNoContents, false);
}
QML_DECLARE_TYPE(%ObjectName%);
%ObjectName%::~%ObjectName%()
{
}
#ifndef %ObjectName:u%_H
#define %ObjectName:u%_H
#include <QtCore/QObject>
#include <QtCore/QString>
#include <QtCore/QTimer>
#include <QtDeclarative/QDeclarativeItem>
class %ObjectName% : public QObject
class %ObjectName% : public QDeclarativeItem
{
Q_OBJECT
Q_DISABLE_COPY(%ObjectName%)
public:
%ObjectName%(QObject *parent = 0);
%ObjectName%(QDeclarativeItem *parent = 0);
~%ObjectName%();
};
QML_DECLARE_TYPE(%ObjectName%)
#endif // %ObjectName:u%_H
#include "%ProjectName:l%.%CppHeaderSuffix%"
#include "%ProjectName:l%_plugin.%CppHeaderSuffix%"
#include "%ObjectName:l%.%CppHeaderSuffix%"
#include <QtDeclarative/qdeclarative.h>
void %ProjectName%::registerTypes(const char *uri)
void %ProjectName%Plugin::registerTypes(const char *uri)
{
qmlRegisterType<%ObjectName%>(uri, 1, 0, "%ObjectName%");
}
Q_EXPORT_PLUGIN(%ProjectName%);
Q_EXPORT_PLUGIN2(%ProjectName%, %ProjectName%Plugin)
#ifndef %ProjectName:u%_H
#define %ProjectName:u%_H
#ifndef %ProjectName:u%_PLUGIN_H
#define %ProjectName:u%_PLUGIN_H
#include <QtDeclarative/QDeclarativeExtensionPlugin>
class %ProjectName% : public QDeclarativeExtensionPlugin
class %ProjectName%Plugin : public QDeclarativeExtensionPlugin
{
Q_OBJECT
......@@ -11,4 +11,4 @@ public:
void registerTypes(const char *uri);
};
#endif // %ProjectName:u%_H
#endif // %ProjectName:u%_PLUGIN_H
TEMPLATE = lib
TARGET = %ProjectName%
TARGET = %ProjectName%
QT += declarative
CONFIG += qt plugin
......@@ -7,11 +7,11 @@ TARGET = $$qtLibraryTarget($$TARGET)
# Input
SOURCES += \
%ProjectName:l%.%CppSourceSuffix% \
%ProjectName:l%_plugin.%CppSourceSuffix% \
%ObjectName:l%.%CppSourceSuffix%
OTHER_FILES=qmldir
HEADERS += \
%ProjectName:l%.%CppHeaderSuffix% \
%ProjectName:l%_plugin.%CppHeaderSuffix% \
%ObjectName:l%.%CppHeaderSuffix%
OTHER_FILES = qmldir
......@@ -43,8 +43,8 @@ leave room for the Qt 4 target page.
<displaycategory>QML Extension Plugin</displaycategory>
<files>
<file source="qmldir" target="qmldir"/>
<file source="plugin.h" target="%ProjectName:l%.%CppHeaderSuffix%"/>
<file source="plugin.cpp" target="%ProjectName:l%.%CppSourceSuffix%"/>
<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"/>
......@@ -53,14 +53,13 @@ leave room for the Qt 4 target page.
<fieldpagetitle>Custom QML Extension Plugin Parameters</fieldpagetitle>
<fields>
<field mandatory="false" name="ObjectName">
<fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9_]+$' defaulttext="ExampleObject"/>
<fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9_]+$' defaulttext="MyItem"/>
<fielddescription>Object Class-name:</fielddescription>
</field>
</fields>
<validationrules>
<validationrule condition='"%ObjectName%" != "%ProjectName%"'>
<validationrule condition='"%ObjectName%" != "%ProjectName%_plugin"'>
<message>The project name and the object class-name cannot be the same.</message>
<message xml:lang='nl'>De naam voor het project en de naam voor de klasse kunnen niet hetzelfde zijn.</message>
</validationrule>
</validationrules>
</wizard>
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