aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorThomas Hartmann <[email protected]>2010-09-15 14:24:55 +0200
committerThomas Hartmann <[email protected]>2010-09-15 14:25:26 +0200
commit670e960f97bca721083161f2246f227813a34a2b (patch)
treeb72ab0b46cf372fa1c646ef507ef9a14c2352f6d /src/plugins
parent1d313aae281933c494500c4cded221a43a85ee1d (diff)
QmlDesigner.propertyEditor: support for alias properties
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp
index b4061b1d2b4..bc430d05d9f 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp
+++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp
@@ -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\nimport 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\"\nbaseStateFlag: isBaseState\nslider: 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 {\ntext: \"%1\"\nbackendValue: backendValues.%2\nbaseStateFlag: isBaseState\n}\n"
)).arg(name).arg(properName);
}
- if (propertyMetaInfo.type() == "string") {
+ if (typeName == "string") {
qmlTemplate += QString(QLatin1String(
"QWidget {\nlayout: HorizontalLayout {\nLabel {\ntext: \"%1\"\ntoolTip: \"%1\"\n}\nLineEdit {\nbackendValue: backendValues.%2\nbaseStateFlag: isBaseState\n}\n}\n}\n"
)).arg(name).arg(properName);
}
- if (propertyMetaInfo.type() == "bool") {
+ if (typeName == "bool") {
qmlTemplate += QString(QLatin1String(
"QWidget {\nlayout: HorizontalLayout {\nLabel {\ntext: \"%1\"\ntoolTip: \"%1\"\n}\nCheckBox {text: backendValues.%2.value\nbackendValue: backendValues.%2\nbaseStateFlag: isBaseState\ncheckable: 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 {\ncaption: \"%1\"\nfinished: finishedNotify\nbackendColor: 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);