@@ -9,7 +9,6 @@ ColumnLayout {
99    property variant entries:  []
1010    property var  columnWidths:  [parent .width  /  5 , parent .width  /  5 , parent .width  /  5 , parent .width  /  5 , parent .width  /  5 ]
1111    property real mouse_x:  0 
12-     property int selectedRow:  - 1 
1312
1413    spacing:  Constants .networking .layoutSpacing 
1514
@@ -19,7 +18,7 @@ ColumnLayout {
1918        Layout .fillWidth :  true 
2019        Layout .preferredHeight :  Constants .genericTable .cellHeight 
2120        interactive:  false 
22-         syncView:  table 
21+         syncView:  tableView 
2322        z:  Constants .genericTable .headerZOffset 
2423
2524        delegate:  Rectangle {
@@ -32,7 +31,7 @@ ColumnLayout {
3231                anchors .centerIn :  parent
3332                horizontalAlignment:  Text .AlignHCenter 
3433                verticalAlignment:  Text .AlignVCenter 
35-                 text:  table .model .columns [index].display 
34+                 text:  tableView .model .columns [index].display 
3635                elide:  Text .ElideRight 
3736                clip:  true 
3837                font .family :  Constants .genericTable .fontFamily 
@@ -51,12 +50,12 @@ ColumnLayout {
5150                    if  (pressed) {
5251                        var  delta_x =  (mouseX -  mouse_x);
5352                        var  next_idx =  (index +  1 ) %  5 ;
54-                         var  min_width =  table .width  /  10 ;
53+                         var  min_width =  tableView .width  /  10 ;
5554                        if  (columnWidths[index] +  delta_x >  min_width &&  columnWidths[next_idx] -  delta_x >  min_width) {
5655                            columnWidths[index] +=  delta_x;
5756                            columnWidths[next_idx] -=  delta_x;
5857                        }
59-                         table .forceLayout ();
58+                         tableView .forceLayout ();
6059                    }
6160                }
6261            }
@@ -79,8 +78,13 @@ ColumnLayout {
7978    }
8079
8180    TableView {
82-         id:  table 
81+         id:  tableView 
8382
83+         property int selectedRow:  - 1 
84+ 
85+         Component .onCompleted :  {
86+             Globals .tablesWithHighlights .push (this );
87+         }
8488        columnSpacing:  - 1 
8589        rowSpacing:  - 1 
8690        columnWidthProvider :  function (column ) {
@@ -91,7 +95,7 @@ ColumnLayout {
9195        Layout .fillWidth :  true 
9296        Layout .fillHeight :  true 
9397        onWidthChanged:  {
94-             table .forceLayout ();
98+             tableView .forceLayout ();
9599        }
96100
97101        ScrollBar .horizontal :  ScrollBar {
@@ -127,9 +131,9 @@ ColumnLayout {
127131
128132        delegate:  Rectangle {
129133            implicitHeight:  Constants .genericTable .cellHeight 
130-             implicitWidth:  table .columnWidthProvider (column)
134+             implicitWidth:  tableView .columnWidthProvider (column)
131135            border .color :  Constants .genericTable .borderColor 
132-             color:  row ==  selectedRow ?  Constants .genericTable .cellHighlightedColor  :  Constants .genericTable .cellColor 
136+             color:  row ==  tableView . selectedRow  ?  Constants .genericTable .cellHighlightedColor  :  Constants .genericTable .cellColor 
133137
134138            Label {
135139                width:  parent .width 
@@ -147,11 +151,13 @@ ColumnLayout {
147151                height:  parent .height 
148152                anchors .centerIn :  parent
149153                onPressed:  {
150-                     if  (selectedRow ==  row) {
151-                         selectedRow =  - 1 ;
154+                     Globals .clearHighlightedRows ();
155+                     tableView .focus  =  true ;
156+                     if  (tableView .selectedRow  ==  row) {
157+                         tableView .selectedRow  =  - 1 ;
152158                    } else  {
153-                         selectedRow =  row;
154-                         Globals .copyClipboard  =  JSON .stringify (table .model .getRow (selectedRow));
159+                         tableView . selectedRow  =  row;
160+                         Globals .copyClipboard  =  JSON .stringify (tableView .model .getRow (tableView . selectedRow ));
155161                    }
156162                }
157163            }
@@ -176,7 +182,7 @@ ColumnLayout {
176182                new_row[Constants .networking .columnHeaders [2 ]] =  entries[idx][2 ];
177183                new_row[Constants .networking .columnHeaders [3 ]] =  entries[idx][3 ];
178184                new_row[Constants .networking .columnHeaders [4 ]] =  entries[idx][4 ];
179-                 table .model .setRow (idx, new_row);
185+                 tableView .model .setRow (idx, new_row);
180186            }
181187        }
182188    }
0 commit comments