mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-12 01:07:52 -06:00
Add a "clear filter" button
This commit is contained in:
parent
1c92b9ee0e
commit
3da5e9de4e
1 changed files with 91 additions and 34 deletions
|
@ -18,10 +18,24 @@ Item
|
||||||
signal showTooltip(Item item, point location, string text);
|
signal showTooltip(Item item, point location, string text);
|
||||||
signal hideTooltip();
|
signal hideTooltip();
|
||||||
|
|
||||||
TextField
|
Rectangle
|
||||||
{
|
{
|
||||||
id: filter;
|
id: filterContainer
|
||||||
visible: !monitoringPrint
|
|
||||||
|
border.width: UM.Theme.getSize("default_lining").width
|
||||||
|
border.color:
|
||||||
|
{
|
||||||
|
if(mouseArea.containsMouse || clearFilterButton.containsMouse)
|
||||||
|
{
|
||||||
|
return UM.Theme.getColor("setting_control_border_highlight");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return UM.Theme.getColor("setting_control_border");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
color: UM.Theme.getColor("setting_control")
|
||||||
|
|
||||||
anchors
|
anchors
|
||||||
{
|
{
|
||||||
|
@ -31,6 +45,16 @@ 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
|
||||||
|
|
||||||
|
TextField
|
||||||
|
{
|
||||||
|
id: filter;
|
||||||
|
visible: !monitoringPrint
|
||||||
|
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: clearFilterButton.left
|
||||||
|
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||||
|
|
||||||
placeholderText: catalog.i18nc("@label:textbox", "Filter...")
|
placeholderText: catalog.i18nc("@label:textbox", "Filter...")
|
||||||
|
|
||||||
|
@ -38,19 +62,14 @@ Item
|
||||||
{
|
{
|
||||||
textColor: UM.Theme.getColor("setting_control_text");
|
textColor: UM.Theme.getColor("setting_control_text");
|
||||||
font: UM.Theme.getFont("default");
|
font: UM.Theme.getFont("default");
|
||||||
background: Rectangle
|
background: Item {}
|
||||||
{
|
|
||||||
border.width: UM.Theme.getSize("default_lining").width
|
|
||||||
border.color: control.hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border")
|
|
||||||
|
|
||||||
color: UM.Theme.getColor("setting_control")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
property var expandedCategories
|
property var expandedCategories
|
||||||
property bool lastFindingSettings: false
|
property bool lastFindingSettings: false
|
||||||
|
|
||||||
onTextChanged: {
|
onTextChanged:
|
||||||
|
{
|
||||||
definitionsModel.filter = {"label": "*" + text};
|
definitionsModel.filter = {"label": "*" + text};
|
||||||
findingSettings = (text.length > 0);
|
findingSettings = (text.length > 0);
|
||||||
if(findingSettings != lastFindingSettings)
|
if(findingSettings != lastFindingSettings)
|
||||||
|
@ -71,11 +90,49 @@ Item
|
||||||
lastFindingSettings = findingSettings;
|
lastFindingSettings = findingSettings;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Keys.onEscapePressed:
|
||||||
|
{
|
||||||
|
filter.text = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea
|
||||||
|
{
|
||||||
|
id: mouseArea
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
acceptedButtons: Qt.NoButton
|
||||||
|
cursorShape: Qt.IBeamCursor
|
||||||
|
}
|
||||||
|
|
||||||
|
UM.SimpleButton
|
||||||
|
{
|
||||||
|
id: clearFilterButton
|
||||||
|
iconSource: UM.Theme.getIcon("cross1")
|
||||||
|
visible: findingSettings
|
||||||
|
|
||||||
|
height: parent.height * 0.4
|
||||||
|
width: visible ? height : 0
|
||||||
|
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||||
|
|
||||||
|
color: UM.Theme.getColor("setting_control_button")
|
||||||
|
hoverColor: UM.Theme.getColor("setting_control_button_hover")
|
||||||
|
|
||||||
|
onClicked:
|
||||||
|
{
|
||||||
|
filter.text = "";
|
||||||
|
filter.setActiveFocus();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ScrollView
|
ScrollView
|
||||||
{
|
{
|
||||||
anchors.top: filter.bottom;
|
anchors.top: filterContainer.bottom;
|
||||||
anchors.bottom: parent.bottom;
|
anchors.bottom: parent.bottom;
|
||||||
anchors.right: parent.right;
|
anchors.right: parent.right;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue