Use re-usable search-bar for Settings search as well.

done as part of CURA-8559
This commit is contained in:
Remco Burema 2021-11-16 10:20:08 +01:00
parent 24eaad4c6d
commit 87f94e680b
No known key found for this signature in database
GPG Key ID: 215C49431D43F98C
2 changed files with 6 additions and 28 deletions

View File

@ -15,6 +15,7 @@ Cura.TextField
leftPadding: searchIcon.width + UM.Theme.getSize("default_margin").width * 2 leftPadding: searchIcon.width + UM.Theme.getSize("default_margin").width * 2
placeholderText: catalog.i18nc("@placeholder", "Search") placeholderText: catalog.i18nc("@placeholder", "Search")
font.italic: true
UM.RecolorImage UM.RecolorImage
{ {

View File

@ -41,39 +41,19 @@ Item
repeat: false repeat: false
} }
Cura.TextField Cura.SearchBar
{ {
id: filter id: filter
height: parent.height height: parent.height
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
leftPadding: searchIcon.width + UM.Theme.getSize("default_margin").width * 2
placeholderText: catalog.i18nc("@label:textbox", "Search settings") placeholderText: catalog.i18nc("@label:textbox", "Search settings") // Overwrite
font.italic: true
property var expandedCategories property var expandedCategories
property bool lastFindingSettings: false property bool lastFindingSettings: false
UM.RecolorImage onTextChanged: settingsSearchTimer.restart()
{
id: searchIcon
anchors
{
verticalCenter: parent.verticalCenter
left: parent.left
leftMargin: UM.Theme.getSize("default_margin").width
}
source: UM.Theme.getIcon("search")
height: UM.Theme.getSize("small_button_icon").height
width: height
color: UM.Theme.getColor("text")
}
onTextChanged:
{
settingsSearchTimer.restart()
}
onEditingFinished: onEditingFinished:
{ {
@ -86,10 +66,7 @@ Item
} }
} }
Keys.onEscapePressed: Keys.onEscapePressed: filter.text = ""
{
filter.text = ""
}
function updateDefinitionModel() function updateDefinitionModel()
{ {