Skip to content
Permalink
Browse files
new class QgsAbstractDbTableModel for models in database source widge…
…t selector
  • Loading branch information
3nids committed Nov 9, 2021
1 parent ac63c6e commit 622f7519c226897a43e9260933ed94e7fff104ec
Showing with 48 additions and 0 deletions.
  1. +1 −0 src/core/CMakeLists.txt
  2. +47 −0 src/core/providers/qgsabstractdbtablemodel.h
@@ -1563,6 +1563,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 (probaly 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

0 comments on commit 622f751

Please sign in to comment.