forked from qt-creator/qt-creator
QmlDesigner: Expand material browser sections when searching
Make sure material browser sections that have matches are expanded while searching. Fixes: QDS-7836 Change-Id: Ie30c5425e8efee65cc4bdfa473b269841e73a9d3 Reviewed-by: Samuel Ghinet <samuel.ghinet@qt.io> Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
@@ -241,7 +241,22 @@ Item {
|
|||||||
|
|
||||||
width: root.width - addMaterialButton.width
|
width: root.width - addMaterialButton.width
|
||||||
|
|
||||||
onSearchChanged: (searchText) => rootView.handleSearchFilterChanged(searchText)
|
onSearchChanged: (searchText) => {
|
||||||
|
rootView.handleSearchFilterChanged(searchText)
|
||||||
|
|
||||||
|
// make sure searched categories that have matches are expanded
|
||||||
|
if (!materialBrowserModel.isEmpty && !userMaterialsSection.expanded)
|
||||||
|
userMaterialsSection.expanded = true
|
||||||
|
|
||||||
|
if (!materialBrowserBundleModel.isEmpty && !bundleMaterialsSection.expanded)
|
||||||
|
bundleMaterialsSection.expanded = true
|
||||||
|
|
||||||
|
for (let i = 0; i < bundleMaterialsSectionRepeater.count; ++i) {
|
||||||
|
let sec = bundleMaterialsSectionRepeater.itemAt(i)
|
||||||
|
if (sec.visible && !sec.expanded)
|
||||||
|
sec.expanded = true
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IconButton {
|
IconButton {
|
||||||
@@ -338,6 +353,8 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Section {
|
Section {
|
||||||
|
id: bundleMaterialsSection
|
||||||
|
|
||||||
width: root.width
|
width: root.width
|
||||||
caption: qsTr("Material Library")
|
caption: qsTr("Material Library")
|
||||||
addTopPadding: noMatchText.visible
|
addTopPadding: noMatchText.visible
|
||||||
@@ -345,6 +362,8 @@ Item {
|
|||||||
|
|
||||||
Column {
|
Column {
|
||||||
Repeater {
|
Repeater {
|
||||||
|
id: bundleMaterialsSectionRepeater
|
||||||
|
|
||||||
model: materialBrowserBundleModel
|
model: materialBrowserBundleModel
|
||||||
|
|
||||||
delegate: Section {
|
delegate: Section {
|
||||||
|
Reference in New Issue
Block a user