1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-07 03:22:33 +01:00

Refactor search to be selectable and add icons

This commit is contained in:
Elias Steurer 2021-02-21 17:15:37 +01:00
parent bc9648327e
commit 1b049643d8

View File

@ -279,36 +279,53 @@ Item {
leftMargin: 10 leftMargin: 10
} }
Rectangle {
anchors.fill: parent
color: Material.theme === Material.Light ? "white" : Qt.darker(
Material.background)
opacity: .95
radius: 3
}
TextField { TextField {
id: tiSearch id: tiSearch
anchors { anchors {
top: parent.top top: parent.top
right: parent.right right: parent.right
rightMargin: 10
bottom: parent.bottom bottom: parent.bottom
left: parent.left left: parent.left
leftMargin: 10 leftMargin: 10
} }
leftPadding:25
selectByMouse:true
placeholderText: qsTr("Search for Wallpaper and Widgets...") placeholderText: qsTr("Search for Wallpaper and Widgets...")
onTextChanged: timerSearch.restart() onTextChanged: timerSearch.restart()
Timer { Timer {
id: timerSearch id: timerSearch
interval: 300 interval: 500
onTriggered: steamWorkshop.workshopListModel.searchWorkshopByText( onTriggered: steamWorkshop.workshopListModel.searchWorkshopByText(
tiSearch.text) tiSearch.text)
} }
} }
Image {
source: "qrc:/assets/icons/icon_search.svg"
width: 14
height: width
sourceSize: Qt.size(width,width)
anchors {
left: parent.left
leftMargin: 15
verticalCenter: parent.verticalCenter
}
}
ToolButton {
id:tb
enabled: tiSearch.text !== ""
anchors {
right: parent.right
verticalCenter: parent.verticalCenter
}
text: "X"
onClicked: tiSearch.text = ""
}
} }
Row { RowLayout {
spacing: 20 spacing: 20
anchors { anchors {
left: searchWrapper.right left: searchWrapper.right
@ -317,6 +334,10 @@ Item {
rightMargin: 20 rightMargin: 20
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
} }
Item {
Layout.fillWidth: true
Layout.fillHeight: true
}
Button { Button {
text: qsTr("Open Workshop in Steam") text: qsTr("Open Workshop in Steam")
font.capitalization: Font.Capitalize font.capitalization: Font.Capitalize
@ -326,6 +347,7 @@ Item {
icon.source: "qrc:/assets/icons/icon_steam.svg" icon.source: "qrc:/assets/icons/icon_steam.svg"
icon.width: 18 icon.width: 18
icon.height: 18 icon.height: 18
height: cbQuerySort.height
} }
Button { Button {
text: qsTr("Open GameHub in Steam") text: qsTr("Open GameHub in Steam")
@ -336,6 +358,7 @@ Item {
icon.source: "qrc:/assets/icons/icon_steam.svg" icon.source: "qrc:/assets/icons/icon_steam.svg"
icon.width: 18 icon.width: 18
icon.height: 18 icon.height: 18
height: cbQuerySort.height
} }
} }