summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJere Tuliniemi <jere.tuliniemi@qt.io>2018-11-30 15:45:26 +0200
committerJere Tuliniemi <jere.tuliniemi@qt.io>2018-12-03 09:12:04 +0000
commit4d9818a19db4e793423d5ab3c29044ef19f6d235 (patch)
treeac8cc1a5090e6fb698e6988d2849533c099e3356
parent5f23db4e8fccecd83c95237d149fa0cc4d2a6ab6 (diff)
Add missing material container check
This name manipulation was only meant for objects inside the material container. The name was also meant to be searched from the right. Change-Id: I63860d9389baf9d7e62654c412b0f2714b61a64f Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp b/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp
index 701c06ab..166cc8f2 100644
--- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp
+++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp
@@ -1762,9 +1762,11 @@ void InspectorControlModel::setPropertyValue(long instance, int handle, const QV
if (!bridge->CheckNameUnique(parentInstance, instance, realNewName)) {
QString origNewName = newName.toQString();
newName = bridge->GetUniqueChildName(parentInstance, instance, realNewName);
- int slashIndex = newName.find('/');
- if (slashIndex != Q3DStudio::CString::ENDOFSTRING)
- newName = newName.substr(slashIndex + 1);
+ if (bridge->isInsideMaterialContainer(instance)) {
+ int slashIndex = newName.rfind('/');
+ if (slashIndex != Q3DStudio::CString::ENDOFSTRING)
+ newName = newName.substr(slashIndex + 1);
+ }
// Display rename message box asynchronously so focus loss won't trigger setting
// the name again
g_StudioApp.GetDialogs()->DisplayObjectRenamed(origNewName, newName.toQString(),