summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@qt.io>2018-02-15 13:56:05 +0200
committerTomi Korpipää <tomi.korpipaa@qt.io>2018-02-16 04:27:56 +0000
commit5425aeb25361d453868bb125ba8ac0a68b3b3306 (patch)
tree7570e38146cddbf9d9fb0f8e88c806e9274a9066
parentf57cd42b197ffcf86cc64de5531465317767a323 (diff)
Fix crash undoing/redoing 'make component' action
Task-number: QT3DS-1047 Change-Id: I1976f8b91fc1d48dafbae0f1d01367590cab6e92 Reviewed-by: Janne Kangas <janne.kangas@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp2
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp15
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/InspectorControlView.h1
3 files changed, 17 insertions, 1 deletions
diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp b/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp
index 053d53ba..dd6a00c4 100644
--- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp
+++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp
@@ -598,6 +598,8 @@ void InspectorControlModel::updatePropertyValue(InspectorControlBase *element) c
auto bridge = studioSystem->GetClientDataModelBridge();
qt3dsdm::SValue value;
const auto instance = element->m_instance;
+ if (!propertySystem->HandleValid(instance))
+ return;
propertySystem->GetInstancePropertyValue(instance, element->m_property, value);
const auto metaDataProvider = doc->GetStudioSystem()->GetActionMetaData();
diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp
index 07ced9e5..dda980be 100644
--- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp
+++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp
@@ -231,6 +231,17 @@ bool InspectorControlView::canLinkProperty(int instance, int handle) const
return canBeLinkedFlag;
}
+void InspectorControlView::onInstancePropertyValueChanged(
+ qt3dsdm::Qt3DSDMPropertyHandle propertyHandle)
+{
+ auto bridge = g_StudioApp.GetCore()->GetDoc()->GetStudioSystem()->GetClientDataModelBridge();
+ // titleChanged implies icon change too, but that will only occur if inspectable type changes,
+ // which will invalidate the inspectable anyway, so in reality we are only interested in name
+ // property here
+ if (propertyHandle == bridge->GetNameProperty() && m_inspectableBase->IsValid())
+ Q_EMIT titleChanged();
+}
+
QColor InspectorControlView::titleColor(int instance, int handle) const
{
QColor ret = CStudioPreferences::textColor();
@@ -269,10 +280,12 @@ void InspectorControlView::setInspectable(CInspectableBase *inInspectable)
if (m_inspectableBase != inInspectable) {
m_inspectableBase = inInspectable;
m_inspectorControlModel->setInspectable(inInspectable);
+
Q_EMIT titleChanged();
auto sp = g_StudioApp.GetCore()->GetDoc()->GetStudioSystem()->GetFullSystem()->GetSignalProvider();
m_PropertyChangeConnection = sp->ConnectInstancePropertyValue(
- std::bind(&InspectorControlView::titleChanged, this));
+ std::bind(&InspectorControlView::onInstancePropertyValueChanged, this,
+ std::placeholders::_2));
m_timeChanged = sp->ConnectComponentSeconds(
std::bind(&InspectorControlView::OnTimeChanged, this));
}
diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.h b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.h
index 4888dcfd..187f1154 100644
--- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.h
+++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.h
@@ -109,6 +109,7 @@ private:
void setPropertyValueFromFilename(long instance, int handle, const QString &name);
void showBrowser(QQuickWidget *browser, const QPoint &point);
bool canLinkProperty(int instance, int handle) const;
+ void onInstancePropertyValueChanged(qt3dsdm::Qt3DSDMPropertyHandle propertyHandle);
std::shared_ptr<qt3dsdm::ISignalConnection> m_selectionChangedConnection;
std::shared_ptr<qt3dsdm::ISignalConnection> m_timeChanged;