summaryrefslogtreecommitdiffstats
path: root/src/Authoring/Qt3DStudio/Palettes
diff options
context:
space:
mode:
authorJanne Kangas <janne.kangas@qt.io>2019-08-21 13:02:14 +0300
committerJanne Kangas <janne.kangas@qt.io>2019-09-02 11:55:49 +0300
commit5449c65bd84b3bd9d1bd9905c4aad8287eb4a572 (patch)
tree5e5def92157b0afae40c3a58bd4d0df8a3d174ca /src/Authoring/Qt3DStudio/Palettes
parent9ecb622c57f4b7262f5ee72b40fd1d297b86646a (diff)
Indicate invalid import file paths in inspector panel
Highlight a non-existing file with color and tooltip in inspector panel. Also adds m_valid flag to inspector items. Task-id QT3DS-3384 Change-Id: I348c388ff2b36158f341b44572aa4022873770bf Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Diffstat (limited to 'src/Authoring/Qt3DStudio/Palettes')
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/Inspector/HandlerFilesChooser.qml16
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlModel.cpp24
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlModel.h4
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/controls/BrowserCombo.qml2
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/controls/StyledLabel.qml4
5 files changed, 47 insertions, 3 deletions
diff --git a/src/Authoring/Qt3DStudio/Palettes/Inspector/HandlerFilesChooser.qml b/src/Authoring/Qt3DStudio/Palettes/Inspector/HandlerFilesChooser.qml
index b1514d03..25d40173 100644
--- a/src/Authoring/Qt3DStudio/Palettes/Inspector/HandlerFilesChooser.qml
+++ b/src/Authoring/Qt3DStudio/Palettes/Inspector/HandlerFilesChooser.qml
@@ -37,12 +37,28 @@ RowLayout {
signal showBrowser
property string value: ""
property alias activeBrowser: browser.activeBrowser
+ property var validData: parent.modelData.validData
BrowserCombo {
id: browser
Layout.preferredWidth: _valueWidth
+ validData: root.validData
Layout.fillWidth: true
value: root.value === "" ? qsTr("Select...") : root.value
onShowBrowser: root.showBrowser()
+ StyledTooltip {
+ text: qsTr("Invalid path")
+ enabled: browserMouseArea.containsMouse && !root.validData
+ }
+
+ MouseArea {
+ id: browserMouseArea
+ anchors.fill: parent
+ hoverEnabled: true
+ // pass through mouse click to Combobox
+ onPressed: {
+ mouse.accepted = false;
+ }
+ }
}
}
diff --git a/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlModel.cpp b/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlModel.cpp
index b23a1f0f..cc093626 100644
--- a/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlModel.cpp
+++ b/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlModel.cpp
@@ -789,12 +789,17 @@ InspectorControlBase* InspectorControlModel::createItem(Qt3DSDMInspectable *insp
// Update UI icon state and tooltip
updateControlledToggleState(item);
item->m_connections.push_back(signalProvider->ConnectControlledToggled(
- std::bind(&InspectorControlModel::updateControlledToggleState,
- this, item)));
+ std::bind(&InspectorControlModel::updateControlledToggleState, this, item)));
+ }
+
+ if (item->m_propertyType == qt3dsdm::AdditionalMetaDataType::Import) {
+ item->m_connections.push_back(signalProvider->ConnectControlledToggled(
+ std::bind(&InspectorControlModel::updateValidState, this, item)));
}
// synchronize the value itself
updatePropertyValue(item);
+ updateValidState(item);
return item;
}
@@ -875,6 +880,20 @@ void InspectorControlModel::updateAnimateToggleState(InspectorControlBase* inIte
}
}
+void InspectorControlModel::updateValidState(InspectorControlBase *inItem)
+{
+ const auto bridge = g_StudioApp.GetCore()->GetDoc()->GetStudioSystem()
+ ->GetClientDataModelBridge();
+ if (bridge->GetSourcePathProperty() == inItem->m_property) {
+ QFileInfo fileinfo(g_StudioApp.GetCore()->GetDoc()->GetResolvedPathToDoc(
+ bridge->GetSourcePath(inItem->m_instance)));
+ if (fileinfo.exists() != inItem->m_valid) {
+ inItem->m_valid = !inItem->m_valid;
+ Q_EMIT inItem->validDataChanged();
+ }
+ }
+}
+
bool InspectorControlModel::isTreeRebuildRequired(CInspectableBase* inspectBase)
{
if (inspectBase != m_inspectableBase || !inspectBase)
@@ -1444,6 +1463,7 @@ void InspectorControlModel::refresh()
if (property->m_property.Valid()) {
updatePropertyValue(property);
updateControlledToggleState(property);
+ updateValidState(property);
}
}
}
diff --git a/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlModel.h b/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlModel.h
index 7c3be20e..b1c13240 100644
--- a/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlModel.h
+++ b/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlModel.h
@@ -70,6 +70,7 @@ class InspectorControlBase : public QObject
Q_PROPERTY(bool animated MEMBER m_animated NOTIFY animatedChanged)
Q_PROPERTY(bool controlled MEMBER m_controlled NOTIFY controlledChanged)
Q_PROPERTY(bool controllable MEMBER m_controllable CONSTANT)
+ Q_PROPERTY(bool validData MEMBER m_valid NOTIFY validDataChanged)
Q_PROPERTY(QString controller MEMBER m_controller NOTIFY controlledChanged)
public:
@@ -81,6 +82,7 @@ Q_SIGNALS:
void animatedChanged();
void controlledChanged();
void tooltipChanged();
+ void validDataChanged();
public:
qt3dsdm::DataModelDataType::Value m_dataType;
@@ -99,6 +101,7 @@ public:
bool m_animated = false;
bool m_controlled = false;
bool m_controllable = false;
+ bool m_valid = true;
QString m_controller;
std::vector<qt3dsdm::TSignalConnectionPtr> m_connections;
};
@@ -140,6 +143,7 @@ public:
bool controlled);
void notifyPropertyChanged(qt3dsdm::Qt3DSDMInstanceHandle inInstance,
qt3dsdm::Qt3DSDMPropertyHandle inProperty);
+ void updateValidState(InspectorControlBase *inItem);
Q_INVOKABLE void setMaterialTypeValue(long instance, int handle, const QVariant &value);
Q_INVOKABLE void setShaderValue(long instance, int handle, const QVariant &value);
diff --git a/src/Authoring/Qt3DStudio/Palettes/controls/BrowserCombo.qml b/src/Authoring/Qt3DStudio/Palettes/controls/BrowserCombo.qml
index 727488f4..c6b50832 100644
--- a/src/Authoring/Qt3DStudio/Palettes/controls/BrowserCombo.qml
+++ b/src/Authoring/Qt3DStudio/Palettes/controls/BrowserCombo.qml
@@ -36,6 +36,7 @@ MouseArea {
property alias value: value.text
property var activeBrowser
property bool blockShow: false
+ property bool validData
signal showBrowser
@@ -64,6 +65,7 @@ MouseArea {
StyledLabel {
id: value
+ validData: root.validData
anchors.fill: parent
horizontalAlignment: Text.AlignLeft
rightPadding: 6 + img.width
diff --git a/src/Authoring/Qt3DStudio/Palettes/controls/StyledLabel.qml b/src/Authoring/Qt3DStudio/Palettes/controls/StyledLabel.qml
index 5185b2ad..4f101f05 100644
--- a/src/Authoring/Qt3DStudio/Palettes/controls/StyledLabel.qml
+++ b/src/Authoring/Qt3DStudio/Palettes/controls/StyledLabel.qml
@@ -32,8 +32,10 @@ import QtQuick.Layouts 1.3
Label {
id: styledLabelId
+ property bool validData: true
+
font.pixelSize: _fontSize
- color: _textColor
+ color: validData ? _textColor : _invalidDataIndicatorColor
Layout.preferredHeight: _controlBaseHeight
Layout.preferredWidth: _idWidth
verticalAlignment: Text.AlignVCenter