summaryrefslogtreecommitdiffstats
path: root/src/Authoring/Studio/Application/DataInputListDlg.cpp
diff options
context:
space:
mode:
authorJanne Kangas <janne.kangas@qt.io>2018-08-22 10:31:47 +0300
committerJanne Kangas <janne.kangas@qt.io>2018-09-11 04:17:24 +0000
commit1880495b000c3bc4eac819120c2dccfb03e4ce52 (patch)
treee679e1d4b0b938bbb254b7646deeabd986aeb406 /src/Authoring/Studio/Application/DataInputListDlg.cpp
parentda2a184d9f9497a41601519411c43f1881f41691 (diff)
Parse datainput use from subpresentation files and check allowable types
Search through controlledproperty tags in UIP files of subpresentations and store subpresentation id and datatypes controlled per datainput. Datainput that is in use in another presentation is indicated by highlight in datainput management dialog, similarly to ones in use in the current presentation. Task-id: QT3DS-2142 Change-Id: I7e40154e41863ff6123bb85348868f44ef0733cc Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Diffstat (limited to 'src/Authoring/Studio/Application/DataInputListDlg.cpp')
-rw-r--r--src/Authoring/Studio/Application/DataInputListDlg.cpp32
1 files changed, 29 insertions, 3 deletions
diff --git a/src/Authoring/Studio/Application/DataInputListDlg.cpp b/src/Authoring/Studio/Application/DataInputListDlg.cpp
index 238e3f3f..3b7cb0e2 100644
--- a/src/Authoring/Studio/Application/DataInputListDlg.cpp
+++ b/src/Authoring/Studio/Application/DataInputListDlg.cpp
@@ -187,7 +187,7 @@ void CDataInputListDlg::updateContents()
dataInput.append(new QStandardItem(tr("Variant")));
}
// highlight datainputs that are in use
- if (it->controlledElems.size() != 0)
+ if (it->controlledElems.size() || it->externalPresBoundTypes.size())
dataInput.first()->setForeground(QBrush(CStudioPreferences::dataInputColor()));
m_tableContents->appendRow(dataInput);
}
@@ -292,7 +292,10 @@ void CDataInputListDlg::onEditDataInput()
// Only show types that are ok for _all_ currently controlled properties.
// If datainput is not controlling any elements, all types are ok.
+
+ // Datainput binding types
QVector<EDataType> allowedTypes;
+ bool strictFound = false;
if (di->controlledElems.size()) {
for (auto type : qAsConst(di->boundTypes)) {
// If we hit strict type requirement for a certain bound datatype, set allowed types
@@ -309,13 +312,36 @@ void CDataInputListDlg::onEditDataInput()
allowedTypes.append(t);
}
// if we just hit a strict type requirement we are finished
+ if (type.second) {
+ strictFound = true;
+ break;
+ }
+ }
+ }
+
+ // Datainput bindings for all other presentations, unless we already have a
+ // strict type requirement
+ if (di->externalPresBoundTypes.size() && !strictFound) {
+ for (auto type : qAsConst(di->externalPresBoundTypes)) {
+ if (type.second)
+ allowedTypes.clear();
+
+ const auto acceptedTypes = CDataInputDlg::getAcceptedTypes(type.first, type.second);
+
+ for (auto t : acceptedTypes) {
+ if (!allowedTypes.contains(t))
+ allowedTypes.append(t);
+ }
+ // if we just hit a strict type requirement we are finished
if (type.second)
break;
}
- } else {
- allowedTypes = allDataTypes;
}
+ // no bindings in this or other presentations, all datatypes are ok
+ if (!allowedTypes.size())
+ allowedTypes = allDataTypes;
+
CDataInputDlg datainputdialog(&di, m_tableContents, this, allowedTypes);
datainputdialog.exec();