35 Commits

Author SHA1 Message Date
Nyall Dawson
fe221d54bf Don't return QStrings by reference, since they're implicitly shared
anyway
2015-10-28 09:47:44 +11:00
Nyall Dawson
f1633a1796 Change all signals to use const refs for non trivial objects 2015-10-26 22:46:25 +11:00
Nyall Dawson
70bff3f6aa Finish flipping a lot of methods to take const references for
non-trivial types
2015-10-26 22:46:14 +11:00
Nyall Dawson
c49b5b777f Change a lot of arguments to const references in core/gui
Rationale:
- there was a lot of large objects passed by value, so potentially
there's a speed bump from this
- even for implicitly shared classes like QString/QList there's still
a (small) cost for copying the objects when there's no reason to
- it's the right thing to do!
2015-10-07 12:02:04 +11: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
73522dce7e Refactor visibility presets, so that all non-app specific
methods are now in core

A new QgsVisibilityPresetCollection object has been created
which stores a set of visibility presets. QgsProject now
contains a preset collection object.

This allows plugins and other core objects to retrieve and
modify visibility presets.
2015-08-19 19:07:23 +10:00
Juergen E. Fischer
9752c468c1 indentation update 2015-07-29 11:52:14 +02:00
Juergen E. Fischer
e2e23f0c8e snapping dialog: block signals when reloading snapping options
QgsProject: also apply default when property is not available and not only if
an existing one is invalid

fixes #12192
2015-02-15 13:55:43 +01:00
Juergen E. Fischer
b49da36c7f * Save and restore visiblity state of embedded group layers (fixes #4097)
* Adds support for lists in custom properties
2015-01-13 14:55:03 +01:00
Juergen E. Fischer
9ceb5ceab6 sip sync 2014-11-21 01:17:21 +01:00
Nathan Woodrow
e5850f38b1 Fix #10858 - Set relative path to QLR save folder. Load relative to QLR file 2014-10-06 22:55:27 +10:00
Martin Dobias
73358c3a7e [layertree] Add python bindings - part one (core) 2014-06-03 19:27:28 +07:00
Juergen E. Fischer
a3628a6702 fix sip sync merge 2014-05-27 23:51:29 +02:00
Juergen E. Fischer
c4c131ef75 sip sync 2014-05-27 23:32:42 +02:00
Juergen E. Fischer
74e7314c36 update sip bindings II 2014-01-27 09:22:53 +01:00
Juergen E. Fischer
d4e369414b update sip bindings 2014-01-26 18:36:29 +01:00
Juergen E. Fischer
fa0a9b75fe don't reload the whole browser model when the project home changes (fixes #7520) 2013-05-12 23:23:24 +02:00
Matthias Kuhn
def681c226 Add API to write and read custom data to the layer in a .qgs-file.
New signals:
 * void QgsProject::writeMapLayer( QgsMapLayer*, QDomElement&,  QDomDocument& )
 * void QgsProject::readMapLayer( QgsMapLayer*, const QDomElement& )

Changed method signature:
 * bool QgsMapLayer::readXML( const QDomNode& )
   => bool QgsMapLayer::readLayerXML( const QDomElement& )
 * bool QgsMapLayer::writeXML( QDomNode&, QDomDocument& )
   => bool QgsMapLayer::writeLayerXML( QDomElement&, QDomDocument& )
2013-05-02 09:40:26 +02:00
Denis Rouzaud
706ac99a83 switched default and ok arguments 2013-03-06 15:07:04 +01:00
Denis Rouzaud
978d6773cb Added default value argument for readEntryList 2013-03-06 14:19:37 +01:00
Juergen E. Fischer
c918952c74 more sip fixes 2012-09-26 18:46:52 +02:00
Juergen E. Fischer
eef8627663 more sip fixes 2012-09-24 22:40:24 +02:00
Juergen E. Fischer
f3cb57b1eb SIP bindings update:
- update methods of existing classes
- add comment to methods missing in the sip bindings
- split up collective sip files into single files and use
  same directory structure in python/ as in src/
- add a lot of missing classes (some might not make sense because of
  missing python methods in those classes)
- remove some non-existing methods from the header files
- add scripts/sipdiff
- replace some usages of std::vector and std::set with QVector/QSet
2012-09-24 02:42:57 +02:00
Marco Hugentobler
31e504124a Add comments for new functions 2012-06-20 16:18:05 +02:00
Marco Hugentobler
618832252f Convenient access functions also for topological editing 2012-06-20 11:43:53 +02:00
Marco Hugentobler
1db042251e Write snap settings for a layer in a convenient way 2012-06-19 14:55:07 +02:00
Marco Hugentobler
654924d276 Implement QgsProject::snapSettingsForLayer as a convenient way to access snap properties for a layer 2012-06-19 14:10:15 +02:00
wonder
4bb5cad2cc Change in handling of missing layers within QgsProject. Instead of throwing an exception, now a custom handler is called
that might try to fix the missing layers. There's a default handler (QgsProjectBadLayerDefaultHandler) which simply ignores
all missing layers. Then there's a GUI handler (QgsProjectBadLayerGuiHandler) in GUI library which asks user about
the path for missing layers. QGIS application automatically installs the GUI handler on startup.

This should allow python plugins/applications to work with QgsProject without a fear of a segfault as there are no more
exceptions thrown during load/save of the project files.

Some further notes:
- removed QgsProjectBadLayerException class and (now empty) qgsexception.cpp file
- openFilesRememberingFilter() moved to QgisGui namespace (was duplicated: QgisApp vs QgsOpenVectorLayerDialog)
- removed deprecated buildVectorFilters_ methods
- added python bindings for new classes/methods


git-svn-id: http://svn.osgeo.org/qgis/trunk@12350 c8812cc2-4d05-0410-92ff-de0c093fc19c
2009-12-07 17:14:41 +00:00
wonder
90eac5ee05 Removed QgsIOException. From now if QgsProject's read() and write() functions return false, it's possible to find out the error message using error() function.
git-svn-id: http://svn.osgeo.org/qgis/trunk@12349 c8812cc2-4d05-0410-92ff-de0c093fc19c
2009-12-07 14:22:37 +00:00
jef
ddd64be82b improve relative path support
git-svn-id: http://svn.osgeo.org/qgis/trunk@11571 c8812cc2-4d05-0410-92ff-de0c093fc19c
2009-09-05 19:49:10 +00:00
timlinux
ab85a37ff6 Follow Qt naming style: fileName instead of filename, layerName instead of layerName
git-svn-id: http://svn.osgeo.org/qgis/trunk@9136 c8812cc2-4d05-0410-92ff-de0c093fc19c
2008-08-23 19:55:27 +00:00
timlinux
0636f412b2 Use fileName() instead of setFilename() for filename accessor
git-svn-id: http://svn.osgeo.org/qgis/trunk@9135 c8812cc2-4d05-0410-92ff-de0c093fc19c
2008-08-23 19:38:17 +00:00
timlinux
c6fb52f15d Further api consistency cleanups
git-svn-id: http://svn.osgeo.org/qgis/trunk@9134 c8812cc2-4d05-0410-92ff-de0c093fc19c
2008-08-23 19:15:03 +00:00
jef
31327f51fd Merged rest of composer branch (9087-9115)
git-svn-id: http://svn.osgeo.org/qgis/trunk@9125 c8812cc2-4d05-0410-92ff-de0c093fc19c
2008-08-23 09:19:49 +00:00
wonder
46a2d125a2 Merged refactoring branch back to trunk.
git-svn-id: http://svn.osgeo.org/qgis/trunk@6415 c8812cc2-4d05-0410-92ff-de0c093fc19c
2007-01-09 02:39:15 +00:00