Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Hunger
qt-creator
Commits
0cb92276
Commit
0cb92276
authored
Sep 28, 2010
by
Erik Verbruggen
Browse files
QML: added validation rules to the extension wizard.
parent
5fa0f306
Changes
3
Hide whitespace changes
Inline
Side-by-side
share/qtcreator/templates/wizards/qml-extension/object.cpp
View file @
0cb92276
...
...
@@ -6,29 +6,6 @@
%
ObjectName
%::%
ObjectName
%
(
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
%
);
share/qtcreator/templates/wizards/qml-extension/object.h
View file @
0cb92276
...
...
@@ -8,26 +8,10 @@
class
%
ObjectName
%
:
public
QObject
{
Q_OBJECT
Q_PROPERTY
(
QString
text
READ
text
WRITE
setText
NOTIFY
textChanged
)
Q_DISABLE_COPY
(
%
ObjectName
%
)
public:
%
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
share/qtcreator/templates/wizards/qml-extension/wizard.xml
View file @
0cb92276
...
...
@@ -54,7 +54,13 @@ leave room for the Qt 4 target page.
<fields>
<field
mandatory=
"false"
name=
"ObjectName"
>
<fieldcontrol
class=
"QLineEdit"
validator=
'^[A-Za-z0-9_]+$'
defaulttext=
"ExampleObject"
/>
<fielddescription>
Example
Object Class-name:
</fielddescription>
<fielddescription>
Object Class-name:
</fielddescription>
</field>
</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>
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment