Commit c743d36b authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇
Browse files

[Colors / Desktop Theme KCM] Use Kirigami.SearchField

Gets rid of some code duplication.

Differential Revision: https://phabricator.kde.org/D25462
parent 17a5a00d
......@@ -23,7 +23,7 @@ import QtQuick.Layouts 1.1
import QtQuick.Window 2.2
import QtQuick.Dialogs 1.0 as QtDialogs
import QtQuick.Controls 2.3 as QtControls
import org.kde.kirigami 2.4 as Kirigami
import org.kde.kirigami 2.8 as Kirigami
import org.kde.newstuff 1.62 as NewStuff
import org.kde.kcm 1.1 as KCM
import org.kde.private.kcms.colors 1.0 as Private
......@@ -90,41 +90,9 @@ KCM.GridViewKCM {
RowLayout {
Layout.fillWidth: true
QtControls.TextField {
Kirigami.SearchField {
id: searchField
Layout.fillWidth: true
placeholderText: i18n("Search...")
leftPadding: LayoutMirroring.enabled ? clearButton.width : undefined
rightPadding: LayoutMirroring.enabled ? undefined : clearButton.width
// this could be useful as a component
MouseArea {
id: clearButton
anchors {
top: parent.top
topMargin: parent.topPadding
right: parent.right
// the TextField's padding is taking into account the clear button's size
// so we just use the opposite one for positioning the clear button
rightMargin: LayoutMirroring.enabled ? parent.rightPadding: parent.leftPadding
bottom: parent.bottom
bottomMargin: parent.bottomPadding
}
width: height
opacity: searchField.length > 0 ? 1 : 0
onClicked: searchField.clear()
Kirigami.Icon {
anchors.fill: parent
active: parent.pressed
source: "edit-clear-locationbar-" + (LayoutMirroring.enabled ? "ltr" : "rtl")
}
Behavior on opacity {
NumberAnimation { duration: Kirigami.Units.longDuration }
}
}
}
QtControls.ComboBox {
......
......@@ -23,7 +23,7 @@ import QtQuick 2.1
import QtQuick.Layouts 1.1
import QtQuick.Dialogs 1.0
import QtQuick.Controls 2.3 as QtControls
import org.kde.kirigami 2.4 as Kirigami
import org.kde.kirigami 2.8 as Kirigami
import org.kde.newstuff 1.62 as NewStuff
import org.kde.kcm 1.1 as KCM
import org.kde.private.kcms.desktoptheme 1.0 as Private
......@@ -61,40 +61,9 @@ KCM.GridViewKCM {
header: RowLayout {
Layout.fillWidth: true
QtControls.TextField {
Kirigami.SearchField {
id: searchField
Layout.fillWidth: true
placeholderText: i18n("Search...")
leftPadding: LayoutMirroring.enabled ? clearButton.width : undefined
rightPadding: LayoutMirroring.enabled ? undefined : clearButton.width
// this could be useful as a component
MouseArea {
id: clearButton
anchors {
top: parent.top
topMargin: parent.topPadding
right: parent.right
// the TextField's padding is taking into account the clear button's size
// so we just use the opposite one for positioning the clear button
rightMargin: LayoutMirroring.enabled ? parent.rightPadding: parent.leftPadding
bottom: parent.bottom
bottomMargin: parent.bottomPadding
}
width: height
opacity: searchField.length > 0 ? 1 : 0
onClicked: searchField.clear()
Kirigami.Icon {
anchors.fill: parent
active: parent.pressed
source: "edit-clear-locationbar-" + (LayoutMirroring.enabled ? "ltr" : "rtl")
}
Behavior on opacity {
NumberAnimation { duration: Kirigami.Units.longDuration }
}
}
}
QtControls.ComboBox {
id: filterCombo
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment