From 24bde35ce67a0996e2673afa450fc1feb0cd6f53 Mon Sep 17 00:00:00 2001 From: Patrick Valsecchi Date: Fri, 15 Jul 2016 12:11:43 +0200 Subject: [PATCH] Smarter default edit widgets with plugins to pick them Now the widgets factories can give a score on how good they could handle a widget. Additionaly, plugins can be added to choose a widget factory in function of an external information. One of them uses a table in PostgresQL to allow specification of the widget type and configuration. I took the opportunity to remove a few deprecated method in relation to this. --- doc/api_break.dox | 17 +++ python/core/qgseditformconfig.sip | 48 ++----- python/core/qgsfield.sip | 45 +++++++ .../core/qgseditorwidgetautoconf.sip | 41 ++++++ .../core/qgseditorwidgetfactory.sip | 14 ++- .../core/qgseditorwidgetregistry.sip | 19 +++ python/gui/gui.sip | 1 + src/app/ogr/qgsvectorlayersaveasdialog.cpp | 10 +- src/app/qgisapp.cpp | 6 +- src/app/qgsattributetabledialog.cpp | 7 +- src/app/qgsfieldsproperties.cpp | 9 +- src/app/qgsidentifyresultsdialog.cpp | 20 +-- src/app/qgsidentifyresultsdialog.h | 3 +- src/app/qgsmergeattributesdialog.cpp | 7 +- src/core/qgseditformconfig.cpp | 69 +++++----- src/core/qgseditformconfig.h | 37 ++---- src/core/qgsfield.cpp | 10 ++ src/core/qgsfield.h | 50 ++++++++ src/core/qgsfield_p.h | 2 + src/core/qgsvectorlayerundocommand.cpp | 2 +- src/gui/CMakeLists.txt | 1 + .../qgsattributetabledelegate.cpp | 4 +- .../attributetable/qgsattributetablemodel.cpp | 8 +- src/gui/attributetable/qgsdualview.cpp | 3 +- .../core/qgseditorwidgetautoconf.cpp | 112 +++++++++++++++++ .../core/qgseditorwidgetautoconf.h | 88 +++++++++++++ .../core/qgseditorwidgetfactory.cpp | 4 +- .../core/qgseditorwidgetfactory.h | 18 ++- .../core/qgseditorwidgetregistry.cpp | 30 ++++- .../core/qgseditorwidgetregistry.h | 37 ++++++ .../qgscheckboxwidgetfactory.cpp | 6 + .../editorwidgets/qgscheckboxwidgetfactory.h | 1 + .../editorwidgets/qgscolorwidgetfactory.cpp | 14 +++ src/gui/editorwidgets/qgscolorwidgetfactory.h | 1 + .../editorwidgets/qgsdatetimeeditfactory.cpp | 15 +++ .../editorwidgets/qgsdatetimeeditfactory.h | 1 + .../qgsenumerationwidgetfactory.cpp | 6 +- .../qgsenumerationwidgetfactory.h | 3 +- .../qgsexternalresourcewidgetfactory.cpp | 6 +- .../qgsexternalresourcewidgetfactory.h | 4 +- .../editorwidgets/qgsrangewidgetfactory.cpp | 13 +- src/gui/editorwidgets/qgsrangewidgetfactory.h | 2 +- .../qgstexteditwidgetfactory.cpp | 7 ++ .../editorwidgets/qgstexteditwidgetfactory.h | 3 +- .../editorwidgets/qgsuuidwidgetfactory.cpp | 6 + src/gui/editorwidgets/qgsuuidwidgetfactory.h | 1 + src/gui/qgsattributeeditor.cpp | 5 +- src/gui/qgsattributeform.cpp | 33 +++-- src/providers/postgres/CMakeLists.txt | 1 - src/providers/postgres/qgspostgresconn.cpp | 2 + .../postgres/qgspostgresprovider.cpp | 88 +++++++++---- src/providers/postgres/qgspostgresprovider.h | 4 + src/server/qgsserverprojectparser.cpp | 7 +- src/server/qgswmsserver.cpp | 8 +- tests/src/core/testqgsfield.cpp | 13 ++ tests/src/gui/CMakeLists.txt | 1 + tests/src/gui/testqgsattributeform.cpp | 1 + tests/src/gui/testqgseditorwidgetregistry.cpp | 119 ++++++++++++++++++ tests/src/python/test_provider_postgres.py | 23 ++++ tests/testdata/provider/testdata_pg.sh | 1 + tests/testdata/provider/testdata_pg.sql | 24 ++++ 61 files changed, 908 insertions(+), 233 deletions(-) create mode 100644 python/gui/editorwidgets/core/qgseditorwidgetautoconf.sip create mode 100644 src/gui/editorwidgets/core/qgseditorwidgetautoconf.cpp create mode 100644 src/gui/editorwidgets/core/qgseditorwidgetautoconf.h create mode 100644 tests/src/gui/testqgseditorwidgetregistry.cpp diff --git a/doc/api_break.dox b/doc/api_break.dox index 597318f6ecb..45feb2f15bf 100644 --- a/doc/api_break.dox +++ b/doc/api_break.dox @@ -492,6 +492,8 @@ place of a null pointer. \subsection qgis_api_break_3_0_QgsExpression QgsExpression @@ -590,6 +592,13 @@ and the new ramp can be retrieved after executing the dialog by calling ramp().< plugins calling this method will need to be updated. +\subsection qgis_api_break_3_0_QgsEditorWidgetRegistry QgsEditorWidgetRegistry + + + \subsection qgis_api_break_3_0_QgsGroupWMSDataDialog QgsGroupWMSDataDialog