summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@qt.io>2019-06-26 12:47:27 +0300
committerMiikka Heikkinen <miikka.heikkinen@qt.io>2019-06-28 17:27:26 +0300
commit2edc96fe8921747b71d165c71bc2ea78087e7635 (patch)
tree929692717e33a913eab156b6c35ce9ecf21d7429
parente379951c649b41ca1d284dc6cf56d1a4aa84ab06 (diff)
Fix grouping in "Set datainput controller" menu, studio part
Properties were grouped according to property type, which was confusing. Changed the grouping to be by group, which makes more sense, and results in same ordering of properties as the inspector. Task-number: QT3DS-3373 Change-Id: I7317d79f86c1f20881c3166f0f76e4b1f7ea7573 Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTreeContextMenu.cpp57
1 files changed, 28 insertions, 29 deletions
diff --git a/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTreeContextMenu.cpp b/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTreeContextMenu.cpp
index ae5c0bbb..cde22595 100644
--- a/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTreeContextMenu.cpp
+++ b/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTreeContextMenu.cpp
@@ -75,40 +75,39 @@ void RowTreeContextMenu::initialize()
m_diMenu = addMenu(tr("Set datainput controller"));
connect(m_diMenu, &QMenu::triggered, this, &RowTreeContextMenu::addDiController);
- QVector<qt3dsdm::Qt3DSDMPropertyHandle> propList;
-
// If this is a referenced material instance, we need to get the property list from
// the referenced source, and set datainput control to point to the property
// in the referenced source.
auto refInstance = doc.GetStudioSystem()->GetClientDataModelBridge()
->getMaterialReference(instance);
- propList = doc.GetStudioSystem()->GetPropertySystem()
- ->GetControllableProperties(refInstance ? refInstance : instance);
-
- QMap<int, QAction *> sections;
- for (const auto &prop : propList) {
- QAction *action
- = new QAction(QString::fromStdWString(doc.GetPropertySystem()
- ->GetFormalName(
- refInstance ? refInstance : instance,
- prop).wide_str()));
- action->setData(QString::fromStdWString(
- doc.GetPropertySystem()
- ->GetName(prop).wide_str()));
-
- auto metadata = doc.GetStudioSystem()->GetActionMetaData()->GetMetaDataPropertyInfo(
- doc.GetStudioSystem()->GetActionMetaData()->GetMetaDataProperty(
- refInstance ? refInstance : instance, prop));
-
- if (sections.contains(metadata->m_CompleteType) ) {
- m_diMenu->insertAction(sections[metadata->m_CompleteType], action);
- } else {
- // Create a QAction for a section so that we can insert properties above it
- // to maintain category groupings. Sections are shown as separators in Studio
- // style i.e. enum text is not shown.
- QAction *section = m_diMenu->addSection(QString(metadata->m_CompleteType));
- sections.insert(metadata->m_CompleteType, section);
- m_diMenu->insertAction(section, action);
+ const QVector<QPair<QString, QVector<qt3dsdm::Qt3DSDMPropertyHandle>>> propGroups
+ = doc.GetStudioSystem()->GetPropertySystem()
+ ->GetControllableProperties(refInstance ? refInstance : instance);
+
+ QMap<QString, QAction *> sections;
+ for (const auto &propGroup : propGroups) {
+ const QString group = propGroup.first;
+ const auto &propList = propGroup.second;
+ for (const auto &prop : propList) {
+ QAction *action
+ = new QAction(QString::fromStdWString(
+ doc.GetPropertySystem()->GetFormalName(
+ refInstance ? refInstance : instance,
+ prop).wide_str()));
+ action->setData(QString::fromStdWString(
+ doc.GetPropertySystem()
+ ->GetName(prop).wide_str()));
+
+ if (sections.contains(group) ) {
+ m_diMenu->insertAction(sections[group], action);
+ } else {
+ // Create a QAction for a section so that we can insert properties above it
+ // to maintain category groupings. Sections are shown as separators in Studio
+ // style i.e. enum text is not shown.
+ QAction *section = m_diMenu->addSection(group);
+ sections.insert(group, section);
+ m_diMenu->insertAction(section, action);
+ }
}
}
}