Skip to content
Permalink
Browse files
Merge pull request #45962 from 3nids/ux-db-table-filter
improve filtering of layers in DB dialogs
  • Loading branch information
3nids committed Nov 10, 2021
2 parents 8a97de5 + a4439c1 commit 1bb212ee9a8ac5f7236e8318cd5a96d36e3a4453
Showing with 942 additions and 1,181 deletions.
  1. +51 −0 python/core/auto_generated/providers/qgsabstractdbtablemodel.sip.in
  2. +3 −1 python/core/auto_generated/qgsdbfilterproxymodel.sip.in
  3. +1 −0 python/core/core_auto.sip
  4. +49 −0 python/gui/auto_generated/providers/qgsdbsourceselectbase.sip.in
  5. +1 −0 python/gui/gui_auto.sip
  6. +1 −0 src/core/CMakeLists.txt
  7. +47 −0 src/core/providers/qgsabstractdbtablemodel.h
  8. +3 −2 src/core/qgsdbfilterproxymodel.h
  9. +2 −0 src/gui/CMakeLists.txt
  10. +21 −99 src/gui/providers/ogr/qgsogrdbsourceselect.cpp
  11. +7 −11 src/gui/providers/ogr/qgsogrdbsourceselect.h
  12. +23 −7 src/gui/providers/ogr/qgsogrdbtablemodel.cpp
  13. +9 −4 src/gui/providers/ogr/qgsogrdbtablemodel.h
  14. +130 −0 src/gui/providers/qgsdbsourceselectbase.cpp
  15. +59 −0 src/gui/providers/qgsdbsourceselectbase.h
  16. +20 −115 src/providers/db2/qgsdb2sourceselect.cpp
  17. +3 −9 src/providers/db2/qgsdb2sourceselect.h
  18. +43 −14 src/providers/db2/qgsdb2tablemodel.cpp
  19. +9 −4 src/providers/db2/qgsdb2tablemodel.h
  20. +17 −111 src/providers/hana/qgshanasourceselect.cpp
  21. +4 −11 src/providers/hana/qgshanasourceselect.h
  22. +44 −13 src/providers/hana/qgshanatablemodel.cpp
  23. +10 −5 src/providers/hana/qgshanatablemodel.h
  24. +21 −116 src/providers/mssql/qgsmssqlsourceselect.cpp
  25. +5 −11 src/providers/mssql/qgsmssqlsourceselect.h
  26. +45 −15 src/providers/mssql/qgsmssqltablemodel.cpp
  27. +9 −6 src/providers/mssql/qgsmssqltablemodel.h
  28. +21 −108 src/providers/oracle/qgsoraclesourceselect.cpp
  29. +4 −12 src/providers/oracle/qgsoraclesourceselect.h
  30. +41 −12 src/providers/oracle/qgsoracletablemodel.cpp
  31. +11 −5 src/providers/oracle/qgsoracletablemodel.h
  32. +20 −121 src/providers/postgres/qgspgsourceselect.cpp
  33. +5 −11 src/providers/postgres/qgspgsourceselect.h
  34. +48 −15 src/providers/postgres/qgspgtablemodel.cpp
  35. +10 −5 src/providers/postgres/qgspgtablemodel.h
  36. +22 −100 src/providers/spatialite/qgsspatialitesourceselect.cpp
  37. +4 −12 src/providers/spatialite/qgsspatialitesourceselect.h
  38. +23 −7 src/providers/spatialite/qgsspatialitetablemodel.cpp
  39. +12 −4 src/providers/spatialite/qgsspatialitetablemodel.h
  40. +84 −215 src/ui/qgsdbsourceselectbase.ui
@@ -0,0 +1,51 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/providers/qgsabstractdbtablemodel.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/




class QgsAbstractDbTableModel : QStandardItemModel
{
%Docstring(signature="appended")
The :py:class:`QgsAbstractDbTableModel` class is a pure virtual model class for results in a database source widget selector

.. versionadded:: 3.24
%End

%TypeHeaderCode
#include "qgsabstractdbtablemodel.h"
%End
public:
explicit QgsAbstractDbTableModel( QObject *parent = 0 );
%Docstring
Constructor
%End

virtual QStringList columns() const = 0;
%Docstring
Returns the list of columns in the table
%End

virtual int defaultSearchColumn() const = 0;
%Docstring
Returns the index of the column used by default to filter the results (probably the table name column if it exists)
%End

virtual bool searchableColumn( int column ) const;
%Docstring
Returns if the column should be searchable at the given index
%End
};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/providers/qgsabstractdbtablemodel.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -10,12 +10,14 @@



class QgsDatabaseFilterProxyModel: QSortFilterProxyModel
class QgsDatabaseFilterProxyModel : QSortFilterProxyModel /Deprecated/
{
%Docstring(signature="appended")
A class that implements a custom filter and can be used
as a proxy for :py:class:`QgsDbTableModel`

.. deprecated:: QGIS 3.24

.. versionadded:: 3.0
%End

@@ -529,6 +529,7 @@
%Include auto_generated/project/qgsprojectutils.sip
%Include auto_generated/project/qgsprojectversion.sip
%Include auto_generated/project/qgsprojectviewsettings.sip
%Include auto_generated/providers/qgsabstractdbtablemodel.sip
%Include auto_generated/providers/qgsabstractdatabaseproviderconnection.sip
%Include auto_generated/providers/qgsabstractproviderconnection.sip
%Include auto_generated/providers/qgsdataprovider.sip
@@ -0,0 +1,49 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/providers/qgsdbsourceselectbase.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/





class QgsDbSourceSelectBase : QgsAbstractDataSourceWidget, protected Ui::QgsDbSourceSelectBase
{
%Docstring(signature="appended")
The :py:class:`QgsDbSourceSelectBase` class is a base class for database source widget selector

.. versionadded:: 3.24
%End

%TypeHeaderCode
#include "qgsdbsourceselectbase.h"
%End
public:
QgsDbSourceSelectBase( QWidget *parent = 0, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags, QgsProviderRegistry::WidgetMode widgetMode = QgsProviderRegistry::WidgetMode::None );
%Docstring
Constructor
%End

protected:
void setSourceModel( QgsAbstractDbTableModel *model );
%Docstring
Sets the source model for the widget
%End

QSortFilterProxyModel *proxyModel();
%Docstring
Returns the proxy model used to filter the results
%End

};

/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/providers/qgsdbsourceselectbase.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -378,6 +378,7 @@
%Include auto_generated/processing/models/qgsmodelgraphicitem.sip
%Include auto_generated/processing/models/qgsmodelgraphicsscene.sip
%Include auto_generated/processing/models/qgsmodelgraphicsview.sip
%Include auto_generated/providers/qgsdbsourceselectbase.sip
%Include auto_generated/raster/qgscolorrampshaderwidget.sip
%Include auto_generated/raster/qgshillshaderendererwidget.sip
%Include auto_generated/raster/qgsmultibandcolorrendererwidget.sip
@@ -1565,6 +1565,7 @@ set(QGIS_CORE_HDRS
project/qgsprojectversion.h
project/qgsprojectviewsettings.h

providers/qgsabstractdbtablemodel.h
providers/qgsabstractdatabaseproviderconnection.h
providers/qgsabstractproviderconnection.h
providers/qgsdataprovider.h
@@ -0,0 +1,47 @@
/***************************************************************************
qgsabstractdbtablemodel.h
--------------------------------------
Date : 08.11.2021
Copyright : (C) 2021 Denis Rouzaud
Email : denis@opengis.ch
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#ifndef QGSABSTRACTDBTABLEMODEL_H
#define QGSABSTRACTDBTABLEMODEL_H

#include "qgis_core.h"

#include <QStandardItemModel>

/**
* \ingroup gui
* \brief The QgsAbstractDbTableModel class is a pure virtual model class for results in a database source widget selector
* \since QGIS 3.24
*/
class CORE_EXPORT QgsAbstractDbTableModel : public QStandardItemModel
{
Q_OBJECT
public:
//! Constructor
explicit QgsAbstractDbTableModel( QObject *parent = nullptr )
: QStandardItemModel( parent )
{}

//! Returns the list of columns in the table
virtual QStringList columns() const = 0;

//! Returns the index of the column used by default to filter the results (probably the table name column if it exists)
virtual int defaultSearchColumn() const = 0;

//! Returns if the column should be searchable at the given index
virtual bool searchableColumn( int column ) const {Q_UNUSED( column ) return true;}
};

#endif // QGSABSTRACTDBTABLEMODEL_H
@@ -28,9 +28,10 @@
* \ingroup core
* \brief A class that implements a custom filter and can be used
* as a proxy for QgsDbTableModel
* \since QGIS 3.0
* \deprecated since QGIS 3.24
* \since QGIS 3.0 QSortFilterProxyModel with native recursive filtering can be used instead
*/
class CORE_EXPORT QgsDatabaseFilterProxyModel: public QSortFilterProxyModel
class CORE_EXPORT Q_DECL_DEPRECATED QgsDatabaseFilterProxyModel : public QSortFilterProxyModel SIP_DEPRECATED
{
Q_OBJECT

@@ -361,6 +361,7 @@ set(QGIS_GUI_SRCS
processing/models/qgsmodelviewtooltemporarymousepan.cpp
processing/models/qgsmodelviewtoolzoom.cpp

providers/qgsdbsourceselectbase.cpp
providers/qgspointcloudproviderguimetadata.cpp
providers/qgspointcloudsourceselect.cpp

@@ -1180,6 +1181,7 @@ set(QGIS_GUI_HDRS
processing/models/qgsmodelviewtooltemporarymousepan.h
processing/models/qgsmodelviewtoolzoom.h

providers/qgsdbsourceselectbase.h
providers/qgspointcloudsourceselect.h
providers/qgspointcloudproviderguimetadata.h

Loading

0 comments on commit 1bb212e

Please sign in to comment.