33 Commits

Author SHA1 Message Date
Nyall Dawson
d0b5a01729 [api] Add registry and interface for QgsNumericFormats
QgsNumericFormat subclasses provide a means to format a numeric value
as a string, applying various formatting options. E.g. a default
string to value formatter (included here) includes settings for
controlling the number of decimal places, whether a thousands separator
should be shown, whether a leading + sign should be shown, whether
trailing zeros should be shown.

This PR also includes a formatter for bearings, allowing various
formats of numeric bearings to be applied (e.g. control over decimal
places, etc + control over whether direction E/W suffixes are shown,
or whether values should be limited to either the +/- 180 range or
0-360 degree range)

When formatting values, a QgsNumericFormatContext class is used
to provide context. Currently, this includes the thousands and
decimal separators to apply when formatting (which are taken by
default from the user's locale).

A registry of formatters is included to allow easy addition of
other formats in future (e.g. currencies, percentages, scientific
notation, etc...) and to allow plugin based formats.

The intention is to follow this up with gui configuration widgets
for the formats, and then expose them in various places through
the qgis ui (e.g. in the range editor widget for fields, in scalebar
numbers, as an option for formatting numeric labels, etc)
2020-01-08 16:20:43 +13:00
Alessandro Pasotti
381a57433c Drop const and fix duplicated "Source" 2019-10-26 08:13:47 +10:00
Alessandro Pasotti
1bc7ece06a Add styleSheetType to application reportStyleSheet 2019-10-26 08:13:47 +10:00
Even Rouault
d7f5bd0ea3
Application options: defer disabling of drivers after application restart (relates to #29212)
This is a follow-up of https://github.com/qgis/QGIS/pull/31772

Driver de-registration is now defered after application restart to avoid
any risk of potential crashes if a dataset using a disabled driver was
already in use.
2019-10-08 20:31:39 +02:00
Nyall Dawson
6b1e96c180 Make a shared instance of QgsStyleModel for the default application style
This allows shared caching of symbol icons, greatly speeding up display
of views which use style models
2019-09-07 15:56:40 +10:00
Nyall Dawson
5db08f0c75 Attach a global bookmark manager to QgsApplication 2019-09-04 14:19:47 +10:00
Denis Rouzaud
41495058d1 run sipify 2019-08-30 12:45:37 +02:00
Nyall Dawson
b10fc70d37 Don't get distracted... 2019-07-11 13:03:12 +10:00
Nyall Dawson
b298a197e7 Start on registry 2019-07-11 13:03:12 +10:00
Nyall Dawson
107b48a430 Add NULLPTR macro for use in doxygen comments
For the c++ api dox this expands to "\c nullptr" (the
\c directive indicates a code literal value), and for sipify/Python
it expands to ``None`` (`` is sphinx annotation for literal values)

Makes for nicer dox for both c++ and Python!
2019-02-27 09:41:11 +10:00
Nyall Dawson
a7ca08784c Nullptr consistency in dox 2019-02-27 09:41:11 +10:00
Matthias Kuhn
89ea819938
Make sure Python wrappers of quasi-singletons are kept alive
If they are deleted, any other python wrappers which have been parented to these singletons are deleted too.

One of the most common issues with this is, that subclasses of registry items are deleted and lost.
2019-02-06 12:18:41 +01:00
Pierre-Eric Pelloux-Prayer
f1760ee56b Remove include "qgsapplication.h" from qgswkbptr.h
qgswkbptr.h is included indirectly by a large number of source files.
So this commit does the following:
  - remove #include "qgsapplication.h" from qgswkbptr.h, and copy-paste the swap_endian
    function where it's used.
  - add the missing #include "qgsapplication.h" in other files

The rationale for this change is:
  - qgswkbptr.h doesn't really needs QgsApplication, since it only used swap_endian.
    We don't need to add a fake dependency on QgsApplication on every (indirect) "includers"
    of qgswkbptr.h
 - qgsapplication.h depends on qgsconfig.h which itself changes quite often (on every git op
   at least). Before this change, a 'git commit' would trigger a rebuild of about 3500 files.
   With this change we're down to ~700.
2019-01-22 21:45:38 +01:00
Nyall Dawson
7ccaa3df32 [FEATURE][API] Add flexible framework for custom "validity checks"
Adds a new interface QgsAbstractValidityCheck which defines
a single "check" which can be performed on a given QgsValidityCheckContext.
A new application-wide QgsValidityCheckRegistry registers
and manages instances of all known checks, and allows running
of all registered checks of a specific type at once.

Initially the framework is focused toward print layout validity
checks, but the interface has been designed to be generic enough
to allow alternative types of validity checks (e.g. project save
validity checks, processing model validity checks, etc.).

The API is designed to be used both by internal validity checks
and also to be extended by custom, organisation-specific
validity checks. E.g., for print layout validity checks we could have:
2019-01-03 04:53:07 +10:00
Nyall Dawson
84838d1ec6 [FEATURE][API] Add a content cache for raster images
This new class QgsImageCache is the equivalent of QgsSvgCache
but for raster images.

QgsImageCache stores pre-rendered resampled versions of raster
image files, allowing efficient reuse without incurring the
cost of resampling on every render.

Additionally, it offers the other benefits QgsSvgCache has,
such as thread safety, ability to transparently download remote
images, and support for base64 encoded strings.
2018-12-05 11:14:13 +07:00
Alessandro Pasotti
0e50b3ba70 Revert "Merge pull request #8177 from elpaso/bugfix-20094-field-calculator-slowness"
This reverts commit 096b4ce00426ee35a1eec5b54453b9ea2e22b903, reversing
changes made to 87e0f6961adcbf7039d2c0bef914cebd747afc67.
2018-10-16 09:33:09 +02:00
Alessandro Pasotti
07b31287ba Fix rollback on large tables when attr table is opened 2018-10-14 00:44:25 +02:00
Alessandro Pasotti
9d82df5d16 Forward to app blocking/unblocking of attr table updates
Fixes #20094 - Extracting z-coordinates takes ages and makes the system unresponsive
2018-10-13 15:40:57 +02:00
Juergen E. Fischer
144dd158c5 fix d67958183 2018-09-17 09:32:18 +02:00
Juergen E. Fischer
d67958183e Initialize translations before application members (fixes #19853) 2018-09-17 02:34:36 +02:00
Mathieu Pellerin
f1fdbbbbf0 Fix references to contributors.json (#7722) 2018-08-27 23:12:40 +03:00
signedav
fea9de9f15 merge error 2018-08-07 17:08:56 +02:00
signedav
ad086dc474 layermaptest and fixes
after feedback - mostly doc stuff or code style
2018-08-07 14:33:34 +02:00
signedav
442c7323f7 sip files and some improvements
like make a list copy before go through for loop and log messages
2018-08-07 14:32:46 +02:00
Matthias Kuhn
0a0f84a96f
Make spare connections more explicit 2018-08-05 09:24:47 +02:00
Matthias Kuhn
9d5f6f3f2e
Add QgsApplication::maxConcurrentConnectionsPerPool() 2018-08-03 13:56:30 +02:00
Denis Rouzaud
65bb60e96c run sipify 2018-05-28 10:39:34 -08:00
Nyall Dawson
f8bc97030b Remove extra space added before first line of docstring 2018-05-28 08:22:11 +10:00
Nyall Dawson
c864d22d1f Add "get ..." to doxygen compliance blacklist
Should be "gets ..." for consistent tense, or better yet
"returns ..." for consistency.
2018-05-27 14:05:06 +10:00
Nyall Dawson
4bb7f82fcb Remove some incorrect 'not available in Python bindings' notes 2018-05-26 16:51:58 +10:00
Nyall Dawson
1c615c15cc More documentation compliance
Use Qt style "returns .." tense instead of "return ..", and lock
this in with a documentation compliance unit test
2018-05-25 15:09:00 +10:00
Nyall Dawson
2cb8a33884 Fix broken see also links 2018-05-25 11:16:18 +10:00
Denis Rouzaud
7df2593caf move auto generated sip file in dedicated folder 2018-05-14 10:23:37 -04:00