te::qt::widgets::DataSetTableModel Class Reference

A table model representing a te::da::DataSet. More...

#include <DataSetTableModel.h>

Inheritance diagram for te::qt::widgets::DataSetTableModel:
QAbstractTableModel

Public Member Functions

 DataSetTableModel (QObject *parent=0)
 Constructor. More...
 
void discardEditions ()
 Discard editions. More...
 
std::unique_ptr< te::da::DataSetgetEditions (const te::da::DataSetType *type, std::vector< std::set< int > > &ps)
 Returns a memory dataset to be saved. More...
 
te::da::ObjectIdSetgetObjectIdSet (const int &initRow, const int &finalRow)
 Returns the ObjectIdSet begining with row initRow and ending in finalRow. More...
 
PromotergetPromoter ()
 Returns the pointer to the promoter being used. More...
 
bool hasEditions () const
 Returns true if there are unsaved editions. More...
 
void promote (const te::da::ObjectIdSet *oids)
 Promotes the rows identified by oids. More...
 
void setDataSet (te::da::DataSet *dset, const bool &clearEditor=true)
 Updates the data being used. More...
 
void setEditable (const bool &editable)
 Sets if the model is editable or not. More...
 
void setEnabled (const bool &enabled)
 Enable or disable the dataset presentation. More...
 
void setPkeysColumns (const std::vector< size_t > &pkeys)
 Sets the columns used as pkeys, for presentation purposes. More...
 
void showOIdsVisible (const bool &visible)
 Shows an icon for indentify the columns that are used for identify objects. More...
 
virtual ~DataSetTableModel ()
 Virtual destructor. More...
 
QAbstractTableModel re-implementation methods.

Re-implementation of QAbstractTableModel methods.

int rowCount (const QModelIndex &parent) const
 
int columnCount (const QModelIndex &parent) const
 
QVariant data (const QModelIndex &index, int role) const
 
QVariant headerData (int section, Qt::Orientation orientation, int role) const
 
Qt::ItemFlags flags (const QModelIndex &index) const
 
bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
 
bool insertColumns (int column, int count, const QModelIndex &parent=QModelIndex())
 
bool removeColumns (int column, int count, const QModelIndex &parent=QModelIndex())
 

Protected Attributes

int m_currentRow
 An internal row pointer. More...
 
te::da::DataSetm_dataset
 The dataset being used. More...
 
std::unique_ptr< Editorm_editor
 Pointer to editor. More...
 
bool m_enabled
 Enabling flag. More...
 
bool m_isEditable
 Flag that indicates if the model is editable. More...
 
bool m_OIdsVisible
 Oids icon visibility. More...
 
std::vector< size_t > m_pkeysColumns
 Primary key columns. More...
 
Promoterm_promoter
 Promoter to be used. More...
 
int m_rowCount
 Number of rows. More...
 

Detailed Description

A table model representing a te::da::DataSet.

Definition at line 68 of file DataSetTableModel.h.

Constructor & Destructor Documentation

te::qt::widgets::DataSetTableModel::DataSetTableModel ( QObject parent = 0)

Constructor.

Definition at line 273 of file DataSetTableModel.cpp.

References m_editor, and m_promoter.

te::qt::widgets::DataSetTableModel::~DataSetTableModel ( )
virtual

Virtual destructor.

Definition at line 285 of file DataSetTableModel.cpp.

References m_dataset, and m_promoter.

Member Function Documentation

int te::qt::widgets::DataSetTableModel::columnCount ( const QModelIndex &  parent) const

Definition at line 403 of file DataSetTableModel.cpp.

References te::da::DataSet::getNumProperties(), and m_dataset.

void te::qt::widgets::DataSetTableModel::discardEditions ( )

Discard editions.

Definition at line 393 of file DataSetTableModel.cpp.

References m_editor.

Qt::ItemFlags te::qt::widgets::DataSetTableModel::flags ( const QModelIndex &  index) const

Definition at line 515 of file DataSetTableModel.cpp.

References IsPkey(), m_isEditable, and m_pkeysColumns.

std::unique_ptr< te::da::DataSet > te::qt::widgets::DataSetTableModel::getEditions ( const te::da::DataSetType type,
std::vector< std::set< int > > &  ps 
)

Returns a memory dataset to be saved.

Parameters
typeDataSetType to construct memory dataset.
[out]psPositions of the columns edited for each row.
Returns
Memory dataset with editions.

Definition at line 376 of file DataSetTableModel.cpp.

References DataSet(), m_dataset, and m_editor.

Referenced by te::qt::widgets::DataSetTableView::saveEditions().

te::da::ObjectIdSet * te::qt::widgets::DataSetTableModel::getObjectIdSet ( const int initRow,
const int finalRow 
)
te::qt::widgets::Promoter * te::qt::widgets::DataSetTableModel::getPromoter ( )
bool te::qt::widgets::DataSetTableModel::hasEditions ( ) const

Returns true if there are unsaved editions.

Returns
True if there are unsaved editions, false otherwise.

Definition at line 388 of file DataSetTableModel.cpp.

References m_editor.

Referenced by te::qt::widgets::DataSetTableView::hasEditions(), and te::qt::widgets::DataSetTableView::~DataSetTableView().

QVariant te::qt::widgets::DataSetTableModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role 
) const
bool te::qt::widgets::DataSetTableModel::insertColumns ( int  column,
int  count,
const QModelIndex &  parent = QModelIndex() 
)

Definition at line 587 of file DataSetTableModel.cpp.

Referenced by te::qt::widgets::DataSetTableView::addColumn().

void te::qt::widgets::DataSetTableModel::promote ( const te::da::ObjectIdSet oids)

Promotes the rows identified by oids.

oids The identifiers of the rows to be promoted.

Definition at line 315 of file DataSetTableModel.cpp.

References m_promoter, and te::qt::widgets::Promoter::promote().

Referenced by te::qt::widgets::DataSetTableView::promote().

bool te::qt::widgets::DataSetTableModel::removeColumns ( int  column,
int  count,
const QModelIndex &  parent = QModelIndex() 
)

Definition at line 596 of file DataSetTableModel.cpp.

References m_editor.

Referenced by te::qt::widgets::DataSetTableView::removeColumn().

int te::qt::widgets::DataSetTableModel::rowCount ( const QModelIndex &  parent) const

Definition at line 398 of file DataSetTableModel.cpp.

References m_rowCount.

void te::qt::widgets::DataSetTableModel::setDataSet ( te::da::DataSet dset,
const bool clearEditor = true 
)

Updates the data being used.

Parameters
dsetThe new data set to be used.
clearEditorTrue for reset editions, false to maintain it.
Note
This method DOES TAKE the ownership of dset.

Definition at line 291 of file DataSetTableModel.cpp.

References m_dataset, m_editor, m_enabled, m_rowCount, te::da::DataSet::moveFirst(), and te::da::DataSet::size().

Referenced by te::qt::widgets::QueryDataSourceDialog::onApplyPushButtonClicked(), te::qt::widgets::QueryDataSourceDialog::onClearPushButtonClicked(), te::qt::widgets::QueryDataSourceDialog::onExecutePushButtonClicked(), and te::qt::widgets::DataSetTableView::setDataSet().

void te::qt::widgets::DataSetTableModel::setEditable ( const bool editable)

Sets if the model is editable or not.

Parameters
editableTrue if the model is editable, false otherwise.

Definition at line 371 of file DataSetTableModel.cpp.

References m_isEditable.

Referenced by te::qt::widgets::DataSetTableView::setLayer().

void te::qt::widgets::DataSetTableModel::setEnabled ( const bool enabled)

Enable or disable the dataset presentation.

Parameters
enabledTrue for show dataSet on table, false to hide it.

Definition at line 360 of file DataSetTableModel.cpp.

References m_dataset, m_enabled, m_rowCount, and te::da::DataSet::size().

Referenced by te::qt::widgets::DataSetTableView::promote().

void te::qt::widgets::DataSetTableModel::setPkeysColumns ( const std::vector< size_t > &  pkeys)

Sets the columns used as pkeys, for presentation purposes.

Parameters
pkeysPositions of the columns that form the primary key.

Definition at line 310 of file DataSetTableModel.cpp.

References m_pkeysColumns.

Referenced by te::qt::widgets::DataSetTableView::setLayerSchema().

void te::qt::widgets::DataSetTableModel::showOIdsVisible ( const bool visible)

Shows an icon for indentify the columns that are used for identify objects.

Definition at line 329 of file DataSetTableModel.cpp.

References m_OIdsVisible.

Referenced by te::qt::widgets::DataSetTableView::setOIdsColumnsVisible().

Member Data Documentation

int te::qt::widgets::DataSetTableModel::m_currentRow
mutableprotected

An internal row pointer.

Definition at line 199 of file DataSetTableModel.h.

Referenced by data().

te::da::DataSet* te::qt::widgets::DataSetTableModel::m_dataset
protected

The dataset being used.

Definition at line 197 of file DataSetTableModel.h.

Referenced by columnCount(), data(), getEditions(), getObjectIdSet(), headerData(), setData(), setDataSet(), setEnabled(), and ~DataSetTableModel().

std::unique_ptr<Editor> te::qt::widgets::DataSetTableModel::m_editor
protected

Pointer to editor.

Definition at line 213 of file DataSetTableModel.h.

Referenced by data(), DataSetTableModel(), discardEditions(), getEditions(), hasEditions(), removeColumns(), setData(), and setDataSet().

bool te::qt::widgets::DataSetTableModel::m_enabled
protected

Enabling flag.

Definition at line 207 of file DataSetTableModel.h.

Referenced by setDataSet(), and setEnabled().

bool te::qt::widgets::DataSetTableModel::m_isEditable
protected

Flag that indicates if the model is editable.

Definition at line 211 of file DataSetTableModel.h.

Referenced by flags(), and setEditable().

bool te::qt::widgets::DataSetTableModel::m_OIdsVisible
protected

Oids icon visibility.

Definition at line 205 of file DataSetTableModel.h.

Referenced by headerData(), and showOIdsVisible().

std::vector<size_t> te::qt::widgets::DataSetTableModel::m_pkeysColumns
protected

Primary key columns.

Definition at line 201 of file DataSetTableModel.h.

Referenced by flags(), getObjectIdSet(), headerData(), and setPkeysColumns().

Promoter* te::qt::widgets::DataSetTableModel::m_promoter
protected
int te::qt::widgets::DataSetTableModel::m_rowCount
protected

Number of rows.

Definition at line 209 of file DataSetTableModel.h.

Referenced by rowCount(), setDataSet(), and setEnabled().


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