QGIS API Documentation  2.7.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 }
 

Public Member Functions

 QgsComposerAttributeTableColumnModel (QgsComposerAttributeTable *composerTable, QObject *parent=0)
 Constructor for QgsComposerAttributeTableColumnModel. More...
 
virtual ~QgsComposerAttributeTableColumnModel ()
 
int columnCount (const QModelIndex &parent=QModelIndex()) const
 
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
 
Qt::ItemFlags flags (const QModelIndex &index) const
 
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
 
QModelIndex index (int row, int column, const QModelIndex &parent) const
 
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())
 
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
 
bool removeRows (int row, int count, const QModelIndex &parent=QModelIndex())
 
void resetToLayer ()
 Resets the attribute table's columns to match the source layer's fields. More...
 
virtual int rowCount (const QModelIndex &parent=QModelIndex()) const
 
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)
 

Detailed Description

A model for displaying columns shown in a QgsComposerAttributeTable.

Definition at line 30 of file qgscomposerattributetablemodel.h.

Member Enumeration Documentation

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.

Constructor & Destructor Documentation

QgsComposerAttributeTableColumnModel::QgsComposerAttributeTableColumnModel ( QgsComposerAttributeTable composerTable,
QObject *  parent = 0 
)

Constructor for QgsComposerAttributeTableColumnModel.

Parameters
composerTableQgsComposerAttributeTable the model is attached to
parentoptional parent

Definition at line 26 of file qgscomposerattributetablemodel.cpp.

QgsComposerAttributeTableColumnModel::~QgsComposerAttributeTableColumnModel ( )
virtual

Definition at line 32 of file qgscomposerattributetablemodel.cpp.

Member Function Documentation

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.

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

Definition at line 287 of file qgscomposerattributetablemodel.cpp.

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

Definition at line 69 of file qgscomposerattributetablemodel.cpp.

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.

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

Definition at line 37 of file qgscomposerattributetablemodel.cpp.

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 293 of file qgscomposerattributetablemodel.cpp.

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

Definition at line 241 of file qgscomposerattributetablemodel.cpp.

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 350 of file qgscomposerattributetablemodel.cpp.

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 255 of file qgscomposerattributetablemodel.cpp.

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.

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 280 of file qgscomposerattributetablemodel.cpp.

int QgsComposerAttributeTableColumnModel::rowCount ( const QModelIndex &  parent = QModelIndex()) const
virtual

Definition at line 55 of file qgscomposerattributetablemodel.cpp.

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 311 of file qgscomposerattributetablemodel.cpp.

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 333 of file qgscomposerattributetablemodel.cpp.

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

Definition at line 166 of file qgscomposerattributetablemodel.cpp.


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