File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -585,6 +585,38 @@ void QgsVariableEditorTree::editNext( const QModelIndex& index )
585
585
}
586
586
}
587
587
588
+ QModelIndex QgsVariableEditorTree::moveCursor ( QAbstractItemView::CursorAction cursorAction, Qt::KeyboardModifiers modifiers )
589
+ {
590
+ if ( cursorAction == QAbstractItemView::MoveNext )
591
+ {
592
+ QModelIndex index = currentIndex ();
593
+ if ( index.isValid () )
594
+ {
595
+ if ( index.column () + 1 < model ()->columnCount () )
596
+ return index.sibling ( index.row (), index.column () + 1 );
597
+ else if ( index.row () + 1 < model ()->rowCount ( index.parent () ) )
598
+ return index.sibling ( index.row () + 1 , 0 );
599
+ else
600
+ return QModelIndex ();
601
+ }
602
+ }
603
+ else if ( cursorAction == QAbstractItemView::MovePrevious )
604
+ {
605
+ QModelIndex index = currentIndex ();
606
+ if ( index.isValid () )
607
+ {
608
+ if ( index.column () >= 1 )
609
+ return index.sibling ( index.row (), index.column () - 1 );
610
+ else if ( index.row () >= 1 )
611
+ return index.sibling ( index.row () - 1 , model ()->columnCount () - 1 );
612
+ else
613
+ return QModelIndex ();
614
+ }
615
+ }
616
+
617
+ return QTreeWidget::moveCursor ( cursorAction, modifiers );
618
+ }
619
+
588
620
void QgsVariableEditorTree::keyPressEvent ( QKeyEvent *event )
589
621
{
590
622
switch ( event->key () )
Original file line number Diff line number Diff line change @@ -186,6 +186,8 @@ class QgsVariableEditorTree : public QTreeWidget
186
186
void toggleContextExpanded ( QTreeWidgetItem *item );
187
187
void editNext ( const QModelIndex &index );
188
188
189
+ QModelIndex moveCursor ( CursorAction cursorAction, Qt::KeyboardModifiers modifiers ) override ;
190
+
189
191
static QIcon mExpandIcon ;
190
192
191
193
private:
You can’t perform that action at this time.
0 commit comments