Skip to content

Commit

Permalink
Use selected text in label combo box for start off expression text
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanW2 committed Jun 19, 2011
1 parent 6610187 commit d954421
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/app/qgslabelinggui.cpp
Expand Up @@ -34,7 +34,6 @@
#include <QApplication>
#include <QMessageBox>


QgsLabelingGui::QgsLabelingGui( QgsPalLabeling* lbl, QgsVectorLayer* layer, QgsMapCanvas* mapCanvas, QWidget* parent )
: QDialog( parent ), mLBL( lbl ), mLayer( layer ), mMapCanvas( mapCanvas )
{
Expand Down Expand Up @@ -470,6 +469,9 @@ void QgsLabelingGui::showExpressionDialog()
connect(buttonBox,SIGNAL( accepted() ),dlg,SLOT( accept() ) );
connect(buttonBox,SIGNAL( rejected() ),dlg,SLOT( reject() ) );

// Set the current expression using the selected text in the combo box.
builder->setExpressionString(this->cboFieldName->currentText());

if ( dlg->exec() == QDialog::Accepted )
{
QString expression = builder->getExpressionString();
Expand Down
6 changes: 6 additions & 0 deletions src/gui/qgsexpressionbuilder.cpp
Expand Up @@ -32,3 +32,9 @@ QString QgsExpressionBuilder::getExpressionString()
{
return this->txtExpressionString->toPlainText();
}

void QgsExpressionBuilder::setExpressionString(const QString expressionString)
{
this->txtExpressionString->setPlainText(expressionString);
}

1 change: 1 addition & 0 deletions src/gui/qgsexpressionbuilder.h
Expand Up @@ -26,6 +26,7 @@ class QgsExpressionBuilder : public QWidget, private Ui::QgsExpressionBuilder {
~QgsExpressionBuilder();

QString getExpressionString();
void setExpressionString(const QString expressionString);
};

#endif // QGSEXPRESSIONBUILDER_H

0 comments on commit d954421

Please sign in to comment.