Skip to content

Commit b2c404d

Browse files
committedSep 20, 2015
Improve expression help
1 parent 6bfdafe commit b2c404d

File tree

4 files changed

+24
-11
lines changed

4 files changed

+24
-11
lines changed
 

‎resources/function_help/json/concat

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
22
"function": "concat",
3-
"description": "Concatenates several strings to one.",
3+
"description": "Concatenates several strings to one. NULL values are converted to empty strings.",
44
"variableLenArguments": true,
55
"arguments": [ {"arg":"string1", "syntaxOnly": true},
66
{"arg":"string2", "syntaxOnly": true},
77
{"arg":"string", "descOnly": true, "description":"a string value"}],
8-
"examples": [ { "expression":"concat('a','b','c','d','e')", "returns":"'abcde'"}]
8+
"examples": [ { "expression":"concat('a','b','c','d','e')", "returns":"'abcde'"},
9+
{ "expression":"concat('The Wall', NULL)", "returns":"'The Wall'"}]
910
}

‎resources/function_help/text/AND

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ Returns 1 when condition a and b are true.
77
<h4>Arguments</h4>
88
None
99

10-
<h4>Example</h4>
11-
<pre> 4 = 2+2 AND 1 = 1 &rarr; returns 1 </pre>
12-
<pre> 4 = 2+2 AND 1 = 2 &rarr; returns 0 </pre>
10+
<h4>Examples</h4>
11+
<pre> TRUE AND TRUE &rarr; 1 </pre>
12+
<pre> TRUE AND FALSE &rarr; 0 </pre>
13+
<pre> 4 = 2+2 AND 1 = 1 &rarr; 1 </pre>
14+
<pre> 4 = 2+2 AND 1 = 2 &rarr; 0 </pre>
1315

‎resources/function_help/text/||

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<h3>|| concatenation operator</h3>
2+
<p>Joins two values together into a string.</p>
3+
<p>If one of the values is NULL the result will be NULL. See the CONCAT function for a different behavior.</p>
4+
5+
<h4>Syntax</h4>
6+
<pre> value1 || value2</pre>
7+
8+
<h4>Arguments</h4>
9+
None
10+
11+
<h4>Examples</h4>
12+
<pre> 'Here ' || 'and ' || 'there' &rarr; 'Here and there' </pre>
13+
<pre> 'Nothing' || NULL &rarr; NULL </pre>
14+
<pre> 1 || 2 &rarr; '12' </pre>

‎src/gui/qgsexpressionbuilderwidget.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ void QgsExpressionBuilderWidget::registerItem( QString group,
362362
newgroupNode->setData( group, Qt::UserRole );
363363
newgroupNode->setData( group == "Recent (Selection)" ? 2 : 1, QgsExpressionItem::CustomSortRole );
364364
newgroupNode->appendRow( item );
365+
newgroupNode->setBackground( QBrush( QColor( "#eee" ) ) );
365366
mModel->appendRow( newgroupNode );
366367
mExpressionGroups.insert( group, newgroupNode );
367368
}
@@ -439,12 +440,7 @@ void QgsExpressionBuilderWidget::updateFunctionTree()
439440
registerItem( "Operators", "<>", " <> ", tr( "Unequal operator" ) );
440441
registerItem( "Operators", "<=", " <= ", tr( "Less or equal operator" ) );
441442
registerItem( "Operators", ">=", " >= ", tr( "Greater or equal operator" ) );
442-
registerItem( "Operators", "||", " || ",
443-
QString( "<b>|| %1</b><br><i>%2</i><br><i>%3:</i>%4" )
444-
.arg( tr( "(String Concatenation)" ) )
445-
.arg( tr( "Joins two values together into a string" ) )
446-
.arg( tr( "Usage" ) )
447-
.arg( tr( "'Dia' || Diameter" ) ) );
443+
registerItem( "Operators", "||", " || " );
448444
registerItem( "Operators", "IN", " IN " );
449445
registerItem( "Operators", "LIKE", " LIKE " );
450446
registerItem( "Operators", "ILIKE", " ILIKE " );

0 commit comments

Comments
 (0)
Please sign in to comment.