QGIS API Documentation  3.20.0-Odense (decaadbb31)
Public Types | Public Member Functions | Protected Attributes | List of all members
QgsLayoutAttributeTableColumnModelBase Class Referenceabstract

A base model to hold the displaying or sortings columns used in a QgsLayoutAttributeTable. More...

#include <qgslayoutattributeselectiondialog.h>

Inheritance diagram for QgsLayoutAttributeTableColumnModelBase:
Inheritance graph
[legend]

Public Types

enum  Column {
  Attribute , Heading , Alignment , Width ,
  SortOrder
}
 Available columns for the configuration table to be used by the model. More...
 
enum  ShiftDirection { ShiftUp , ShiftDown }
 Controls whether a row/column is shifted up or down. More...
 

Public Member Functions

 QgsLayoutAttributeTableColumnModelBase (QgsLayoutItemAttributeTable *table, QObject *parent=nullptr)
 Constructor for QgsLayoutAttributeTableColumnModel. More...
 
int columnCount (const QModelIndex &parent=QModelIndex()) const override
 
virtual QVector< QgsLayoutTableColumn > & columns () const =0
 To be reimplemented to provide the display or the sort columns. More...
 
QVariant data (const QModelIndex &index, int role) const override
 
virtual QList< ColumndisplayedColumns () const =0
 To be reimplemented to choose which column should be used by the model. More...
 
Qt::ItemFlags flags (const QModelIndex &index) const override
 
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
 
QModelIndex index (int row, int column, const QModelIndex &parent) const override
 
bool insertRows (int row, int count, const QModelIndex &parent=QModelIndex()) override
 
bool moveRow (int row, ShiftDirection direction)
 Moves the specified row up or down in the model. More...
 
QModelIndex parent (const QModelIndex &child) const override
 
bool removeRows (int row, int count, const QModelIndex &parent=QModelIndex()) override
 
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 
bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
 

Protected Attributes

QgsLayoutItemAttributeTablemTable = nullptr
 

Detailed Description

A base model to hold the displaying or sortings columns used in a QgsLayoutAttributeTable.

Note
This class is not a part of public API
Since
QGIS 3.14

Definition at line 53 of file qgslayoutattributeselectiondialog.h.

Member Enumeration Documentation

◆ Column

Available columns for the configuration table to be used by the model.

Enumerator
Attribute 

Attribute for a field or an expression.

Heading 

Defines the title of the column.

Alignment 

Defines the alignment of the column.

Width 

Defines the width of the column.

SortOrder 

Defines the sort order.

Definition at line 71 of file qgslayoutattributeselectiondialog.h.

◆ ShiftDirection

Controls whether a row/column is shifted up or down.

Enumerator
ShiftUp 

Shift the row/column up.

ShiftDown 

Shift the row/column down.

Definition at line 62 of file qgslayoutattributeselectiondialog.h.

Constructor & Destructor Documentation

◆ QgsLayoutAttributeTableColumnModelBase()

QgsLayoutAttributeTableColumnModelBase::QgsLayoutAttributeTableColumnModelBase ( QgsLayoutItemAttributeTable table,
QObject *  parent = nullptr 
)

Constructor for QgsLayoutAttributeTableColumnModel.

Parameters
tableQgsLayoutItemAttributeTable the model is attached to
parentoptional parent

Definition at line 41 of file qgslayoutattributeselectiondialog.cpp.

Member Function Documentation

◆ columnCount()

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

Definition at line 74 of file qgslayoutattributeselectiondialog.cpp.

◆ columns()

virtual QVector<QgsLayoutTableColumn>& QgsLayoutAttributeTableColumnModelBase::columns ( ) const
pure virtual

To be reimplemented to provide the display or the sort columns.

Implemented in QgsLayoutTableSortModel, and QgsLayoutAttributeTableColumnModel.

◆ data()

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

Definition at line 80 of file qgslayoutattributeselectiondialog.cpp.

◆ displayedColumns()

virtual QList<Column> QgsLayoutAttributeTableColumnModelBase::displayedColumns ( ) const
pure virtual

To be reimplemented to choose which column should be used by the model.

Implemented in QgsLayoutTableSortModel, and QgsLayoutAttributeTableColumnModel.

◆ flags()

Qt::ItemFlags QgsLayoutAttributeTableColumnModelBase::flags ( const QModelIndex &  index) const
override

Definition at line 273 of file qgslayoutattributeselectiondialog.cpp.

◆ headerData()

QVariant QgsLayoutAttributeTableColumnModelBase::headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const
override

Definition at line 182 of file qgslayoutattributeselectiondialog.cpp.

◆ index()

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

Definition at line 47 of file qgslayoutattributeselectiondialog.cpp.

◆ insertRows()

bool QgsLayoutAttributeTableColumnModelBase::insertRows ( int  row,
int  count,
const QModelIndex &  parent = QModelIndex() 
)
override

Definition at line 302 of file qgslayoutattributeselectiondialog.cpp.

◆ moveRow()

bool QgsLayoutAttributeTableColumnModelBase::moveRow ( int  row,
ShiftDirection  direction 
)

Moves the specified row up or down in the model.

Used for rearranging the attribute tables columns.

Returns
true if the move is allowed
Parameters
rowrow in model representing attribute table column to move
directiondirection to move the attribute table column

Definition at line 315 of file qgslayoutattributeselectiondialog.cpp.

◆ parent()

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

Definition at line 60 of file qgslayoutattributeselectiondialog.cpp.

◆ removeRows()

bool QgsLayoutAttributeTableColumnModelBase::removeRows ( int  row,
int  count,
const QModelIndex &  parent = QModelIndex() 
)
override

Definition at line 287 of file qgslayoutattributeselectiondialog.cpp.

◆ rowCount()

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

Definition at line 66 of file qgslayoutattributeselectiondialog.cpp.

◆ setData()

bool QgsLayoutAttributeTableColumnModelBase::setData ( const QModelIndex &  index,
const QVariant &  value,
int  role = Qt::EditRole 
)
override

Definition at line 221 of file qgslayoutattributeselectiondialog.cpp.

Member Data Documentation

◆ mTable

QgsLayoutItemAttributeTable* QgsLayoutAttributeTableColumnModelBase::mTable = nullptr
protected

Definition at line 114 of file qgslayoutattributeselectiondialog.h.


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