Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
flatpak-qt-creator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
670e960f
Commit
670e960f
authored
Sep 15, 2010
by
Thomas Hartmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
QmlDesigner.propertyEditor: support for alias properties
parent
1d313aae
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
8 deletions
+13
-8
src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp
.../qmldesigner/components/propertyeditor/propertyeditor.cpp
+13
-8
No files found.
src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp
View file @
670e960f
...
...
@@ -540,7 +540,7 @@ void PropertyEditor::timerEvent(QTimerEvent *timerEvent)
}
}
QString
templateGeneration
(
NodeMetaInfo
type
,
NodeMetaInfo
superType
)
QString
templateGeneration
(
NodeMetaInfo
type
,
NodeMetaInfo
superType
,
const
QmlObjectNode
&
objectNode
)
{
QString
qmlTemplate
=
QLatin1String
(
"import Qt 4.7
\n
import Bauhaus 1.0
\n
"
);
qmlTemplate
+=
QLatin1String
(
"GroupBox {
\n
"
);
...
...
@@ -556,28 +556,33 @@ QString templateGeneration(NodeMetaInfo type, NodeMetaInfo superType)
QString
properName
=
name
;
properName
.
replace
(
"."
,
"_"
);
QString
typeName
=
propertyMetaInfo
.
type
();
//alias resolution only possible with instance
if
(
typeName
==
QLatin1String
(
"alias"
)
&&
objectNode
.
isValid
())
typeName
=
objectNode
.
instanceType
(
name
);
if
(
!
superType
.
hasProperty
(
name
,
true
))
{
if
(
propertyMetaInfo
.
type
()
==
"int"
)
{
if
(
typeName
==
"int"
)
{
qmlTemplate
+=
QString
(
QLatin1String
(
"IntEditor { backendValue: backendValues.%2
\n
caption:
\"
%1
\"\n
baseStateFlag: isBaseState
\n
slider: false
\n
}"
)).
arg
(
name
).
arg
(
properName
);
}
if
(
propertyMetaInfo
.
type
()
==
"real"
||
propertyMetaInfo
.
type
()
==
"double"
||
propertyMetaInfo
.
type
()
==
"qreal"
)
{
if
(
typeName
==
"real"
||
typeName
==
"double"
||
typeName
==
"qreal"
)
{
qmlTemplate
+=
QString
(
QLatin1String
(
"DoubleSpinBoxAlternate {
\n
text:
\"
%1
\"\n
backendValue: backendValues.%2
\n
baseStateFlag: isBaseState
\n
}
\n
"
)).
arg
(
name
).
arg
(
properName
);
}
if
(
propertyMetaInfo
.
type
()
==
"string"
)
{
if
(
typeName
==
"string"
)
{
qmlTemplate
+=
QString
(
QLatin1String
(
"QWidget {
\n
layout: HorizontalLayout {
\n
Label {
\n
text:
\"
%1
\"\n
toolTip:
\"
%1
\"\n
}
\n
LineEdit {
\n
backendValue: backendValues.%2
\n
baseStateFlag: isBaseState
\n
}
\n
}
\n
}
\n
"
)).
arg
(
name
).
arg
(
properName
);
}
if
(
propertyMetaInfo
.
type
()
==
"bool"
)
{
if
(
typeName
==
"bool"
)
{
qmlTemplate
+=
QString
(
QLatin1String
(
"QWidget {
\n
layout: HorizontalLayout {
\n
Label {
\n
text:
\"
%1
\"\n
toolTip:
\"
%1
\"\n
}
\n
CheckBox {text: backendValues.%2.value
\n
backendValue: backendValues.%2
\n
baseStateFlag: isBaseState
\n
checkable: true
\n
}
\n
}
\n
}
\n
"
)).
arg
(
name
).
arg
(
properName
);
}
if
(
propertyMetaInfo
.
type
()
==
"color"
||
propertyMetaInfo
.
type
()
==
"QColor"
)
{
if
(
typeName
==
"color"
||
typeName
==
"QColor"
)
{
qmlTemplate
+=
QString
(
QLatin1String
(
"ColorGroupBox {
\n
caption:
\"
%1
\"\n
finished: finishedNotify
\n
backendColor: backendValues.%2
\n
}
\n\n
"
)).
arg
(
name
).
arg
(
properName
);
...
...
@@ -616,10 +621,10 @@ void PropertyEditor::resetView()
if
(
m_selectedNode
.
isValid
()
&&
!
QFileInfo
(
qmlSpecificsFile
.
toLocalFile
()).
exists
()
&&
m_selectedNode
.
metaInfo
().
isValid
())
{
//do magic !!
specificQmlData
=
templateGeneration
(
m_selectedNode
.
metaInfo
(),
model
()
->
metaInfo
().
nodeMetaInfo
(
specificsClassName
));
specificQmlData
=
templateGeneration
(
m_selectedNode
.
metaInfo
(),
model
()
->
metaInfo
().
nodeMetaInfo
(
specificsClassName
)
,
m_selectedNode
);
}
NodeType
*
type
=
m_typeHash
.
value
(
qmlFile
.
toString
());
NodeType
*
type
=
m_typeHash
.
value
(
qmlFile
.
toString
());
if
(
!
type
)
{
type
=
new
NodeType
(
this
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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