Skip to content
Permalink
Browse files

Expression builder: Rename Fields to Fields and Values; Add help for …

…when field is selected
  • Loading branch information
NathanW2 committed Feb 1, 2012
1 parent 7dca9dd commit dd12b010e5ac3d69c13591577c7c10495cef35b9
@@ -0,0 +1,4 @@
<h3>Field</h3>
Double click to add field name to expression string.
<br><br>
Right-Click on field name to open context menu sample value loading options.
@@ -0,0 +1,5 @@
<h3>Fields and Values</h3>
Contains a list of fields from the layer. Sample values can also be accessed via right-click.
<br><br>
Select the field name from the list then right-click to access context menu with options to load sample values from the selected field.

This file was deleted.

@@ -111,22 +111,16 @@ void QgsExpressionBuilderWidget::currentChanged( const QModelIndex &index, const

// Loading field values are handled with a
// right click so we just show the help.
if ( item->getItemType() == QgsExpressionItem::Field )
{
txtHelpText->setHtml( tr( "Double click to add field name to expression string. <br> "
"Or right click to select loading value options then "
"double click an item in the value list to add it to the expression string." ) );
txtHelpText->setToolTip( txtHelpText->toPlainText() );
}
else
if ( item->getItemType() != QgsExpressionItem::Field )
{
// Show the help for the current item.
mValueGroupBox->hide();
mValueListWidget->clear();
QString help = loadFunctionHelp( item );
txtHelpText->setText( help );
txtHelpText->setToolTip( txtHelpText->toPlainText() );

mValueGroupBox->hide();
mValueListWidget->clear();
}
// Show the help for the current item.
QString help = loadFunctionHelp( item );
txtHelpText->setText( help );
txtHelpText->setToolTip( txtHelpText->toPlainText() );
}

void QgsExpressionBuilderWidget::on_expressionTree_doubleClicked( const QModelIndex &index )
@@ -165,7 +159,7 @@ void QgsExpressionBuilderWidget::loadFieldNames( QgsFieldMap fields )
{
QString fieldName = field.name();
fieldNames << fieldName;
registerItem( tr( "Fields" ), fieldName, " \"" + fieldName + "\" ", "", QgsExpressionItem::Field );
registerItem( tr( "Fields and Values" ), fieldName, " \"" + fieldName + "\" ", "", QgsExpressionItem::Field );
}
highlighter->addFields( fieldNames );
}
@@ -243,7 +237,6 @@ void QgsExpressionBuilderWidget::on_txtExpressionString_textChanged()
lblPreview->setStyleSheet( "" );
txtExpressionString->setToolTip( "" );
lblPreview->setToolTip( "" );
// Return false for isValid because a null expression is still invalid.
emit expressionParsed( false );
return;
}
@@ -404,7 +397,13 @@ QString QgsExpressionBuilderWidget::loadFunctionHelp( QgsExpressionItem* functio
{
lang = "en_US";
}
QString fullHelpPath = helpFilesPath + functionName->text() + "-" + lang;

QString name = functionName->text();

if ( functionName->getItemType() == QgsExpressionItem::Field )
name = "Field";

QString fullHelpPath = helpFilesPath + name + "-" + lang;
// get the help content and title from the localized file
QString helpContents;
QFile file( fullHelpPath );
@@ -413,7 +412,7 @@ QString QgsExpressionBuilderWidget::loadFunctionHelp( QgsExpressionItem* functio
QString missingError = tr("<h3>Opps! QGIS can't find help for this function.</h3>"
"The help file for %1 was not found for your language<br>"
"If you would like to create it, contact the QGIS development team"
).arg( functionName->text() );
).arg( name );
if ( !file.exists() )
{
// change the file name to the en_US version (default)

0 comments on commit dd12b01

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