QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
qgsabstractdbtablemodel.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsabstractdbtablemodel.h
3 --------------------------------------
4 Date : 08.11.2021
5 Copyright : (C) 2021 Denis Rouzaud
7***************************************************************************
8* *
9* This program is free software; you can redistribute it and/or modify *
10* it under the terms of the GNU General Public License as published by *
11* the Free Software Foundation; either version 2 of the License, or *
12* (at your option) any later version. *
13* *
14***************************************************************************/
15
16#ifndef QGSABSTRACTDBTABLEMODEL_H
17#define QGSABSTRACTDBTABLEMODEL_H
18
19#include "qgis_core.h"
20
21#include <QStandardItemModel>
22
28class CORE_EXPORT QgsAbstractDbTableModel : public QStandardItemModel
29{
30 Q_OBJECT
31 public:
33 explicit QgsAbstractDbTableModel( QObject *parent = nullptr )
34 : QStandardItemModel( parent )
35 {}
36
38 virtual QStringList columns() const = 0;
39
41 virtual int defaultSearchColumn() const = 0;
42
44 virtual bool searchableColumn( int column ) const {Q_UNUSED( column ) return true;}
45
47 virtual void setSql( const QModelIndex &index, const QString &sql ) = 0;
48};
49
50#endif // QGSABSTRACTDBTABLEMODEL_H
The QgsAbstractDbTableModel class is a pure virtual model class for results in a database source widg...
virtual void setSql(const QModelIndex &index, const QString &sql)=0
Sets an sql statement that belongs to a cell specified by a model index.
virtual bool searchableColumn(int column) const
Returns if the column should be searchable at the given index.
virtual int defaultSearchColumn() const =0
Returns the index of the column used by default to filter the results (probably the table name column...
QgsAbstractDbTableModel(QObject *parent=nullptr)
Constructor.
virtual QStringList columns() const =0
Returns the list of columns in the table.