28284 Commits

Author SHA1 Message Date
Juergen E. Fischer
93d45a0452 fix translation string 2015-08-22 14:12:29 +02:00
Juergen E. Fischer
97c8e1ab57 scripts: run python scripts through autopep8 2015-08-22 13:30:57 +02:00
Nyall Dawson
81d7ce7e5d Show message in dd menu if no variables set 2015-08-22 19:01:43 +10:00
Nyall Dawson
4dea16ad0b Show user-set variables in data defined buttons 2015-08-22 19:01:43 +10:00
Nyall Dawson
8f6669fcb5 Fix missing QgsExpressionContext::isReadOnly definition 2015-08-22 19:01:43 +10:00
Nyall Dawson
d7b74748c8 Fix filtering of highlighted variables 2015-08-22 19:01:43 +10:00
Nyall Dawson
4bf8b131e3 Port conditional styles to expression contexts 2015-08-22 19:01:43 +10:00
Nyall Dawson
440926bbc4 Sort functions and variables in expression builder 2015-08-22 19:01:42 +10:00
Nyall Dawson
85bda6c05f Add method for highlighting variables in the expression builder 2015-08-22 19:01:42 +10:00
Nyall Dawson
334ea504db Add help for project_color function 2015-08-22 19:01:42 +10:00
Nyall Dawson
f74db81b9a Hide contextual functions from builder unless provided by context 2015-08-22 19:01:42 +10:00
Nyall Dawson
2a951ec945 Add some missing expression group help 2015-08-22 19:01:42 +10:00
Nyall Dawson
6487f1716c Add help text for variables 2015-08-22 19:01:42 +10:00
Nyall Dawson
00892ce068 Tweak context for composer items
- Attribute tables have access to layer context when applicable
- Frames have access to parent multiframe's context
2015-08-22 19:01:42 +10:00
Nyall Dawson
be26c61bc4 Ensure expression context is available to expression builders
called from field expression widgets
2015-08-22 19:01:42 +10:00
Nyall Dawson
1c1e574d64 More contexts for expression builder dialogs 2015-08-22 19:01:42 +10:00
Nyall Dawson
a7d8519c7f Ensure context is available to builders from data defined buttons 2015-08-22 19:01:42 +10:00
Nyall Dawson
bfc8f56ad4 Display variables and functions from contexts in expression builder 2015-08-22 19:01:42 +10:00
Nyall Dawson
c9c12bc7f9 Fix warnings 2015-08-22 19:01:41 +10:00
Nyall Dawson
2edc85c086 Final porting to expression contexts 2015-08-22 19:01:41 +10:00
Nyall Dawson
54f1b9bdd4 Port expression selection dialog to contexts 2015-08-22 19:01:41 +10:00
Nyall Dawson
0ed1644c50 Fix handling of expression contexts with feature requests 2015-08-22 19:01:41 +10:00
Nyall Dawson
cc6feae835 More misc porting to expression contexts 2015-08-22 19:01:41 +10:00
Nyall Dawson
000a62f33c More gui expression porting 2015-08-22 19:01:41 +10:00
Nyall Dawson
786de4b820 Port server to expression contexts 2015-08-22 19:01:41 +10:00
Nyall Dawson
a1e21f3994 Port providers to expression contexts 2015-08-22 19:01:41 +10:00
Nyall Dawson
f108dcd7c0 Follow up diagram porting 2015-08-22 19:01:41 +10:00
Nyall Dawson
430303dfc9 Port diagrams to expression contexts 2015-08-22 19:01:40 +10:00
Nyall Dawson
f82c641a3d Port attribute actions to expression contexts 2015-08-22 19:01:40 +10:00
Nyall Dawson
3b6f5915e7 Port iterators to expression contexts 2015-08-22 19:01:40 +10:00
Nyall Dawson
fdfb804580 Port some GUI classes to expression contexts 2015-08-22 19:01:40 +10:00
Nyall Dawson
89a362c448 Cleanups 2015-08-22 19:01:40 +10:00
Nyall Dawson
43bcc0c2a5 Finish porting composer to expression contexts 2015-08-22 19:01:40 +10:00
Nyall Dawson
5cb874c2aa More composer porting 2015-08-22 19:01:40 +10:00
Nyall Dawson
cf22025860 Set the expression context for map canvas renders 2015-08-22 19:01:40 +10:00
Nyall Dawson
0cab6b3376 Port renderers to expression contexts 2015-08-22 19:01:40 +10:00
Nyall Dawson
d6d6827b6e Port symbols to expression contexts 2015-08-22 19:01:40 +10:00
Nyall Dawson
1a7acb0d98 Port labelling to expression contexts 2015-08-22 19:01:40 +10:00
Nyall Dawson
5e03016b3a Update QgsDataDefined for expression contexts 2015-08-22 19:01:40 +10:00
Nyall Dawson
2bb1c8a31b Start on implementing contexts for render operations 2015-08-22 19:01:39 +10:00
Nyall Dawson
a0e35a3893 Switch some composer expressions to contexts 2015-08-22 19:01:39 +10:00
Nyall Dawson
f9a78207a7 Port QgsExpression tests to contexts 2015-08-22 19:01:39 +10:00
Nyall Dawson
c1adf623af Port field calculator to contexts 2015-08-22 19:01:39 +10:00
Nyall Dawson
cf3cf19124 Port virtual fields to expression contexts 2015-08-22 19:01:39 +10:00
Nyall Dawson
d6542276e7 Add a bunch of layer related variables, including things like
metadata, extent, crs, feature count, geometry types, etc...
2015-08-22 19:01:39 +10:00
Nyall Dawson
1c7a5b2dba Add editor widget for editing QgsExpressionContextScope variables 2015-08-22 19:01:39 +10:00
Nyall Dawson
05b15dc3c5 Test porting evaluation to contexts 2015-08-22 19:01:39 +10:00
Nyall Dawson
f6e0ce788e New framework for context based expressions
This commit adds the ability for expressions to be evaluated against
specific contexts. It replaces the previous behaviour where
expressions were evaluated against a specific feature and could
utilise fragile global "special columns".

Now, expressions are instead evaluated using a context designed for
each individual expression. This is done via QgsExpressionContext
and QgsExpressionContextScope objects.

A QgsExpressionContextScope encapsulates the variables and functions
relating to a specific context. For instance, scopes can be created
for "global" variables (such as QGIS version, platform, and user-set
variables specified within the QGIS options dialog. Think things
like user name, work department, etc), or for "project" variables
(eg project path, title, filename, and user-set variables set
through the project properties dialog. Project version, reference
number, that kind of thing). Many more scopes are planned, including
map layer scopes (variables for layer name, id, user-set variables
through the layer properties dialog), composer scopes, etc...

QgsExpressionContextScopes are 'stacked' into a QgsExpressionContext
object. Scopes added later to a QgsExpressionContext will override
any variables or functions provided by earlier scopes, so for
instance a user could override their global 'author' variable set
within QGIS options with a different 'author' set via the project
properties dialog.

The intended use is that a QgsExpressionContext is created before
a batch set of QgsExpression evaluations. Scopes are then added to
the context based on what makes sense for that particular
expression. Eg, almost all contexts will consist of the global
scope and project scope, and then additional scopes as required.
So a composer label would be evaluated against a context
consisting of the global scope, project scope, composition scope
and finally composer item scope. The batch set of expression
evaluations would then be performed using this context, after which
the context is discarded. In other words, a context is designed
for use for one specific set of expression evaluations only.
2015-08-22 19:01:39 +10:00
Nyall Dawson
f5de32779f Add missing sip changes 2015-08-22 19:01:39 +10:00
Nyall Dawson
57669e71c0 Make QgsRenderContext available to more renderer methods 2015-08-22 19:01:38 +10:00