QmlDesigner: Expose objectName for Qt Insight

- Expose objectName in Property Editor
- Rearrange Annotation button in Component Section
- Fix enabled state of insight view
- Add reset of Property Editor when enabled state is toggled

Task-number: QDS-9355
Change-Id: I873994580d8135f97236b6a98462c513169ac8c1
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Henning Gruendl
2023-04-20 18:47:08 +02:00
committed by Henning Gründl
parent 0c7c7272ea
commit 7af8c225d1
3 changed files with 50 additions and 24 deletions

View File

@@ -174,7 +174,29 @@ Section {
}
PropertyLabel {
text: qsTr("Name")
visible: root.showState
text: qsTr("State")
tooltip: qsTr("Sets the state of the component.")
}
SecondColumnLayout {
visible: root.showState
ComboBox {
implicitWidth: StudioTheme.Values.singleControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
width: implicitWidth
editable: true
backendValue: backendValues.state
model: allStateNames
valueType: ComboBox.String
}
ExpandingSpacer {}
}
PropertyLabel {
text: annotationEditor.hasAuxData ? qsTr("Annotation") : ""
tooltip: qsTr("Adds a note with a title to explain the component.")
}
@@ -226,6 +248,7 @@ Section {
visible: !annotationEditor.hasAuxData
buttonIcon: qsTr("Add Annotation")
iconFont: StudioTheme.Constants.font
tooltip: qsTr("Adds a note with a title to explain the component.")
onClicked: annotationEditor.showWidget()
onHoveredChanged: annotationEditor.checkAux()
}
@@ -252,27 +275,5 @@ Section {
onCanceled: hideWidget()
}
}
PropertyLabel {
visible: root.showState
text: qsTr("State")
tooltip: qsTr("Sets the state of the component.")
}
SecondColumnLayout {
visible: root.showState
ComboBox {
implicitWidth: StudioTheme.Values.singleControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
width: implicitWidth
editable: true
backendValue: backendValues.state
model: allStateNames
valueType: ComboBox.String
}
ExpandingSpacer {}
}
}
}

View File

@@ -8,7 +8,7 @@ import StudioTheme 1.0 as StudioTheme
Section {
id: root
caption: qsTr("Analytics")
caption: qsTr("Insight")
anchors.left: parent.left
anchors.right: parent.right
@@ -84,5 +84,24 @@ Section {
ExpandingSpacer {}
}
PropertyLabel {
text: qsTr("Object name")
tooltip: qsTr("Sets the object name of the component.")
}
SecondColumnLayout {
LineEdit {
implicitWidth: StudioTheme.Values.singleControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
width: StudioTheme.Values.singleControlColumnWidth
backendValue: backendValues.objectName
text: backendValues.objectName.value
showTranslateCheckBox: false
enabled: !modelNodeBackend.multiSelection
}
ExpandingSpacer {}
}
}
}

View File

@@ -9,6 +9,7 @@
#include <plaintexteditmodifier.h>
#include <rewriterview.h>
#include <signalhandlerproperty.h>
#include <qmldesignerplugin.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projecttree.h>
@@ -452,6 +453,11 @@ void InsightModel::setEnabled(bool value)
if (!m_qtdsConfigInfo.exists())
writeJSON(m_qtdsConfigInfo.absoluteFilePath(), m_qtdsConfig);
}
m_enabled = value;
setAuxiliaryEnabled(m_enabled);
QmlDesignerPlugin::instance()->viewManager().resetPropertyEditorView();
}
QString InsightModel::token() const