mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-16 19:28:07 -06:00
Toggle visibility of filter field when pressing the "search" icon
This commit is contained in:
parent
7e4f1dce7b
commit
933ed5177f
2 changed files with 25 additions and 7 deletions
|
@ -18,9 +18,23 @@ Item
|
||||||
signal showTooltip(Item item, point location, string text);
|
signal showTooltip(Item item, point location, string text);
|
||||||
signal hideTooltip();
|
signal hideTooltip();
|
||||||
|
|
||||||
|
function toggleFilterField()
|
||||||
|
{
|
||||||
|
filterContainer.visible = !filterContainer.visible
|
||||||
|
if(filterContainer.visible)
|
||||||
|
{
|
||||||
|
filter.forceActiveFocus();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
filter.text = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle
|
Rectangle
|
||||||
{
|
{
|
||||||
id: filterContainer
|
id: filterContainer
|
||||||
|
visible: false
|
||||||
|
|
||||||
border.width: UM.Theme.getSize("default_lining").width
|
border.width: UM.Theme.getSize("default_lining").width
|
||||||
border.color:
|
border.color:
|
||||||
|
@ -45,7 +59,8 @@ Item
|
||||||
right: parent.right
|
right: parent.right
|
||||||
rightMargin: UM.Theme.getSize("default_margin").width
|
rightMargin: UM.Theme.getSize("default_margin").width
|
||||||
}
|
}
|
||||||
height: UM.Theme.getSize("setting_control").height
|
height: visible ? UM.Theme.getSize("setting_control").height : 0
|
||||||
|
Behavior on height { NumberAnimation { duration: 100 } }
|
||||||
|
|
||||||
TextField
|
TextField
|
||||||
{
|
{
|
||||||
|
@ -125,7 +140,7 @@ Item
|
||||||
onClicked:
|
onClicked:
|
||||||
{
|
{
|
||||||
filter.text = "";
|
filter.text = "";
|
||||||
filter.setActiveFocus();
|
filter.forceActiveFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -136,7 +151,8 @@ Item
|
||||||
anchors.bottom: parent.bottom;
|
anchors.bottom: parent.bottom;
|
||||||
anchors.right: parent.right;
|
anchors.right: parent.right;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
anchors.topMargin: UM.Theme.getSize("default_margin").width
|
anchors.topMargin: filterContainer.visible ? UM.Theme.getSize("default_margin").width : 0
|
||||||
|
Behavior on anchors.topMargin { NumberAnimation { duration: 100 } }
|
||||||
|
|
||||||
style: UM.Theme.styles.scrollview;
|
style: UM.Theme.styles.scrollview;
|
||||||
flickableItem.flickableDirection: Flickable.VerticalFlick;
|
flickableItem.flickableDirection: Flickable.VerticalFlick;
|
||||||
|
|
|
@ -214,7 +214,7 @@ Rectangle
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.leftMargin: model.index * (settingsModeSelection.width / 2)
|
anchors.leftMargin: model.index * (settingsModeSelection.width / 2)
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
width: 0.5 * parent.width - (index == 1 ? toggleFilterButton.width : 0)
|
width: 0.5 * parent.width - (modesListModel.get(index).showFilterButton ? toggleFilterButton.width : 0)
|
||||||
text: model.text
|
text: model.text
|
||||||
exclusiveGroup: modeMenuGroup;
|
exclusiveGroup: modeMenuGroup;
|
||||||
checkable: true;
|
checkable: true;
|
||||||
|
@ -268,9 +268,11 @@ Rectangle
|
||||||
height: settingsModeSelection.height
|
height: settingsModeSelection.height
|
||||||
width: visible ? height : 0
|
width: visible ? height : 0
|
||||||
|
|
||||||
visible: !monitoringPrint && base.currentModeIndex == 1
|
visible: !monitoringPrint && modesListModel.get(base.currentModeIndex).showFilterButton
|
||||||
opacity: visible ? 1 : 0
|
opacity: visible ? 1 : 0
|
||||||
|
|
||||||
|
onClicked: sidebarContents.currentItem.toggleFilterField()
|
||||||
|
|
||||||
style: ButtonStyle
|
style: ButtonStyle
|
||||||
{
|
{
|
||||||
background: Rectangle
|
background: Rectangle
|
||||||
|
@ -415,8 +417,8 @@ Rectangle
|
||||||
|
|
||||||
Component.onCompleted:
|
Component.onCompleted:
|
||||||
{
|
{
|
||||||
modesListModel.append({ text: catalog.i18nc("@title:tab", "Recommended"), item: sidebarSimple })
|
modesListModel.append({ text: catalog.i18nc("@title:tab", "Recommended"), item: sidebarSimple, showFilterButton: false })
|
||||||
modesListModel.append({ text: catalog.i18nc("@title:tab", "Custom"), item: sidebarAdvanced })
|
modesListModel.append({ text: catalog.i18nc("@title:tab", "Custom"), item: sidebarAdvanced, showFilterButton: true })
|
||||||
sidebarContents.push({ "item": modesListModel.get(base.currentModeIndex).item, "immediate": true });
|
sidebarContents.push({ "item": modesListModel.get(base.currentModeIndex).item, "immediate": true });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue