QGIS API Documentation 3.41.0-Master (3440c17df1d)
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
QgsProviderConnectionModel Class Reference

A model containing registered connection names for a specific data provider. More...

#include <qgsproviderconnectionmodel.h>

Inheritance diagram for QgsProviderConnectionModel:
Inheritance graph
[legend]

Public Types

enum class  CustomRole : int { ConnectionName = Qt::UserRole , Uri , Configuration , Empty }
 Custom model roles. More...
 

Public Member Functions

 QgsProviderConnectionModel (const QString &provider, QObject *parent=nullptr)
 Constructor for QgsProviderConnectionModel, for the specified provider.
 
bool allowEmptyConnection () const
 Returns true if the model allows the empty connection ("not set") choice.
 
int columnCount (const QModelIndex &parent=QModelIndex()) const override
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
 
QModelIndex index (int row, int column, const QModelIndex &parent) const override
 
QModelIndex parent (const QModelIndex &child) const override
 
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 
void setAllowEmptyConnection (bool allowEmpty)
 Sets whether an optional empty connection ("not set") option is present in the model.
 

Detailed Description

A model containing registered connection names for a specific data provider.

Warning
The provider must support the connection API methods in its QgsProviderMetadata implementation in order for the model to work correctly.
Since
QGIS 3.14

Definition at line 38 of file qgsproviderconnectionmodel.h.

Member Enumeration Documentation

◆ CustomRole

enum class QgsProviderConnectionModel::CustomRole : int
strong

Custom model roles.

Note
Prior to QGIS 3.36 this was available as QgsProviderConnectionModel::Role
Since
QGIS 3.36
Enumerator
ConnectionName 

Connection name.

Uri 

Connection URI string.

Configuration 

Connection configuration variant map.

Empty 

Entry is an empty entry.

Definition at line 52 of file qgsproviderconnectionmodel.h.

Constructor & Destructor Documentation

◆ QgsProviderConnectionModel()

QgsProviderConnectionModel::QgsProviderConnectionModel ( const QString &  provider,
QObject *  parent = nullptr 
)
explicit

Constructor for QgsProviderConnectionModel, for the specified provider.

Warning
The provider must support the connection API methods in its QgsProviderMetadata implementation in order for the model to work correctly.

Definition at line 21 of file qgsproviderconnectionmodel.cpp.

Member Function Documentation

◆ allowEmptyConnection()

bool QgsProviderConnectionModel::allowEmptyConnection ( ) const
inline

Returns true if the model allows the empty connection ("not set") choice.

See also
setAllowEmptyConnection()

Definition at line 80 of file qgsproviderconnectionmodel.h.

◆ columnCount()

int QgsProviderConnectionModel::columnCount ( const QModelIndex &  parent = QModelIndex()) const
override

Definition at line 86 of file qgsproviderconnectionmodel.cpp.

◆ data()

QVariant QgsProviderConnectionModel::data ( const QModelIndex &  index,
int  role = Qt::DisplayRole 
) const
override

Definition at line 93 of file qgsproviderconnectionmodel.cpp.

◆ index()

QModelIndex QgsProviderConnectionModel::index ( int  row,
int  column,
const QModelIndex &  parent 
) const
override

Definition at line 161 of file qgsproviderconnectionmodel.cpp.

◆ parent()

QModelIndex QgsProviderConnectionModel::parent ( const QModelIndex &  child) const
override

Definition at line 71 of file qgsproviderconnectionmodel.cpp.

◆ rowCount()

int QgsProviderConnectionModel::rowCount ( const QModelIndex &  parent = QModelIndex()) const
override

Definition at line 78 of file qgsproviderconnectionmodel.cpp.

◆ setAllowEmptyConnection()

void QgsProviderConnectionModel::setAllowEmptyConnection ( bool  allowEmpty)

Sets whether an optional empty connection ("not set") option is present in the model.

See also
allowEmptyConnection()

Definition at line 34 of file qgsproviderconnectionmodel.cpp.


The documentation for this class was generated from the following files: