diff options
author | Miikka Heikkinen <miikka.heikkinen@qt.io> | 2018-06-12 14:36:18 +0300 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@qt.io> | 2018-06-12 12:08:42 +0000 |
commit | c39d3e96e6e8725207eda830b9b5660bd2783a3e (patch) | |
tree | 0fea7da8d9fa1a43834eae0874f9935c3a390d24 /src/Authoring/Studio/Application/DataInputDlg.cpp | |
parent | 29e1fcfba128b1af20a67a02148a34e163b2d5b9 (diff) |
Fix datainput type issuesv2.0.0-rc2v2.0.0
- When adding a new data input the type is set correctly even if you
don't touch the type combo.
- When adding a new data input from popup menu for property, timeline,
or slide panel, the corresponding data input is not changed if the
new data input is of unsuitable type.
- Correct default type is shown for each property when setting data
input from inspector panel.
Task-number: QT3DS-1913
Change-Id: I704cb704fb1ec9aca916ed7f7542ace404bba77c
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Diffstat (limited to 'src/Authoring/Studio/Application/DataInputDlg.cpp')
-rw-r--r-- | src/Authoring/Studio/Application/DataInputDlg.cpp | 45 |
1 files changed, 37 insertions, 8 deletions
diff --git a/src/Authoring/Studio/Application/DataInputDlg.cpp b/src/Authoring/Studio/Application/DataInputDlg.cpp index 57c16e4d..c110452d 100644 --- a/src/Authoring/Studio/Application/DataInputDlg.cpp +++ b/src/Authoring/Studio/Application/DataInputDlg.cpp @@ -89,12 +89,7 @@ void CDataInputDlg::initDialog() if (!m_dataInput->name.isEmpty()) { m_name = m_dataInput->name; - m_type = m_dataInput->type; - m_ui->comboBoxTypeList->setCurrentIndex(m_dataInput->type); - m_ui->lineEditInputName->setText(m_dataInput->name); - if (m_type == DataTypeRangedNumber) { - m_ui->doubleSpinBoxMin->setValue(m_dataInput->minValue); - m_ui->doubleSpinBoxMax->setValue(m_dataInput->maxValue); + if (m_dataInput->type == DataTypeRangedNumber) { m_min = m_dataInput->minValue; m_max = m_dataInput->maxValue; } @@ -105,8 +100,18 @@ void CDataInputDlg::initDialog() #endif } else { m_name = getUniqueId(tr("newDataInput")); - m_ui->comboBoxTypeList->setCurrentIndex(m_dataInput->type); - m_ui->lineEditInputName->setText(m_name); + if (m_dataInput->type == DataTypeRangedNumber) { + m_dataInput->minValue = m_min; + m_dataInput->maxValue = m_max; + } + } + + m_type = m_dataInput->type; + m_ui->comboBoxTypeList->setCurrentIndex(m_type); + m_ui->lineEditInputName->setText(m_name); + if (m_type == DataTypeRangedNumber) { + m_ui->doubleSpinBoxMin->setValue(m_dataInput->minValue); + m_ui->doubleSpinBoxMax->setValue(m_dataInput->maxValue); } updateVisibility(m_dataInput->type); @@ -234,3 +239,27 @@ const bool CDataInputDlg::isEquivalentDataType(int dlgType, return false; } + +QVector<EDataType> CDataInputDlg::getAcceptedTypes(qt3dsdm::DataModelDataType::Value dmType) +{ + // The order also specifies the priority for default type in case of multiple accepted types + static const QVector<EDataType> allDataTypes = { + EDataType::DataTypeString, + EDataType::DataTypeFloat, + EDataType::DataTypeVector3, + EDataType::DataTypeVector2, + EDataType::DataTypeRangedNumber, + EDataType::DataTypeBoolean, +#ifdef DATAINPUT_EVALUATOR_ENABLED + EDataType::DataTypeEvaluator, +#endif + EDataType::DataTypeVariant + }; + + QVector<EDataType> acceptedTypes; + for (auto candidate : allDataTypes) { + if (isEquivalentDataType(candidate, dmType)) + acceptedTypes.append(candidate); + } + return acceptedTypes; +} |