summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Leinonen <tony.leinonen@qt.io>2020-09-21 11:59:45 +0300
committerTony Leinonen <tony.leinonen@qt.io>2020-09-22 08:01:33 +0300
commit2f9818d1344b1b3d3e3d2c83f3a4cc1fb3553d92 (patch)
treea810ab40c562d6e91163d6451f2ed7c411c096c7
parenta863eff12691398afb21fef8b767985ec6a9dae1 (diff)
Remove ability to add dots to object name
A name that contains dots will not work with DataInputs. If a dot is added to the name a warning window will pop up and alert the user. Task-number: QT3DS-4099 Change-Id: I8cb1bf7b835fcea3f79bae6b326cffbf989e738c Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io> Reviewed-by: Tony Leinonen <tony.leinonen@qt.io> Reviewed-by: Antti Määttä <antti.maatta@qt.io>
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlModel.cpp3
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.cpp7
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTreeLabel.cpp4
3 files changed, 9 insertions, 5 deletions
diff --git a/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlModel.cpp b/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlModel.cpp
index 5f72bdf0..06fc9ce6 100644
--- a/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlModel.cpp
+++ b/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlModel.cpp
@@ -1792,7 +1792,8 @@ void InspectorControlModel::setPropertyValue(long instance, int handle, const QV
&& ((newName.Find('/') != Q3DStudio::CString::ENDOFSTRING
|| newName.Find('#') != Q3DStudio::CString::ENDOFSTRING
|| newName.Find(':') != Q3DStudio::CString::ENDOFSTRING)
- || m_suspendMaterialRename)) {
+ || m_suspendMaterialRename)
+ || newName.toQString().contains(QChar('.'))) {
return;
}
qt3dsdm::Qt3DSDMInstanceHandle parentInstance = getBridge()
diff --git a/src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.cpp b/src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.cpp
index d71ef582..744c53a0 100644
--- a/src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.cpp
+++ b/src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.cpp
@@ -353,18 +353,17 @@ void Qt3DSDMTimelineItemBinding::SetName(const Q3DStudio::CString &inName)
return;
// Display warning dialog if user tried to enter an empty string
- if (inName.IsEmpty()) {
+ if (inName.IsEmpty() || inName.toQString().contains(QChar('.'))) {
QString theTitle = QObject::tr("Rename Object Error");
- QString theString = QObject::tr("Object name cannot be an empty string.");
+ QString theString = inName.IsEmpty() ? QObject::tr("Object name cannot be an empty string.")
+ : QObject::tr("Object name cannot contain a dot.");
g_StudioApp.GetDialogs()->DisplayMessageBox(theTitle, theString,
Qt3DSMessageBox::ICON_ERROR, false);
-
return;
}
CClientDataModelBridge *theBridge = m_StudioSystem->GetClientDataModelBridge();
const auto doc = g_StudioApp.GetCore()->GetDoc();
-
// Display warning if the name and path are the same as the material container
if (theBridge->GetParentInstance(m_DataHandle) == doc->GetSceneInstance()
&& inName.toQString() == theBridge->getMaterialContainerName()) {
diff --git a/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTreeLabel.cpp b/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTreeLabel.cpp
index a5431b14..7428c47c 100644
--- a/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTreeLabel.cpp
+++ b/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTreeLabel.cpp
@@ -168,6 +168,10 @@ void RowTreeLabel::validateLabel()
emit labelChanged("");
setLabel(m_label);
return;
+ } else if (text.contains(QChar('.'))) {
+ emit labelChanged(".");
+ setLabel(m_label);
+ return;
}
setLabel(text);