File tree Expand file tree Collapse file tree 3 files changed +16
-3
lines changed Expand file tree Collapse file tree 3 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -106,6 +106,14 @@ void QgsCodeEditor::setFoldingVisible( bool folding )
106
106
}
107
107
}
108
108
109
+ void QgsCodeEditor::insertText ( QString theText )
110
+ {
111
+ int line, index;
112
+ getCursorPosition ( &line, &index );
113
+ insertAt ( theText, line, index );
114
+ setCursorPosition ( line, index + theText.length () );
115
+ }
116
+
109
117
// Settings for font and fontsize
110
118
bool QgsCodeEditor::isFixedPitch ( const QFont& font )
111
119
{
Original file line number Diff line number Diff line change @@ -60,6 +60,11 @@ class GUI_EXPORT QgsCodeEditor : public QsciScintilla
60
60
void setFoldingVisible ( bool folding );
61
61
bool foldingVisible () { return mFolding ; }
62
62
63
+ /* * Isert text at cursor position
64
+ * @param theText The text to be inserted
65
+ */
66
+ void insertText ( QString theText );
67
+
63
68
protected:
64
69
65
70
bool isFixedPitch ( const QFont& font );
Original file line number Diff line number Diff line change @@ -158,7 +158,7 @@ void QgsExpressionBuilderWidget::on_expressionTree_doubleClicked( const QModelIn
158
158
return ;
159
159
160
160
// Insert the expression text.
161
- txtExpressionString->insert ( item->getExpressionText () );
161
+ txtExpressionString->insertText ( item->getExpressionText () );
162
162
txtExpressionString->setFocus ();
163
163
}
164
164
@@ -392,14 +392,14 @@ void QgsExpressionBuilderWidget::on_lblPreview_linkActivated( QString link )
392
392
393
393
void QgsExpressionBuilderWidget::on_mValueListWidget_itemDoubleClicked ( QListWidgetItem *item )
394
394
{
395
- txtExpressionString->insert ( " " + item->text () + " " );
395
+ txtExpressionString->insertText ( " " + item->text () + " " );
396
396
txtExpressionString->setFocus ();
397
397
}
398
398
399
399
void QgsExpressionBuilderWidget::operatorButtonClicked ()
400
400
{
401
401
QPushButton* button = dynamic_cast <QPushButton*>( sender () );
402
- txtExpressionString->insert ( " " + button->text () + " " );
402
+ txtExpressionString->insertText ( " " + button->text () + " " );
403
403
txtExpressionString->setFocus ();
404
404
}
405
405
You can’t perform that action at this time.
0 commit comments