mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-08-03 16:58:24 +02:00
[ui] tab to focus search bar + click on empty area to loose focus
This commit is contained in:
parent
e24310d1a1
commit
b829a2d9f4
4 changed files with 53 additions and 10 deletions
|
@ -9,7 +9,10 @@ import QtQuick.Controls 2.3
|
|||
* This is useful if the value is not directly accessible from the model and needs
|
||||
* some extra logic.
|
||||
*
|
||||
* Regarding filtering, any type of value can be used as 'filterValue' (variant).
|
||||
* Regarding filtering, each filter is defined with a role to filter on and a value to match.
|
||||
* Filters can be accumulated in a 2D-array, which is evaluated with the following rules:
|
||||
* - on the 2nd dimension we map respectFilter and reduce with logical OR
|
||||
* - on the 1st dimension we map respectFilter and reduce with logical AND.
|
||||
* Filtering behavior can also be overridden by redefining the respectFilter function.
|
||||
*
|
||||
* Based on http://doc.qt.io/qt-5/qtquick-tutorials-dynamicview-dynamicview4-example.html
|
||||
|
@ -19,7 +22,7 @@ DelegateModel {
|
|||
|
||||
property string sortRole: "" /// the role to use for sorting
|
||||
property int sortOrder: Qt.AscendingOrder /// the sorting order
|
||||
property var filters: []
|
||||
property var filters: [] /// filter format: {role: "roleName", value: "filteringValue"}
|
||||
|
||||
onSortRoleChanged: invalidateSort()
|
||||
onSortOrderChanged: invalidateSort()
|
||||
|
@ -95,6 +98,7 @@ DelegateModel {
|
|||
}
|
||||
}
|
||||
|
||||
/// Apply respectFilter mapping and logical AND/OR reduction on filters
|
||||
function respectFilters(item) {
|
||||
let cond = (filter => respectFilter(modelData(item, filter.role), filter.value));
|
||||
return filters.every(x => Array.isArray(x) ? x.some(cond) : cond(x));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue