mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
Merge pull request #1589 from slarosa/fix11247
[expression builder] fixes #11247
This commit is contained in:
commit
d37f75f2b9
@ -106,6 +106,14 @@ void QgsCodeEditor::setFoldingVisible( bool folding )
|
||||
}
|
||||
}
|
||||
|
||||
void QgsCodeEditor::insertText( QString theText )
|
||||
{
|
||||
int line, index;
|
||||
getCursorPosition( &line, &index );
|
||||
insertAt( theText, line, index );
|
||||
setCursorPosition( line, index + theText.length() );
|
||||
}
|
||||
|
||||
// Settings for font and fontsize
|
||||
bool QgsCodeEditor::isFixedPitch( const QFont& font )
|
||||
{
|
||||
|
@ -60,6 +60,11 @@ class GUI_EXPORT QgsCodeEditor : public QsciScintilla
|
||||
void setFoldingVisible( bool folding );
|
||||
bool foldingVisible() { return mFolding; }
|
||||
|
||||
/** Isert text at cursor position
|
||||
* @param theText The text to be inserted
|
||||
*/
|
||||
void insertText( QString theText );
|
||||
|
||||
protected:
|
||||
|
||||
bool isFixedPitch( const QFont& font );
|
||||
|
@ -158,7 +158,7 @@ void QgsExpressionBuilderWidget::on_expressionTree_doubleClicked( const QModelIn
|
||||
return;
|
||||
|
||||
// Insert the expression text.
|
||||
txtExpressionString->insert( item->getExpressionText() );
|
||||
txtExpressionString->insertText( item->getExpressionText() );
|
||||
txtExpressionString->setFocus();
|
||||
}
|
||||
|
||||
@ -392,14 +392,14 @@ void QgsExpressionBuilderWidget::on_lblPreview_linkActivated( QString link )
|
||||
|
||||
void QgsExpressionBuilderWidget::on_mValueListWidget_itemDoubleClicked( QListWidgetItem *item )
|
||||
{
|
||||
txtExpressionString->insert( " " + item->text() + " " );
|
||||
txtExpressionString->insertText( " " + item->text() + " " );
|
||||
txtExpressionString->setFocus();
|
||||
}
|
||||
|
||||
void QgsExpressionBuilderWidget::operatorButtonClicked()
|
||||
{
|
||||
QPushButton* button = dynamic_cast<QPushButton*>( sender() );
|
||||
txtExpressionString->insert( " " + button->text() + " " );
|
||||
txtExpressionString->insertText( " " + button->text() + " " );
|
||||
txtExpressionString->setFocus();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user