mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-08-02 08:18:25 +02:00
[ui] Controls: add SearchBar component + better keyboard focus handling
* use it in MetadataListView and GraphEditor 'add Node' menu * GraphEditor: forward MenuItem key events to searchBar to be able to continue editing the filter even if it lost active focus
This commit is contained in:
parent
b5c985b3fb
commit
b46a2dbba1
4 changed files with 62 additions and 28 deletions
41
meshroom/ui/qml/Controls/SearchBar.qml
Normal file
41
meshroom/ui/qml/Controls/SearchBar.qml
Normal file
|
@ -0,0 +1,41 @@
|
|||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.3
|
||||
import QtQuick.Layouts 1.3
|
||||
import MaterialIcons 2.2
|
||||
|
||||
|
||||
/**
|
||||
* Basic SearchBar component with an appropriate icon and a TextField.
|
||||
*/
|
||||
FocusScope {
|
||||
property alias textField: field
|
||||
property alias text: field.text
|
||||
|
||||
implicitHeight: childrenRect.height
|
||||
Keys.forwardTo: [field]
|
||||
|
||||
function forceActiveFocus() {
|
||||
field.forceActiveFocus()
|
||||
}
|
||||
|
||||
function clear() {
|
||||
field.clear()
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
width: parent.width
|
||||
|
||||
MaterialLabel {
|
||||
text: MaterialIcons.search
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: field
|
||||
focus: true
|
||||
Layout.fillWidth: true
|
||||
selectByMouse: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4,3 +4,4 @@ FloatingPane 1.0 FloatingPane.qml
|
|||
Group 1.0 Group.qml
|
||||
MessageDialog 1.0 MessageDialog.qml
|
||||
Panel 1.0 Panel.qml
|
||||
SearchBar 1.0 SearchBar.qml
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue