File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change 28
28
#include < QPushButton>
29
29
#include < QHeaderView>
30
30
#include < QMessageBox>
31
-
31
+ # include < QClipboard >
32
32
33
33
//
34
34
// QgsVariableEditorWidget
@@ -627,6 +627,25 @@ void QgsVariableEditorTree::keyPressEvent( QKeyEvent *event )
627
627
default :
628
628
break ;
629
629
}
630
+
631
+ if ( event == QKeySequence::Copy )
632
+ {
633
+ QList<QTreeWidgetItem *> selected = selectedItems ();
634
+ if ( selected.size () > 0 )
635
+ {
636
+ QString text = selected.at ( 0 )->text ( 0 );
637
+ QString varName = variableNameFromItem ( selected.at ( 0 ) );
638
+ QgsExpressionContextScope *scope = scopeFromItem ( selected.at ( 0 ) );
639
+ if ( !varName.isEmpty () && scope )
640
+ text = scope->variable ( varName ).toString ();
641
+
642
+ QClipboard *clipboard = QApplication::clipboard ();
643
+ clipboard->setText ( text );
644
+ event->accept ();
645
+ return ;
646
+ }
647
+ }
648
+
630
649
QTreeWidget::keyPressEvent ( event );
631
650
}
632
651
You can’t perform that action at this time.
0 commit comments