Skip to content
Permalink
Browse files

[expression builder] fixes #11247

  • Loading branch information
slarosa committed Sep 23, 2014
1 parent 72a33ea commit bad94e00c11230015aa7e3b19c07631f869c6854
Showing with 16 additions and 3 deletions.
  1. +8 −0 src/gui/qgscodeeditor.cpp
  2. +5 −0 src/gui/qgscodeeditor.h
  3. +3 −3 src/gui/qgsexpressionbuilderwidget.cpp
@@ -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();
}

0 comments on commit bad94e0

Please sign in to comment.
You can’t perform that action at this time.