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

List model representing the style databases associated with a QgsProject. More...

#include <qgsprojectstylesettings.h>

Inheritance diagram for QgsProjectStyleDatabaseModel:
Inheritance graph
[legend]

Public Types

enum class  CustomRole : int { Style = Qt::UserRole + 1 , Path }
 Custom model roles. More...
 

Public Member Functions

 QgsProjectStyleDatabaseModel (QgsProjectStyleSettings *settings, QObject *parent=nullptr)
 Constructor for QgsProjectStyleDatabaseModel, showing the styles from the specified settings.
 
QVariant data (const QModelIndex &index, int role) const override
 
QModelIndex indexFromStyle (QgsStyle *style) const
 Returns the model index corresponding to a style.
 
int rowCount (const QModelIndex &parent) const override
 
void setShowDefaultStyle (bool show)
 Sets whether the default style should also be included in the model.
 
bool showDefaultStyle () const
 Returns true if the model includes the default style.
 
QgsStylestyleFromIndex (const QModelIndex &index) const
 Returns the style at the corresponding index.
 

Detailed Description

List model representing the style databases associated with a QgsProject.

Since
QGIS 3.26

Definition at line 371 of file qgsprojectstylesettings.h.

Member Enumeration Documentation

◆ CustomRole

Custom model roles.

Note
Prior to QGIS 3.36 this was available as QgsProjectStyleDatabaseModel::Role
Since
QGIS 3.36
Enumerator
Style 

Style object.

Path 

Style path.

Definition at line 385 of file qgsprojectstylesettings.h.

Constructor & Destructor Documentation

◆ QgsProjectStyleDatabaseModel()

QgsProjectStyleDatabaseModel::QgsProjectStyleDatabaseModel ( QgsProjectStyleSettings settings,
QObject *  parent = nullptr 
)
explicit

Constructor for QgsProjectStyleDatabaseModel, showing the styles from the specified settings.

Definition at line 593 of file qgsprojectstylesettings.cpp.

Member Function Documentation

◆ data()

QVariant QgsProjectStyleDatabaseModel::data ( const QModelIndex &  index,
int  role 
) const
override

Definition at line 613 of file qgsprojectstylesettings.cpp.

◆ indexFromStyle()

QModelIndex QgsProjectStyleDatabaseModel::indexFromStyle ( QgsStyle style) const

Returns the model index corresponding to a style.

See also
styleFromIndex()

Definition at line 678 of file qgsprojectstylesettings.cpp.

◆ rowCount()

int QgsProjectStyleDatabaseModel::rowCount ( const QModelIndex &  parent) const
override

Definition at line 607 of file qgsprojectstylesettings.cpp.

◆ setShowDefaultStyle()

void QgsProjectStyleDatabaseModel::setShowDefaultStyle ( bool  show)

Sets whether the default style should also be included in the model.

See also
showDefaultStyle()

Definition at line 703 of file qgsprojectstylesettings.cpp.

◆ showDefaultStyle()

bool QgsProjectStyleDatabaseModel::showDefaultStyle ( ) const
inline

Returns true if the model includes the default style.

See also
setShowDefaultStyle()

Definition at line 425 of file qgsprojectstylesettings.h.

◆ styleFromIndex()

QgsStyle * QgsProjectStyleDatabaseModel::styleFromIndex ( const QModelIndex &  index) const

Returns the style at the corresponding index.

See also
indexFromStyle()

Definition at line 666 of file qgsprojectstylesettings.cpp.


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