diff options
author | Miikka Heikkinen <miikka.heikkinen@qt.io> | 2018-08-16 13:22:08 +0300 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@qt.io> | 2018-08-20 08:06:52 +0000 |
commit | 91ed79dc3d59b02ba2834f3c7155b7461607d8d8 (patch) | |
tree | 8799f2bcb81fe4bd17a25850da68bc406089a06e /src/Authoring/Studio/Palettes/Inspector/ChooserModelBase.cpp | |
parent | 6fddac4ca5fdb10d0f3cb7d247ed20bc362c5013 (diff) |
Display sub-presentations in inspector image choosers
Subpresentations can now be selected as images from image chooser.
Selecting a subpresentation will show it also as the image
property value of the material. Manually setting subpresentation
from image properties is disabled, though the value is still shown.
Task-number: QT3DS-2090
Change-Id: Ie02898c0e111c16b2b27368b03901d2adc20fa91
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Reviewed-by: Janne Kangas <janne.kangas@qt.io>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Diffstat (limited to 'src/Authoring/Studio/Palettes/Inspector/ChooserModelBase.cpp')
-rw-r--r-- | src/Authoring/Studio/Palettes/Inspector/ChooserModelBase.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/Authoring/Studio/Palettes/Inspector/ChooserModelBase.cpp b/src/Authoring/Studio/Palettes/Inspector/ChooserModelBase.cpp index 681c5e5c..f20c3425 100644 --- a/src/Authoring/Studio/Palettes/Inspector/ChooserModelBase.cpp +++ b/src/Authoring/Studio/Palettes/Inspector/ChooserModelBase.cpp @@ -136,8 +136,15 @@ QVariant ChooserModelBase::data(const QModelIndex &index, int role) const return path == m_currentFile; } + case QFileSystemModel::FileNameRole: { + QString displayName = specialDisplayName(item); + if (displayName.isEmpty()) + displayName = m_model->data(item.index, QFileSystemModel::FileNameRole).toString(); + return displayName; + } + default: - return m_model->data(item.index, role); + return m_model->data(item.index, role).toString(); } } } @@ -179,8 +186,6 @@ void ChooserModelBase::setCurrentFile(const QString &path) m_currentFile = fullPath; - const int fixedItemCount = fixedItems.count(); - if (previousRow != -1) Q_EMIT dataChanged(index(previousRow), index(previousRow)); @@ -377,6 +382,12 @@ EStudioObjectType ChooserModelBase::getIconType(const QString &path) const return Q3DStudio::ImportUtils::GetObjectFileTypeForFile(Q3DStudio::CFilePath(path)).m_IconType; } +QString ChooserModelBase::specialDisplayName(const ChooserModelBase::TreeItem &item) const +{ + Q_UNUSED(item) + return {}; +} + QString ChooserModelBase::getIconName(const QString &path) const { QString iconName; |