QGIS API Documentation
2.4.0-Chugiak
|
A model for displaying columns shown in a QgsComposerAttributeTable. More...
#include <qgscomposerattributetablemodel.h>
Public Types | |
enum | ShiftDirection { ShiftUp, ShiftDown } |
Public Member Functions | |
QgsComposerAttributeTableColumnModel (QgsComposerAttributeTable *composerTable, QObject *parent=0) | |
Constructor for QgsComposerAttributeTableColumnModel. More... | |
virtual | ~QgsComposerAttributeTableColumnModel () |
virtual int | rowCount (const QModelIndex &parent=QModelIndex()) const |
int | columnCount (const QModelIndex &parent=QModelIndex()) const |
virtual QVariant | data (const QModelIndex &index, int role) const |
QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const |
virtual bool | setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) |
Qt::ItemFlags | flags (const QModelIndex &index) const |
bool | removeRows (int row, int count, const QModelIndex &parent=QModelIndex()) |
bool | insertRows (int row, int count, const QModelIndex &parent=QModelIndex()) |
QModelIndex | index (int row, int column, const QModelIndex &parent) const |
QModelIndex | parent (const QModelIndex &child) const |
bool | moveRow (int row, ShiftDirection direction) |
Moves the specified row up or down in the model. More... | |
void | resetToLayer () |
Resets the attribute table's columns to match the source layer's fields. More... | |
QgsComposerTableColumn * | columnFromIndex (const QModelIndex &index) const |
Returns the QgsComposerTableColumn corresponding to an index in the model. More... | |
QModelIndex | indexFromColumn (QgsComposerTableColumn *column) |
Returns a QModelIndex corresponding to a QgsComposerTableColumn in the model. More... | |
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... | |
bool | moveColumnInSortRank (QgsComposerTableColumn *column, ShiftDirection direction) |
Moves a column up or down in the sort rank for the QgsComposerAttributeTable. More... | |
Private Attributes | |
QgsComposerAttributeTable * | mComposerTable |
A model for displaying columns shown in a QgsComposerAttributeTable.
Definition at line 30 of file qgscomposerattributetablemodel.h.
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 38 of file qgscomposerattributetablemodel.h.
QgsComposerAttributeTableColumnModel::QgsComposerAttributeTableColumnModel | ( | QgsComposerAttributeTable * | composerTable, |
QObject * | parent = 0 |
||
) |
Constructor for QgsComposerAttributeTableColumnModel.
composerTable | QgsComposerAttributeTable the model is attached to |
parent | optional parent |
Definition at line 26 of file qgscomposerattributetablemodel.cpp.
|
virtual |
Definition at line 32 of file qgscomposerattributetablemodel.cpp.
int QgsComposerAttributeTableColumnModel::columnCount | ( | const QModelIndex & | parent = QModelIndex() | ) | const |
Definition at line 63 of file qgscomposerattributetablemodel.cpp.
QgsComposerTableColumn * QgsComposerAttributeTableColumnModel::columnFromIndex | ( | const QModelIndex & | index | ) | const |
Returns the QgsComposerTableColumn corresponding to an index in the model.
index | a QModelIndex |
Definition at line 287 of file qgscomposerattributetablemodel.cpp.
|
virtual |
Definition at line 69 of file qgscomposerattributetablemodel.cpp.
References QgsComposerTableColumn::attribute(), columnFromIndex(), QgsComposerTable::columns(), QgsComposerTableColumn::hAlignment(), QgsComposerTableColumn::heading(), mComposerTable, and tr.
Qt::ItemFlags QgsComposerAttributeTableColumnModel::flags | ( | const QModelIndex & | index | ) | const |
Definition at line 211 of file qgscomposerattributetablemodel.cpp.
QVariant QgsComposerAttributeTableColumnModel::headerData | ( | int | section, |
Qt::Orientation | orientation, | ||
int | role = Qt::DisplayRole |
||
) | const |
Definition at line 129 of file qgscomposerattributetablemodel.cpp.
References mComposerTable, and tr.
QModelIndex QgsComposerAttributeTableColumnModel::index | ( | int | row, |
int | column, | ||
const QModelIndex & | parent | ||
) | const |
Definition at line 37 of file qgscomposerattributetablemodel.cpp.
References QgsComposerTable::columns(), and mComposerTable.
Referenced by indexFromColumn().
QModelIndex QgsComposerAttributeTableColumnModel::indexFromColumn | ( | QgsComposerTableColumn * | column | ) |
Returns a QModelIndex corresponding to a QgsComposerTableColumn in the model.
column | a QgsComposerTableColumn |
Definition at line 293 of file qgscomposerattributetablemodel.cpp.
References QgsComposerTable::columns(), index(), and mComposerTable.
Referenced by moveColumnInSortRank(), setColumnAsSorted(), and setColumnAsUnsorted().
bool QgsComposerAttributeTableColumnModel::insertRows | ( | int | row, |
int | count, | ||
const QModelIndex & | parent = QModelIndex() |
||
) |
Definition at line 241 of file qgscomposerattributetablemodel.cpp.
References QgsComposerTable::columns(), and mComposerTable.
bool QgsComposerAttributeTableColumnModel::moveColumnInSortRank | ( | QgsComposerTableColumn * | column, |
ShiftDirection | direction | ||
) |
Moves a column up or down in the sort rank for the QgsComposerAttributeTable.
column | a QgsComposerTableColumn |
direction | direction to move the column in the sort rank list |
Definition at line 350 of file qgscomposerattributetablemodel.cpp.
References QgsComposerTable::columns(), columnsBySortRank(), indexFromColumn(), mComposerTable, QgsComposerTableColumn::setSortByRank(), ShiftDown, ShiftUp, and QgsComposerTableColumn::sortByRank().
bool QgsComposerAttributeTableColumnModel::moveRow | ( | int | row, |
ShiftDirection | direction | ||
) |
Moves the specified row up or down in the model.
Used for rearranging the attribute tables columns.
row | row in model representing attribute table column to move |
direction | direction to move the attribute table column |
Definition at line 255 of file qgscomposerattributetablemodel.cpp.
References QgsComposerTable::columns(), mComposerTable, rowCount(), ShiftDown, and ShiftUp.
QModelIndex QgsComposerAttributeTableColumnModel::parent | ( | const QModelIndex & | child | ) | const |
Definition at line 49 of file qgscomposerattributetablemodel.cpp.
bool QgsComposerAttributeTableColumnModel::removeRows | ( | int | row, |
int | count, | ||
const QModelIndex & | parent = QModelIndex() |
||
) |
Definition at line 225 of file qgscomposerattributetablemodel.cpp.
References QgsComposerTable::columns(), and mComposerTable.
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.
Definition at line 280 of file qgscomposerattributetablemodel.cpp.
References mComposerTable, and QgsComposerAttributeTable::resetColumns().
|
virtual |
Definition at line 55 of file qgscomposerattributetablemodel.cpp.
References QgsComposerTable::columns(), and mComposerTable.
Referenced by moveRow().
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.
column | a QgsComposerTableColumn |
order | sort order for column |
Definition at line 311 of file qgscomposerattributetablemodel.cpp.
References QgsComposerTable::columns(), indexFromColumn(), mComposerTable, QgsComposerTableColumn::setSortByRank(), and QgsComposerTableColumn::setSortOrder().
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.
column | a QgsComposerTableColumn |
Definition at line 333 of file qgscomposerattributetablemodel.cpp.
References indexFromColumn(), mComposerTable, and QgsComposerTableColumn::setSortByRank().
|
virtual |
Definition at line 166 of file qgscomposerattributetablemodel.cpp.
References QgsComposerTableColumn::attribute(), columnFromIndex(), QgsComposerTable::columns(), QgsComposerTableColumn::heading(), mComposerTable, QgsComposerTableColumn::setAttribute(), QgsComposerTableColumn::setHAlignment(), and QgsComposerTableColumn::setHeading().
|
private |
Definition at line 120 of file qgscomposerattributetablemodel.h.
Referenced by data(), headerData(), index(), indexFromColumn(), insertRows(), moveColumnInSortRank(), moveRow(), removeRows(), resetToLayer(), rowCount(), setColumnAsSorted(), setColumnAsUnsorted(), and setData().