170 Commits

Author SHA1 Message Date
Even Rouault
24eb319af2 [FEATURE] Add a subset string editor provider concept and registry
The aim of this work is to be able to provide custom subset string editor
GUI according to the layer. Typically, so that a WFS layer uses the same
editor than in its select source, or that a plugin can provide a custom
editor.

* Add QgsSubsetStringEditorInterface: abstract interface to define a dialog
  that can edit a subset string
* Make QgsQueryBuilder implement QgsSubsetStringEditorInterface
* Add QgsSubsetStringEditorProvider: interface for thos who want to provide
  a dialog to edit a subset string.
* Add QgsSubsetStringEditorProviderRegistry: keeps a list of subset string
  editor providers. Transposed from QgsDataItemGuiProviderRegistry
* Add QgsGui::subsetStringEditorProviderRegistry()
2020-11-16 11:09:06 +10:00
Nyall Dawson
59601bf17d Add QgsPointCloudAttributeComboBox widget
A reusable widget for selecting an attribute from a point cloud layer
2020-11-10 02:17:10 +10:00
Nyall Dawson
9935bbe05e Add adapter class QgsGeocoderLocatorFilter
This class implements the required logic to bridge a
class which implements the QgsGeocoderInterface interface to a
QgsLocatorFilter. It allows easy creation of a locator filter
from a geocoder.

E.g.

    class GoogleGeocoder(QgsGeocoderInterface):
      ... class which implements QgsGeocoderInterface...

    my_google_geocoder = GoogleGeocoder(api_key)
    my_google_locator_filter = QgsGeocoderLocatorFilter('google', 'Google Maps', 'google', my_google_geocoder, iface.mapCanvas())
    iface.registerLocatorFilter(my_google_locator_filter)

Note:

There's an abstract base class QgsAbstractGeocoderLocatorFilter which
lives in core. This base class has the guts of the geocoder to filter
adapter logic, but it does NOT implement the part which actually zooms
the canvas to the geocode results (because it's in core!)

This abstract base class is in place for applications like QField,
where the GUI library and QgsMapCanvas is NOT used. Those applications
can then implement their own concrete class based on QgsAbstractGeocoderLocatorFilter
with the correct logic to zoom their interface to a region. Ultimately,
a single QgsGeocoderInterface could be usable across QGIS desktop, QField,
with almost all logic shared via the common abstract adapter class.
2020-11-02 11:22:48 +10:00
Nyall Dawson
e0321be23f Add iface method and new class for delegating all responsibility
and logic for activating a custom map tool and ensuring it can
only be enabled in the right circumstances to QGIS app

If a plugin has to do this, it's a nightmare of code and hacks (partly
because of the number of changing circumstances it needs to respond
to, and partly because a lot of the useful functions available
for handling this behavior is locked away in private methods
in qgisapp.cpp)

So instead make an abstract base class for map tool handlers and
an iface method for register/unregistering them.

From the dox:

An abstract base class for map tool handlers which automatically handle all the necessary
logic for toggling the map tool and enabling/disabling the associated action
when the QGIS application is in a state permissible for the tool.

Creating these handlers avoids a lot of complex setup code and manual connections
which are otherwise necessary to ensure that a map tool is correctly activated and
deactivated when the state of the QGIS application changes (e.g. when the active
layer is changed, when edit modes are toggled, when other map tools are switched
to, etc).

- ### Example

\code{.py}
  class MyMapTool(QgsMapTool):
     ...

  class MyMapToolHandler(QgsAbstractMapToolHandler):

     def __init__(self, tool, action):
         super().__init__(tool, action)

     def isCompatibleWithLayer(self, layer, context):
         # this tool can only be activated when an editable vector layer is selected
         return isinstance(layer, QgsVectorLayer) and layer.isEditable()

  my_tool = MyMapTool()
  my_action = QAction('My Map Tool')

  my_handler = MyMapToolHandler(my_tool, my_action)
  iface.registerMapToolHandler(my_handler)
\endcode
2020-10-23 19:03:51 +10:00
Nyall Dawson
3098fa5906 Move code editor color scheme tracking to dedicated registry,
QgsCodeEditorColorSchemeRegistry

This cleans up the code, and makes it possible for creation of plugins
which add new code editor color schemes!
2020-10-06 17:11:34 +10:00
Nyall Dawson
1bafa2f66f Code shuffle: move QgsCodeEditor classes to their own folder 2020-10-06 17:11:34 +10:00
Nyall Dawson
df6c8d74cd Allow plugins and scripts to register custom logic to prevent
the QGIS application from exiting

This interface allows plugins to implement custom logic to determine whether it is safe
for the application to exit, e.g. by checking whether the plugin or script has any
unsaved changes which should be saved or discarded before allowing QGIS to exit.
2020-10-06 17:04:49 +10:00
vcloarec
09c73433dd move QgsMeshLayerProperties to GUI 2020-09-14 15:55:18 +10:00
Nyall Dawson
748d76aeed [feature][labeling] Add option to allow users to control the placement
of labels along line features

The new "Label Anchoring" section in the line placement settings for
labels allows users to specify whether labels should be placed
at the center, start or end of lines (or a custom percent from the
start of the line). Also allows data-defined percent along line
control!
2020-08-18 11:09:18 +10:00
Nyall Dawson
368a58bf5e Base class for 3d symbol widgets 2020-07-23 07:53:20 +10:00
Alessandro Pasotti
3af038f861
Merge pull request #37832 from elpaso/browser-create-table
Browser create database table
2020-07-18 17:18:16 +02:00
Alessandro Pasotti
15a4c3928c
Merge pull request #37136 from SebastienPeillet/several_fix_locale_raster_properties
Fix decimal point issues on raster properties forms,  Fixes #33859
2020-07-14 15:45:05 +02:00
Alessandro Pasotti
1f11d31c68 New database table dialog: actions 2020-07-14 15:25:20 +02:00
Nyall Dawson
75c86786c1 Add QgsCodeEditorJavascript subclass of QgsCodeEditor
Allows plugins to create a nice editor for JSON content -- not easy
to do if we don't expose this through the QGIS api!
2020-06-16 17:13:59 +10:00
speillet
893bfffc45 new validator to handle permissive double writing in form; fix raster properties form
QgsDoubleValidator modification after review

update doc
2020-06-14 18:19:11 +02:00
Nyall Dawson
6b27958948 Fix "zoom" and "flash" features buttons have no effect when opening
filter mode in attribute form

(For reference: not a regression -- these buttons were originally
added for the "select by form" dialog only, and they've just never
been hooked up for use inside the attribute form itself!)

Fixes #34506
2020-06-05 08:52:45 +10:00
Nyall Dawson
d5a340f886 [processing] Port aggregates widget wrapper to c++
And add a TON of tests

Fixes #36843
2020-06-03 15:17:56 +10:00
Nyall Dawson
3ebd09724b Add framework to allow for flexible interaction blocking with map canvas 2020-05-22 08:40:51 +10:00
Nyall Dawson
d98defec1a [feature] Add basic temporal handling support for vector layers
This exposes some basic temporal capabilities for vector layers:
- static time range for layer (to match raster layer possibilities), this
sets a single static time range which applies to the whole layer. ALL
features from the layer will be shown whenever the canvas time
overlaps the layer time range
- "Single field with datetime": Allows selection of a single date
or datetime field from the layer. Features will be shown whenever
this field value is within the canvas time range
- "Separate Fields for Start and End Date/Time": Allows selection
of start and end date/datetime fields from the layer. Features will
be shown whenever the time interval calculated from these fields
overlaps the canvas time range

Some known limitations/inefficiencies:
- currently only date/datetime fields can be used. This was done
to simplify the format handling and avoid the need to worry about
string fields with different datetime formats. In future we should
allow selection of string fields and allow users to enter a custom
datetime format string
- unlike the Time Manager plugin approach, the approach taken here
is to rely completely on QGIS expressions and feature requests to
do the filtering (Time Manager uses layer filter strings and attempts
to set a native SQL filter syntax so that filtering is done on the
backend). This is intentional, because it provides a unified filter
approach regardless of the provider used (i.e. we don't need to worry
about the different SQL syntaxes used natively by the different
providers). The beauty of feature request expression compilation
**should** mean that the QGIS expressions are magically turned into
native backend queries, BUUUUUUUUUUUT... because we lack QGIS expression
support for date time literals, we currently rely on the "to_datetime"
expression function and coerce everything through strings. None of
the expression compilers handle this function, so currently ALL
filtering is done on the QGIS side. We need to add functions for
optimised datetime literal creation, and then ensure that the different
compilers correctly map these literals across to the backend
filter syntax to allow all the filtering work to be done on the database
side...

So currently, performance is much worse with large layers compared
to Time Manager. But, the advantage is that we can use the native
temporal framework and have vector layers animated alongside mesh
and raster layers!
2020-05-08 11:46:46 +10:00
Denis Rouzaud
82da0fd962 rename QgsFeatureChooser to QgsFeaturePicker 2020-04-29 15:54:15 +02:00
Denis Rouzaud
3cd237eca7 more work 2020-04-29 15:54:15 +02:00
Denis Rouzaud
97dafe1fe9 move the expression preview to a dedicated class 2020-04-29 15:54:15 +02:00
Nyall Dawson
ddbcb1f478 [FEATURE][layouts] Allow configuring legend patch shapes by
double-clicking on legend items

Allows users to set custom legend patch shapes for items by
entering a WKT string representing the patch geometry
2020-04-21 10:40:50 +10:00
Nyall Dawson
27164156e1 [FEATURE][API] Allow plugins to register custom "Project Open" handlers
These allow plugins to extend the "Open Project" dialog by adding in support
for new file filters, which appear in the formats drop down list alongside
the existing "QGS Projects" entry.

Custom project open handlers then get first chance at loading project files.

This allows plugins to extend QGIS support by adding integrated support for
opening projects from non QGS/QGZ formats, e.g. allowing users to open
ArcGIS MXD documents or MapInfo WOR Workspaces direct from the project open
dialog.

These non-native projects are also added to the recent projects list and
welcome screen, giving them a truly first-class experience within QGIS.

Sponsored by SLYR
2020-04-07 09:18:49 +10:00
Martin Dobias
c7380612cd Correct SIP fix + add src/gui/vectortile to doxygen 2020-04-05 12:04:34 +02:00
Martin Dobias
a4a61e039c Added missing references to sip files 2020-04-05 12:04:34 +02:00
Alessandro Pasotti
794eb7e097 QgsFieldMappingModel plus tests and widget operations 2020-04-03 21:21:14 +10:00
Alessandro Pasotti
e7621be8be Field mapping widget 2020-04-03 21:21:14 +10:00
Martin Dobias
be98e2f0f6 [FEATURE] Raster layer contour renderer
This new renderer draws contour lines that are calculated on the fly
from the source raster band. It is possible to set interval of contour
lines and symbol used for drawing.

In addition there is support for "index contours" - contour lines
with higher interval, typically drawn with a wider line symbol.

If we generate contour lines on input raster block with the same size as our
output raster block, the generated lines would contain too much detail.
This detail can be reduced by the "downscale" factor - this will request
lower resolution of the source raster.
2020-03-31 08:51:54 +02:00
Denis Rouzaud
bb8bced5d6 move tree view from the expression builder to a dedicated class 2020-03-26 14:55:33 +01:00
Nyall Dawson
bab86e9af3 Start on classes for dev tool widgets and dev tool widget factory 2020-03-25 20:03:18 +10:00
Nyall Dawson
9e4e32ffa4 Make highlightable line edit its own widget - QgsHighlightableLineEdit 2020-03-25 19:25:40 +10:00
Nyall Dawson
dbc022d8c9 Split guts of QgsExtentGroupBox out to QgsExtentWidget
This allows the widget to be used in places where a group box
is not desirable (e.g. when the widget is already in a group box)
2020-03-25 19:25:40 +10:00
Nyall Dawson
3d6e4963f6 [processing] Move base class of ParametersPanel to c++ 2020-03-25 09:42:17 +10:00
Nyall Dawson
517aa9667b [processing] Port DestinationSelectionPanel to c++
This is basically a 1:1 port (+some fixes relating to incorrect signal
emissions and many more tests)
2020-03-17 07:24:40 +10:00
Nyall Dawson
c040952354 Minor refactor of temporal controller dock widget
- Split widget from dock widget for flexibility
- Move dock widget class to app and only expose QgsTemporalControllWidget in public api
2020-03-13 18:06:02 +10:00
Alessandro Pasotti
6b3679b2ef
Merge pull request #34968 from elpaso/tablewidget
[api] New database table name widget
2020-03-12 21:35:54 +01:00
Nyall Dawson
66e8ef298a Cleanup QgsTemporalMapSettingsWidget/dialog, hide from stable API/python 2020-03-12 20:06:25 +10:00
Samweli
99129fe4a8 updates on the temporal controller navigation logic 2020-03-12 20:06:25 +10:00
Samweli
3e06d0a696 new temporal map settings dialog 2020-03-12 20:06:25 +10:00
Samweli
d446c0a223 formatted wms provider code 2020-03-12 20:06:25 +10:00
Alessandro Pasotti
700a411285 QgsNewDatabaseTableNameWidget implementation (WIP) 2020-03-10 08:12:36 +01:00
Sandro Mani
aca8e030bf
Merge pull request #33833 from kadas-albireo/vectorprops
Move QgsVectorLayerProperties and dependencies to GUI
2020-03-09 13:17:00 +01:00
Nyall Dawson
35411af6f6 Add new GUI widget QgsDatabaseTableComboBox for selection of
available tables for a specific data connection

(providers must implement the connections API)
2020-03-09 21:04:51 +10:00
Nyall Dawson
e8e13ecb6f Add new GUI widget QgsDatabaseSchemaComboBox for selection of
available schemas for a specific data connection

(providers must implement the connections API)
2020-03-09 21:04:51 +10:00
Nyall Dawson
2bdb0cc27a Add new GUI widget QgsProviderConnectionComboBox for selection of
registered connections for a specific data provider

(providers must implement the connections API)
2020-03-09 21:04:51 +10:00
Sandro Mani
84bd5797f7 Move QgsVectorLayerProperties and dependencies to GUI 2020-03-09 10:29:34 +01:00
Nyall Dawson
a0e6a374eb Port some more model designer Python code to c++ 2020-03-06 18:22:49 +10:00
Nyall Dawson
eefd04cbc1 Start creation of a c++ base class for modeler dialog 2020-03-06 18:22:49 +10:00
Samweli
2517b566d1 suggested changes from the review 2020-03-05 18:41:35 +10:00