QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
Public Types | Public Member Functions | List of all members
QgsComposerAttributeTableColumnModel Class Reference

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

#include <qgscomposerattributetablemodel.h>

Inheritance diagram for QgsComposerAttributeTableColumnModel:
Inheritance graph
[legend]

Public Types

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

Public Member Functions

 QgsComposerAttributeTableColumnModel (QgsComposerAttributeTable *composerTable, QObject *parent=nullptr)
 Constructor for QgsComposerAttributeTableColumnModel. More...
 
virtual ~QgsComposerAttributeTableColumnModel ()
 
int columnCount (const QModelIndex &parent=QModelIndex()) const override
 
QgsComposerTableColumncolumnFromIndex (const QModelIndex &index) const
 Returns the QgsComposerTableColumn corresponding to an index in the model. More...
 
virtual 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 (QgsComposerTableColumn *column)
 Returns a QModelIndex corresponding to a QgsComposerTableColumn in the model. More...
 
bool insertRows (int row, int count, const QModelIndex &parent=QModelIndex()) override
 
bool moveColumnInSortRank (QgsComposerTableColumn *column, ShiftDirection direction)
 Moves a column up or down in the sort rank for the QgsComposerAttributeTable. 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...
 
virtual int rowCount (const QModelIndex &parent=QModelIndex()) const override
 
void setColumnAsSorted (QgsComposerTableColumn *column, Qt::SortOrder order)
 Sets a specified column as a sorted column in the QgsComposerAttributeTable. More...
 
void setColumnAsUnsorted (QgsComposerTableColumn *column)
 Sets a specified column as an unsorted column in the QgsComposerAttributeTable. More...
 
virtual bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
 
- Public Member Functions inherited from QAbstractTableModel
 QAbstractTableModel (QObject *parent)
 
 ~QAbstractTableModel ()
 
virtual bool dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
 
- Public Member Functions inherited from QAbstractItemModel
 QAbstractItemModel (QObject *parent)
 
virtual ~QAbstractItemModel ()
 
virtual QModelIndex buddy (const QModelIndex &index) const
 
virtual bool canFetchMore (const QModelIndex &parent) const
 
virtual int columnCount (const QModelIndex &parent) const=0
 
void columnsAboutToBeInserted (const QModelIndex &parent, int start, int end)
 
void columnsAboutToBeMoved (const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationColumn)
 
void columnsAboutToBeRemoved (const QModelIndex &parent, int start, int end)
 
void columnsInserted (const QModelIndex &parent, int start, int end)
 
void columnsMoved (const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationColumn)
 
void columnsRemoved (const QModelIndex &parent, int start, int end)
 
virtual QVariant data (const QModelIndex &index, int role) const=0
 
void dataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight)
 
virtual void fetchMore (const QModelIndex &parent)
 
virtual bool hasChildren (const QModelIndex &parent) const
 
bool hasIndex (int row, int column, const QModelIndex &parent) const
 
void headerDataChanged (Qt::Orientation orientation, int first, int last)
 
virtual QModelIndex index (int row, int column, const QModelIndex &parent) const=0
 
bool insertColumn (int column, const QModelIndex &parent)
 
virtual bool insertColumns (int column, int count, const QModelIndex &parent)
 
bool insertRow (int row, const QModelIndex &parent)
 
virtual QMap< int, QVariantitemData (const QModelIndex &index) const
 
void layoutAboutToBeChanged ()
 
void layoutChanged ()
 
virtual QModelIndexList match (const QModelIndex &start, int role, const QVariant &value, int hits, QFlags< Qt::MatchFlag > flags) const
 
virtual QMimeDatamimeData (const QModelIndexList &indexes) const
 
virtual QStringList mimeTypes () const
 
void modelAboutToBeReset ()
 
void modelReset ()
 
virtual QModelIndex parent (const QModelIndex &index) const=0
 
bool removeColumn (int column, const QModelIndex &parent)
 
virtual bool removeColumns (int column, int count, const QModelIndex &parent)
 
bool removeRow (int row, const QModelIndex &parent)
 
virtual void revert ()
 
const QHash< int, QByteArray > & roleNames () const
 
virtual int rowCount (const QModelIndex &parent) const=0
 
void rowsAboutToBeInserted (const QModelIndex &parent, int start, int end)
 
void rowsAboutToBeMoved (const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow)
 
void rowsAboutToBeRemoved (const QModelIndex &parent, int start, int end)
 
void rowsInserted (const QModelIndex &parent, int start, int end)
 
void rowsMoved (const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow)
 
void rowsRemoved (const QModelIndex &parent, int start, int end)
 
virtual bool setHeaderData (int section, Qt::Orientation orientation, const QVariant &value, int role)
 
virtual bool setItemData (const QModelIndex &index, const QMap< int, QVariant > &roles)
 
void setSupportedDragActions (QFlags< Qt::DropAction > actions)
 
QModelIndex sibling (int row, int column, const QModelIndex &index) const
 
virtual void sort (int column, Qt::SortOrder order)
 
virtual QSize span (const QModelIndex &index) const
 
virtual bool submit ()
 
Qt::DropActions supportedDragActions () const
 
virtual Qt::DropActions supportedDropActions () const
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
 QObject (QObject *parent, const char *name)
 
virtual ~QObject ()
 
bool blockSignals (bool block)
 
QObjectchild (const char *objName, const char *inheritsClass, bool recursiveSearch) const
 
const QObjectList & children () const
 
const char * className () const
 
bool connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const QObject *receiver, const char *method)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method)
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QByteArraydynamicPropertyNames () const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name) const
 
QList< T > findChildren (const QRegExp &regExp) const
 
QList< T > findChildren (const QString &name) const
 
bool inherits (const char *className) const
 
void insertChild (QObject *object)
 
void installEventFilter (QObject *filterObj)
 
bool isA (const char *className) const
 
bool isWidgetType () const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const
 
void moveToThread (QThread *targetThread)
 
const char * name () const
 
const char * name (const char *defaultName) const
 
QString objectName () const
 
QObjectparent () const
 
QVariant property (const char *name) const
 
void removeChild (QObject *object)
 
void removeEventFilter (QObject *obj)
 
void setName (const char *name)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval)
 
QThreadthread () const
 

Additional Inherited Members

- Static Public Member Functions inherited from QObject
bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Protected Member Functions inherited from QAbstractItemModel
void beginInsertColumns (const QModelIndex &parent, int first, int last)
 
void beginInsertRows (const QModelIndex &parent, int first, int last)
 
bool beginMoveColumns (const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationChild)
 
bool beginMoveRows (const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationChild)
 
void beginRemoveColumns (const QModelIndex &parent, int first, int last)
 
void beginRemoveRows (const QModelIndex &parent, int first, int last)
 
void beginResetModel ()
 
void changePersistentIndex (const QModelIndex &from, const QModelIndex &to)
 
void changePersistentIndexList (const QModelIndexList &from, const QModelIndexList &to)
 
QModelIndex createIndex (int row, int column, void *ptr) const
 
QModelIndex createIndex (int row, int column, int id) const
 
QModelIndex createIndex (int row, int column, quint32 id) const
 
void endInsertColumns ()
 
void endInsertRows ()
 
void endMoveColumns ()
 
void endMoveRows ()
 
void endRemoveColumns ()
 
void endRemoveRows ()
 
void endResetModel ()
 
QModelIndexList persistentIndexList () const
 
void reset ()
 
void resetInternalData ()
 
void setRoleNames (const QHash< int, QByteArray > &roleNames)
 
- Protected Member Functions inherited from QObject
bool checkConnectArgs (const char *signal, const QObject *object, const char *method)
 
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const char *signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const char *signal)
 
int receivers (const char *signal) const
 
QObjectsender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 
- Static Protected Member Functions inherited from QObject
QByteArray normalizeSignalSlot (const char *signalSlot)
 
- Properties inherited from QObject
 objectName
 

Detailed Description

A model for displaying columns shown in a QgsComposerAttributeTable.

Definition at line 32 of file qgscomposerattributetablemodel.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 40 of file qgscomposerattributetablemodel.h.

Constructor & Destructor Documentation

◆ QgsComposerAttributeTableColumnModel()

QgsComposerAttributeTableColumnModel::QgsComposerAttributeTableColumnModel ( QgsComposerAttributeTable composerTable,
QObject parent = nullptr 
)

Constructor for QgsComposerAttributeTableColumnModel.

Parameters
composerTableQgsComposerAttributeTable the model is attached to
parentoptional parent

Definition at line 26 of file qgscomposerattributetablemodel.cpp.

◆ ~QgsComposerAttributeTableColumnModel()

QgsComposerAttributeTableColumnModel::~QgsComposerAttributeTableColumnModel ( )
virtual

Definition at line 32 of file qgscomposerattributetablemodel.cpp.

Member Function Documentation

◆ columnCount()

int QgsComposerAttributeTableColumnModel::columnCount ( const QModelIndex parent = QModelIndex()) const
override

Definition at line 63 of file qgscomposerattributetablemodel.cpp.

◆ columnFromIndex()

QgsComposerTableColumn * QgsComposerAttributeTableColumnModel::columnFromIndex ( const QModelIndex index) const

Returns the QgsComposerTableColumn corresponding to an index in the model.

Returns
QgsComposerTableColumn for specified index
Parameters
indexa QModelIndex
Note
added in 2.3
See also
indexFromColumn

Definition at line 312 of file qgscomposerattributetablemodel.cpp.

◆ data()

QVariant QgsComposerAttributeTableColumnModel::data ( const QModelIndex index,
int  role 
) const
overridevirtual

Definition at line 69 of file qgscomposerattributetablemodel.cpp.

◆ flags()

Qt::ItemFlags QgsComposerAttributeTableColumnModel::flags ( const QModelIndex index) const
overridevirtual

Reimplemented from QAbstractItemModel.

Definition at line 236 of file qgscomposerattributetablemodel.cpp.

◆ headerData()

QVariant QgsComposerAttributeTableColumnModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const
overridevirtual

Reimplemented from QAbstractItemModel.

Definition at line 153 of file qgscomposerattributetablemodel.cpp.

◆ index()

QModelIndex QgsComposerAttributeTableColumnModel::index ( int  row,
int  column,
const QModelIndex parent 
) const
overridevirtual

Reimplemented from QAbstractTableModel.

Definition at line 37 of file qgscomposerattributetablemodel.cpp.

◆ indexFromColumn()

QModelIndex QgsComposerAttributeTableColumnModel::indexFromColumn ( QgsComposerTableColumn column)

Returns a QModelIndex corresponding to a QgsComposerTableColumn in the model.

Returns
QModelIndex for specified QgsComposerTableColumn
Parameters
columna QgsComposerTableColumn
Note
added in 2.3
See also
columnFromIndex

Definition at line 318 of file qgscomposerattributetablemodel.cpp.

◆ insertRows()

bool QgsComposerAttributeTableColumnModel::insertRows ( int  row,
int  count,
const QModelIndex parent = QModelIndex() 
)
overridevirtual

Reimplemented from QAbstractItemModel.

Definition at line 266 of file qgscomposerattributetablemodel.cpp.

◆ moveColumnInSortRank()

bool QgsComposerAttributeTableColumnModel::moveColumnInSortRank ( QgsComposerTableColumn column,
ShiftDirection  direction 
)

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

Parameters
columna QgsComposerTableColumn
directiondirection to move the column in the sort rank list
Note
added in 2.3
See also
setColumnAsSorted

Definition at line 375 of file qgscomposerattributetablemodel.cpp.

◆ moveRow()

bool QgsComposerAttributeTableColumnModel::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
Note
added in 2.3

Definition at line 280 of file qgscomposerattributetablemodel.cpp.

◆ parent()

QModelIndex QgsComposerAttributeTableColumnModel::parent ( const QModelIndex child) const
override

Definition at line 49 of file qgscomposerattributetablemodel.cpp.

◆ removeRows()

bool QgsComposerAttributeTableColumnModel::removeRows ( int  row,
int  count,
const QModelIndex parent = QModelIndex() 
)
overridevirtual

Reimplemented from QAbstractItemModel.

Definition at line 250 of file qgscomposerattributetablemodel.cpp.

◆ resetToLayer()

void QgsComposerAttributeTableColumnModel::resetToLayer ( )

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

Remove all existing attribute table columns and column customisations.

Note
added in 2.3

Definition at line 305 of file qgscomposerattributetablemodel.cpp.

◆ rowCount()

int QgsComposerAttributeTableColumnModel::rowCount ( const QModelIndex parent = QModelIndex()) const
overridevirtual

Definition at line 55 of file qgscomposerattributetablemodel.cpp.

◆ setColumnAsSorted()

void QgsComposerAttributeTableColumnModel::setColumnAsSorted ( QgsComposerTableColumn column,
Qt::SortOrder  order 
)

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

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

Parameters
columna QgsComposerTableColumn
ordersort order for column
Note
added in 2.3
See also
removeColumnFromSort
moveColumnInSortRank

Definition at line 336 of file qgscomposerattributetablemodel.cpp.

◆ setColumnAsUnsorted()

void QgsComposerAttributeTableColumnModel::setColumnAsUnsorted ( QgsComposerTableColumn column)

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

The column will be removed from the sort rank list.

Parameters
columna QgsComposerTableColumn
Note
added in 2.3
See also
setColumnAsSorted

Definition at line 358 of file qgscomposerattributetablemodel.cpp.

◆ setData()

bool QgsComposerAttributeTableColumnModel::setData ( const QModelIndex index,
const QVariant value,
int  role = Qt::EditRole 
)
overridevirtual

Reimplemented from QAbstractItemModel.

Definition at line 190 of file qgscomposerattributetablemodel.cpp.


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