QmlDesigner: Enable expanding content library user categories

Change-Id: Id3b49773b02e4922a06b71e6ed7a7098ed4d4062
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
This commit is contained in:
Mahmoud Badri
2024-04-17 13:07:56 +03:00
parent c709e6d555
commit ad408553af
3 changed files with 4 additions and 14 deletions

View File

@@ -73,16 +73,10 @@ HelperWidgets.ScrollView {
caption: categoryName
visible: categoryVisible
expanded: categoryExpanded
expandOnClick: false
category: "ContentLib_User"
onToggleExpand: categoryExpanded = !categoryExpanded
onExpand: categoryExpanded = true
onCollapse: categoryExpanded = false
function expandSection() {
categoryExpanded = true
section.expanded = true
}
property alias count: repeater.count
@@ -123,7 +117,7 @@ HelperWidgets.ScrollView {
roleValue: "texture"
delegate: ContentLibraryTexture {
width: root.cellWidth
height: root.cellHeight
height: root.cellWidth // for textures use a square size since there is no name row
// onShowContextMenu: ctxMenu.popupMenu(modelData) // TODO
}

View File

@@ -64,9 +64,6 @@ QVariant ContentLibraryUserModel::data(const QModelIndex &index, int role) const
if (role == VisibleRole)
return true; // TODO
if (role == ExpandedRole)
return true; // TODO
return {};
}
@@ -148,7 +145,6 @@ QHash<int, QByteArray> ContentLibraryUserModel::roleNames() const
static const QHash<int, QByteArray> roles {
{NameRole, "categoryName"},
{VisibleRole, "categoryVisible"},
{ExpandedRole, "categoryExpanded"},
{ItemsRole, "categoryItems"}
};
return roles;
@@ -289,7 +285,7 @@ void ContentLibraryUserModel::loadTextureBundle()
}
int texSectionIdx = 1;
emit dataChanged(index(texSectionIdx, 0), index(texSectionIdx, 0));
emit dataChanged(index(texSectionIdx), index(texSectionIdx));
}
bool ContentLibraryUserModel::hasRequiredQuick3DImport() const

View File

@@ -125,7 +125,7 @@ private:
QString m_importerBundleId;
QStringList m_importerSharedFiles;
enum Roles { NameRole = Qt::UserRole + 1, VisibleRole, ExpandedRole, ItemsRole };
enum Roles { NameRole = Qt::UserRole + 1, VisibleRole, ItemsRole };
};
} // namespace QmlDesigner