[needs-docs]
In vector layer properties (only usefull for postgres datasources)
**in the rendering tab**
A "Refresh layer on notification" checkbox has been added to refresh layer
on provider notification.
For a postgres datasource, if a `NOTIFY qgis;` command is issued by one of the database clients,
a refresh of the layer will occur.
If the "Only if message is" checkbox is checked, the notification will trigger the refresh only
if the message contend is the one specified, e.g. if the user enters
"refresh" in the box right next to the "Only if message is" checkbox,
then a `NOTIFY qgis, 'refresh';` command in the datatabase will trigger
a layer refresh, but `NOTIFY qgis;` or `NOTIFY qgis, 'something else';`
won't.
**in the actions tab**
A column "On notification" has been added, the action editor widget
a has text field "Execute if notification message matches" to
specify a filter for notification from the provider. The filter is a
Perl-type regex.
Note that, as opposed to the "layer refresh" that
Exemple:
- QGIS side "Execute if notification message matches" `^trigger my action`
- Postgres side: `NOTIFY qgis, 'trigger my action'` will trigger the action
- Postgres side: `NOTIFY qgis, 'trigger my action some additional data'` will trigger the action
- Postgres side: `NOTIFY qgis, 'do not trigger my action some additional data'` will NOT trigger the action
Please note that if the `^`, which means "starts with", in `^trigger my action` had been ommited,
the last notification would have triggered the action because the
notification message contains the `trigger my action`
A new qgis variable `notification_message` is available for use in
actions, it holds the contend of the notification message. To continue
with the previous exemple, if the action is of python type with the code:
```python
print('[% @notification_message %]')
```
The three notifictions above will result in two printed lines
```
trigger my action
trigger my action some additional data
```
User Warning:
For postgres providers, if the "Refresh layer on notification" is checked, or if one layer action has
"On notification" specified, a new connection to the database is made to
listen to postgres notifications. This olds even if transaction groups
are enabled at the project level.
Note that once the notification mechanism is started in a QGIS
session, it will not stop, even if there is no more need for it (Refresh
layer on notification" unchecked and no "On notification" in any
action). Consequently the connection listening to notification will
remain open.
IMPLEMENTATION DETAILS:
A notify signal has been added to the abstract QgsVectorDataProvider
along with a setListening function that enables/disble the notification
mechanism.
For the moment only the postgres provider implements the notification.
QgsAction has a notificationMessage member function that holds the regex
to match to trigger action
QgsActionManager becomes a QObject and is doing the filtering and execute actions on
notifications.
The notification notion extends beyond SRGBD servers (postgres and oracle at
least have the notify) and the "watch file" in the delimitedtext
provider could also benefit from this interface.
For the postgres provider a thread is created with a second connection
to the database. This thread is responsible for listening postgres
notifications.
It would be nice to avoid the creation of one listening chanel per
provider in the case transaction groups are enabled.
Please note that when listening starts (a thread and connection is
created in the postgres provider) it cannot be stopped by removing the
connected actions or unchecking the refresh check box. Indeed, since we
don't know who needs the signals, we dont't want to stop the service.
The service will not restart in the next qgis session though.
If this behavior is not deemed appropriate, we could use
```
int QObject::receivers ( const char * signal ) const
```
and have QgsDataProvider::setListening return a bool to tell the caller
if the signal has actually been closed.
About QGIS
QGIS is an Open Source Geographic Information System. The project was born in May of 2002 and was established as a project on SourceForge in June of the same year. We've worked hard to make GIS software (which is traditionally expensive commercial software) a viable prospect for anyone with basic access to a Personal Computer. QGIS currently runs on most Unix platforms (macOS/OS X included) and Windows. QGIS is developed using the Qt toolkit (http://qt.io) and C++. This means that QGIS feels snappy to use and has a pleasing, easy to use graphical user interface.
QGIS aims to be an easy to use GIS, providing common functions and features. The initial goal was to provide a GIS data viewer. QGIS has reached that point in its evolution and is being used by many for their daily GIS data viewing and editing needs. QGIS supports a number of raster and vector data formats, with new support easily added using the plugin architecture.
QGIS is released under the GNU Public License (GPL) Version 2 or above. Developing QGIS under this license means that you can (if you want to) inspect and modify the source code and guarantees that you, our happy user will always have access to a GIS program that is free of cost and can be freely modified.
Supported raster formats include:
- GRASS
- USGS DEM
- ArcInfo binary grid
- ArcInfo ASCII grid
- ERDAS Imagine
- SDTS
- GeoTiff
- Tiff with world file
- WMS, WCS
Supported vector formats include:
- ESRI Shapefiles
- PostgreSQL/PostGIS
- GRASS
- GeoPackage
- SpatiaLite
- Other OGR supported formats
- MSSQL
- Oracle
- WFS
Note
Please follow the installation instructions carefully. After extracting the distribution, you can find the HTML version of the installation document in qgis/doc/index.html. The installation document is also available as PDF in the same directory.
Help us
Please submit bug reports using the QGIS bug tracker. When reporting a bug, either login or, if you don't have a qgis trac, provide an email address where we can request additional information.
Support
You can get support in the following ways:
- Using the QGIS community site at http://qgis.org
- Joining the qgis-users mailing list
- Using IRC by joining the #qgis channel on irc.freenode.net. Please wait around for a response to your question as many folks on the channel are doing other things and it may take a while for them to notice your question.
- Join the Gitter chat.
Contribute
QGIS is on GitHub at https://github.com/qgis/QGIS. If you wish to contribute patches you can fork the project, make your changes, commit to your repository, and then create a pull request. The development team can then review your contribution and commit it upstream as appropriate. If you commit a new feature, add [FEATURE] to your commit message AND give a clear description of the new feature. A webhook will automatically create an issue on the QGIS-Documentation repo to tell people to write documentation about it.
If you are not a developer, there are many other possibilities which do not require programming skills to help QGIS to evolve. Check our project homepage for more information.