1010import QtQuick
1111
1212import mm 1.0 as MM
13- import "../../components"
13+ import "../../components" as MMComponents
1414
1515Column {
1616 id: root
@@ -27,7 +27,7 @@ Column {
2727
2828 spacing: __style .margin8
2929
30- MMText {
30+ MMComponents . MMText {
3131 width: parent .width
3232
3333 text: root .filterName
@@ -71,10 +71,10 @@ Column {
7171 // TODO: add indication that model is loading features
7272 // TODO: add animation when drawer height is changed
7373
74- sourceComponent: MMListMultiselectDrawer {
74+ sourceComponent: MMComponents . MMListMultiselectDrawer {
7575 drawerHeader .title : root .filterName
7676
77- withSearch: true
77+ withSearch: vrDropdownModel . count > 5
7878 multiSelect: root .isMultiSelect
7979
8080 list .model : MM .ValueRelationFeaturesModel {
@@ -88,36 +88,23 @@ Column {
8888
8989 onSelectionFinished : function ( selectedItems ) {
9090
91- if ( root .isMultiSelect )
92- {
93- let isNull = selectedItems .length === 0
94-
95- if ( ! isNull )
96- {
97- // We need to convert feature id to string prior to sending it to C++ in order to
98- // avoid conversion to scientific notation.
99- selectedItems = selectedItems .map ( function (x ) { return x .toString () } )
100- }
101-
102- root .currentValue = vrDropdownModel .convertToQgisType ( selectedItems ).replace ( " {" ," " ).replace ( " }" ," " ).split ( ' ,' ).filter ( x => x )
103- }
104- else
105- {
106- // We need to convert feature id to string prior to sending it to C++ in order to
107- // avoid conversion to scientific notation.
108- selectedItems = selectedItems .toString ()
109-
110- root .currentValue = [vrDropdownModel .convertToKey ( selectedItems )]
111- }
91+ //
92+ // We need to convert from feature IDs to key-column.
93+ // Large fids could be converted to scientific notation on their way to cpp,
94+ // so we convert them to string first in JS.
95+ //
96+ selectedItems = selectedItems .map ( x => x .toString () ).map ( x => vrDropdownModel .convertToKey ( x ) )
11297
113- console . log ( " --> selected items: " , selectedItems)
98+ root . currentValue = selectedItems
11499
115100 // TODO: this is just a hack, we need to add a dedicated signal instead, Qt does not always get that array length has changed
116101 root .currentValueChanged ()
117102
118103 close ()
119104 }
120105
106+ onSearchTextChanged : ( searchText ) => vrDropdownModel .searchExpression = searchText
107+
121108 onClosed: dropdownDrawerLoader .active = false
122109
123110 Component .onCompleted : {
0 commit comments