QGIS API Documentation  3.12.1-BucureČ™ti (121cc00ff0)
Public Types | Public Member Functions | List of all members
QgsLayoutAttributeTableColumnModel Class Reference

A model for displaying columns shown in a QgsLayoutAttributeTable. More...

#include <qgslayoutattributeselectiondialog.h>

Inheritance diagram for QgsLayoutAttributeTableColumnModel:
Inheritance graph
[legend]

Public Types

enum  ShiftDirection { ShiftUp, ShiftDown }
 Controls whether a row/column is shifted up or down. More...
 

Public Member Functions

 QgsLayoutAttributeTableColumnModel (QgsLayoutItemAttributeTable *table, QObject *parent=nullptr)
 Constructor for QgsLayoutAttributeTableColumnModel. More...
 
int columnCount (const QModelIndex &parent=QModelIndex()) const override
 
QgsLayoutTableColumncolumnFromIndex (const QModelIndex &index) const
 Returns the QgsLayoutTableColumn corresponding to an index in the model. More...
 
QVariant data (const QModelIndex &index, int role) const override
 
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
 
QModelIndex indexFromColumn (QgsLayoutTableColumn *column)
 Returns a QModelIndex corresponding to a QgsLayoutTableColumn in the model. More...
 
bool insertRows (int row, int count, const QModelIndex &parent=QModelIndex()) override
 
bool moveColumnInSortRank (QgsLayoutTableColumn *column, ShiftDirection direction)
 Moves a column up or down in the sort rank for the QgsLayoutItemAttributeTable. More...
 
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
 
void resetToLayer ()
 Resets the attribute table's columns to match the source layer's fields. More...
 
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 
void setColumnAsSorted (QgsLayoutTableColumn *column, Qt::SortOrder order)
 Sets a specified column as a sorted column in the QgsLayoutItemAttributeTable. More...
 
void setColumnAsUnsorted (QgsLayoutTableColumn *column)
 Sets a specified column as an unsorted column in the QgsLayoutItemAttributeTable. More...
 
bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
 

Detailed Description

A model for displaying columns shown in a QgsLayoutAttributeTable.

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

Definition at line 52 of file qgslayoutattributeselectiondialog.h.

Member Enumeration Documentation

◆ 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 61 of file qgslayoutattributeselectiondialog.h.

Constructor & Destructor Documentation

◆ QgsLayoutAttributeTableColumnModel()

QgsLayoutAttributeTableColumnModel::QgsLayoutAttributeTableColumnModel ( 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 QgsLayoutAttributeTableColumnModel::columnCount ( const QModelIndex &  parent = QModelIndex()) const
override

Definition at line 73 of file qgslayoutattributeselectiondialog.cpp.

◆ columnFromIndex()

QgsLayoutTableColumn * QgsLayoutAttributeTableColumnModel::columnFromIndex ( const QModelIndex &  index) const

Returns the QgsLayoutTableColumn corresponding to an index in the model.

See also
indexFromColumn()

Definition at line 340 of file qgslayoutattributeselectiondialog.cpp.

◆ data()

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

Definition at line 79 of file qgslayoutattributeselectiondialog.cpp.

◆ flags()

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

Definition at line 264 of file qgslayoutattributeselectiondialog.cpp.

◆ headerData()

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

Definition at line 174 of file qgslayoutattributeselectiondialog.cpp.

◆ index()

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

Definition at line 47 of file qgslayoutattributeselectiondialog.cpp.

◆ indexFromColumn()

QModelIndex QgsLayoutAttributeTableColumnModel::indexFromColumn ( QgsLayoutTableColumn column)

Returns a QModelIndex corresponding to a QgsLayoutTableColumn in the model.

See also
columnFromIndex()

Definition at line 346 of file qgslayoutattributeselectiondialog.cpp.

◆ insertRows()

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

Definition at line 294 of file qgslayoutattributeselectiondialog.cpp.

◆ moveColumnInSortRank()

bool QgsLayoutAttributeTableColumnModel::moveColumnInSortRank ( QgsLayoutTableColumn column,
ShiftDirection  direction 
)

Moves a column up or down in the sort rank for the QgsLayoutItemAttributeTable.

See also
setColumnAsSorted()

Definition at line 402 of file qgslayoutattributeselectiondialog.cpp.

◆ moveRow()

bool QgsLayoutAttributeTableColumnModel::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 308 of file qgslayoutattributeselectiondialog.cpp.

◆ parent()

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

Definition at line 59 of file qgslayoutattributeselectiondialog.cpp.

◆ removeRows()

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

Definition at line 278 of file qgslayoutattributeselectiondialog.cpp.

◆ resetToLayer()

void QgsLayoutAttributeTableColumnModel::resetToLayer ( )

Resets the attribute table's columns to match the source layer's fields.

Remove all existing attribute table columns and column customizations.

Definition at line 333 of file qgslayoutattributeselectiondialog.cpp.

◆ rowCount()

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

Definition at line 65 of file qgslayoutattributeselectiondialog.cpp.

◆ setColumnAsSorted()

void QgsLayoutAttributeTableColumnModel::setColumnAsSorted ( QgsLayoutTableColumn column,
Qt::SortOrder  order 
)

Sets a specified column as a sorted column in the QgsLayoutItemAttributeTable.

The column will be added to the end of the sort rank list, ie it will take the next largest available sort rank.

See also
moveColumnInSortRank()

Definition at line 364 of file qgslayoutattributeselectiondialog.cpp.

◆ setColumnAsUnsorted()

void QgsLayoutAttributeTableColumnModel::setColumnAsUnsorted ( QgsLayoutTableColumn column)

Sets a specified column as an unsorted column in the QgsLayoutItemAttributeTable.

The column will be removed from the sort rank list.

See also
setColumnAsSorted()

Definition at line 385 of file qgslayoutattributeselectiondialog.cpp.

◆ setData()

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

Definition at line 214 of file qgslayoutattributeselectiondialog.cpp.


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