Commit 0cb92276 authored by Erik Verbruggen's avatar Erik Verbruggen
Browse files

QML: added validation rules to the extension wizard.

parent 5fa0f306
...@@ -6,29 +6,6 @@ ...@@ -6,29 +6,6 @@
%ObjectName%::%ObjectName%(QObject *parent): %ObjectName%::%ObjectName%(QObject *parent):
QObject(parent) QObject(parent)
{ {
timer = new QTimer(this);
timer->setInterval(750);
connect(timer, SIGNAL(timeout()), this, SLOT(timerFired()));
timer->start();
}
QString %ObjectName%::text() const
{
return theText;
}
void %ObjectName%::setText(const QString &text)
{
if (theText != text) {
theText = text;
emit textChanged(theText);
}
}
void %ObjectName%::timerFired()
{
QTime t = QTime::currentTime();
setText(t.toString(QLatin1String("HH:mm:ss")));
} }
QML_DECLARE_TYPE(%ObjectName%); QML_DECLARE_TYPE(%ObjectName%);
...@@ -8,26 +8,10 @@ ...@@ -8,26 +8,10 @@
class %ObjectName% : public QObject class %ObjectName% : public QObject
{ {
Q_OBJECT Q_OBJECT
Q_DISABLE_COPY(%ObjectName%)
Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
public: public:
%ObjectName%(QObject *parent = 0); %ObjectName%(QObject *parent = 0);
QString text() const;
void setText(const QString &text);
signals:
void textChanged(const QString &newText);
private slots:
void timerFired();
private:
QString theText;
QTimer *timer;
Q_DISABLE_COPY(%ObjectName%)
}; };
#endif // %ObjectName:u%_H #endif // %ObjectName:u%_H
...@@ -54,7 +54,13 @@ leave room for the Qt 4 target page. ...@@ -54,7 +54,13 @@ leave room for the Qt 4 target page.
<fields> <fields>
<field mandatory="false" name="ObjectName"> <field mandatory="false" name="ObjectName">
<fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9_]+$' defaulttext="ExampleObject"/> <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9_]+$' defaulttext="ExampleObject"/>
<fielddescription>Example Object Class-name:</fielddescription> <fielddescription>Object Class-name:</fielddescription>
</field> </field>
</fields> </fields>
<validationrules>
<validationrule condition='"%ObjectName%" != "%ProjectName%"'>
<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> </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