forked from qt-creator/qt-creator
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:
@@ -73,16 +73,10 @@ HelperWidgets.ScrollView {
|
|||||||
|
|
||||||
caption: categoryName
|
caption: categoryName
|
||||||
visible: categoryVisible
|
visible: categoryVisible
|
||||||
expanded: categoryExpanded
|
|
||||||
expandOnClick: false
|
|
||||||
category: "ContentLib_User"
|
category: "ContentLib_User"
|
||||||
|
|
||||||
onToggleExpand: categoryExpanded = !categoryExpanded
|
|
||||||
onExpand: categoryExpanded = true
|
|
||||||
onCollapse: categoryExpanded = false
|
|
||||||
|
|
||||||
function expandSection() {
|
function expandSection() {
|
||||||
categoryExpanded = true
|
section.expanded = true
|
||||||
}
|
}
|
||||||
|
|
||||||
property alias count: repeater.count
|
property alias count: repeater.count
|
||||||
@@ -123,7 +117,7 @@ HelperWidgets.ScrollView {
|
|||||||
roleValue: "texture"
|
roleValue: "texture"
|
||||||
delegate: ContentLibraryTexture {
|
delegate: ContentLibraryTexture {
|
||||||
width: root.cellWidth
|
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
|
// onShowContextMenu: ctxMenu.popupMenu(modelData) // TODO
|
||||||
}
|
}
|
||||||
|
@@ -64,9 +64,6 @@ QVariant ContentLibraryUserModel::data(const QModelIndex &index, int role) const
|
|||||||
if (role == VisibleRole)
|
if (role == VisibleRole)
|
||||||
return true; // TODO
|
return true; // TODO
|
||||||
|
|
||||||
if (role == ExpandedRole)
|
|
||||||
return true; // TODO
|
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,7 +145,6 @@ QHash<int, QByteArray> ContentLibraryUserModel::roleNames() const
|
|||||||
static const QHash<int, QByteArray> roles {
|
static const QHash<int, QByteArray> roles {
|
||||||
{NameRole, "categoryName"},
|
{NameRole, "categoryName"},
|
||||||
{VisibleRole, "categoryVisible"},
|
{VisibleRole, "categoryVisible"},
|
||||||
{ExpandedRole, "categoryExpanded"},
|
|
||||||
{ItemsRole, "categoryItems"}
|
{ItemsRole, "categoryItems"}
|
||||||
};
|
};
|
||||||
return roles;
|
return roles;
|
||||||
@@ -289,7 +285,7 @@ void ContentLibraryUserModel::loadTextureBundle()
|
|||||||
}
|
}
|
||||||
|
|
||||||
int texSectionIdx = 1;
|
int texSectionIdx = 1;
|
||||||
emit dataChanged(index(texSectionIdx, 0), index(texSectionIdx, 0));
|
emit dataChanged(index(texSectionIdx), index(texSectionIdx));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContentLibraryUserModel::hasRequiredQuick3DImport() const
|
bool ContentLibraryUserModel::hasRequiredQuick3DImport() const
|
||||||
|
@@ -125,7 +125,7 @@ private:
|
|||||||
QString m_importerBundleId;
|
QString m_importerBundleId;
|
||||||
QStringList m_importerSharedFiles;
|
QStringList m_importerSharedFiles;
|
||||||
|
|
||||||
enum Roles { NameRole = Qt::UserRole + 1, VisibleRole, ExpandedRole, ItemsRole };
|
enum Roles { NameRole = Qt::UserRole + 1, VisibleRole, ItemsRole };
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
} // namespace QmlDesigner
|
||||||
|
Reference in New Issue
Block a user