forked from qt-creator/qt-creator
QmlDesigner: Generalize property search for nested sections
Effects aren't the only case of properties inside nested sections, so generalized the parent section visibility to not rely on specific property being set for the child section. Fixes: QDS-15579 Change-Id: I9e47e7669f8bdb9f3b6354ea54f99fa0bc18be37 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
@@ -186,8 +186,6 @@ Section {
|
|||||||
spacing: 1
|
spacing: 1
|
||||||
|
|
||||||
Section {
|
Section {
|
||||||
readonly property bool __isInEffectsSection: true // used by property search logic
|
|
||||||
|
|
||||||
sectionHeight: 37
|
sectionHeight: 37
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
@@ -235,8 +233,6 @@ Section {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Section {
|
Section {
|
||||||
readonly property bool __isInEffectsSection: true // used by property search logic
|
|
||||||
|
|
||||||
sectionHeight: 37
|
sectionHeight: 37
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
@@ -311,8 +307,6 @@ Section {
|
|||||||
Section {
|
Section {
|
||||||
id: delegate
|
id: delegate
|
||||||
|
|
||||||
readonly property bool __isInEffectsSection: true // used by property search logic
|
|
||||||
|
|
||||||
property QtObject wrapper: modelNodeBackend.registerSubSelectionWrapper(modelData)
|
property QtObject wrapper: modelNodeBackend.registerSubSelectionWrapper(modelData)
|
||||||
property bool wasExpanded: false
|
property bool wasExpanded: false
|
||||||
|
|
||||||
|
@@ -63,7 +63,7 @@ Rectangle {
|
|||||||
internal.clear();
|
internal.clear();
|
||||||
const searchText = searchBox.text.toLowerCase();
|
const searchText = searchBox.text.toLowerCase();
|
||||||
if (searchText.length > 0) {
|
if (searchText.length > 0) {
|
||||||
internal.traverse(root.contentItem, searchText);
|
internal.traverse(root.contentItem, searchText, false);
|
||||||
internal.searched = true;
|
internal.searched = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -98,7 +98,7 @@ Rectangle {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function traverse(item, searchText) {
|
function traverse(item, searchText, isInSection) {
|
||||||
let hideSection = true;
|
let hideSection = true;
|
||||||
let hideParentSection = true;
|
let hideParentSection = true;
|
||||||
item.children.forEach((child, index, arr) => {
|
item.children.forEach((child, index, arr) => {
|
||||||
@@ -135,13 +135,14 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
hideSection &= internal.traverse(child, searchText);
|
hideSection &= internal.traverse(child, searchText,
|
||||||
|
isInSection || child instanceof HelperWidgets.Section);
|
||||||
if (child instanceof HelperWidgets.Section) {
|
if (child instanceof HelperWidgets.Section) {
|
||||||
const action = hideSection ? internal.enableSearchHideAction
|
const action = hideSection ? internal.enableSearchHideAction
|
||||||
: internal.expandSectionAction;
|
: internal.expandSectionAction;
|
||||||
action(child);
|
action(child);
|
||||||
|
|
||||||
if (child.__isInEffectsSection && !hideSection)
|
if (isInSection && !hideSection)
|
||||||
hideParentSection = false;
|
hideParentSection = false;
|
||||||
|
|
||||||
hideSection = true;
|
hideSection = true;
|
||||||
|
Reference in New Issue
Block a user