Classes | Public Types | Public Slots | Signals | Public Member Functions | Protected Member Functions | List of all members
pqSpreadSheetViewModel Class Reference

#include <pqSpreadSheetViewModel.h>

Inherits QAbstractTableModel.

Classes

class  vtkIndex
 

Public Types

enum  { SectionInternal = Qt::UserRole + 1, SectionVisible }
 

Public Slots

void forceUpdate ()
 resets the model. More...
 
void setActiveRepresentation (pqDataRepresentation *)
 Sets the active representation. More...
 
void setActiveRepresentationProxy (vtkSMProxy *)
 Sets the active representation. More...
 

Signals

void selectionChanged (const QItemSelection &selection)
 Fired whenever the server side selection changes. More...
 

Public Member Functions

 pqSpreadSheetViewModel (vtkSMProxy *viewProxy, QObject *parent=nullptr)
 
 ~pqSpreadSheetViewModel () override
 
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 Returns the number of rows. More...
 
int columnCount (const QModelIndex &parent=QModelIndex()) const override
 Returns the number of columns. More...
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
 Returns the data storeed under the given role for the item referred by the index. More...
 
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
 Returns the data for the given role and section in the header with the specified orientation. More...
 
void sortSection (int section, Qt::SortOrder order)
 Make a server request to sort based on a given column with a given order. More...
 
bool isSortable (int section)
 Return true only if the given column is sortable. More...
 
int getFieldType () const
 Returns the field type for the data currently shown by this model. More...
 
QSet< vtkIndexgetVTKIndices (const QModelIndexList &indexes)
 
void setDecimalPrecision (int)
 Set/Get the decimal precision for float and double type data. More...
 
int getDecimalPrecision ()
 
void setFixedRepresentation (bool)
 Set/Get whether the decimal representation is fixed or scientific. More...
 
bool getFixedRepresentation ()
 
void setActiveRegion (int row_top, int row_bottom)
 set the region (in row indices) that is currently being shown in the view. More...
 
pqDataRepresentationactiveRepresentation () const
 Returns the active representation. More...
 
vtkSMProxyactiveRepresentationProxy () const
 
Qt::ItemFlags flags (const QModelIndex &index) const override
 Method needed for copy/past cell editor. More...
 
bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
 
QString GetRowsAsString () const
 Returns the current rows as a CSV-formatted string, including header with column names. More...
 

Protected Member Functions

bool isDataValid (const QModelIndex &idx) const
 Given an index into the model, check to see that its row number is less than the length of the data array associated with its column. More...
 
vtkSpreadSheetViewGetView () const
 

Detailed Description

Definition at line 29 of file pqSpreadSheetViewModel.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
SectionInternal 
SectionVisible 

Definition at line 125 of file pqSpreadSheetViewModel.h.

Constructor & Destructor Documentation

◆ pqSpreadSheetViewModel()

pqSpreadSheetViewModel::pqSpreadSheetViewModel ( vtkSMProxy viewProxy,
QObject *  parent = nullptr 
)

◆ ~pqSpreadSheetViewModel()

pqSpreadSheetViewModel::~pqSpreadSheetViewModel ( )
override

Member Function Documentation

◆ rowCount()

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

Returns the number of rows.

◆ columnCount()

int pqSpreadSheetViewModel::columnCount ( const QModelIndex &  parent = QModelIndex()) const
override

Returns the number of columns.

◆ data()

QVariant pqSpreadSheetViewModel::data ( const QModelIndex &  index,
int  role = Qt::DisplayRole 
) const
override

Returns the data storeed under the given role for the item referred by the index.

◆ headerData()

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

Returns the data for the given role and section in the header with the specified orientation.

When orientation is Qt::Horizontal, pqSpreadSheetViewModel adds support for two new roles: pqSpreadSheetViewModel::SectionVisible, and pqSpreadSheetViewModel::SectionInternal. SectionVisible can be used to determine if the column (or horizontal section) is visible or hidden. SectionInternal is used to determine if the section is internal. An internal section is also hidden. When data associated with these two roles changes, the model will fire headerDataChanged signal.

◆ sortSection()

void pqSpreadSheetViewModel::sortSection ( int  section,
Qt::SortOrder  order 
)

Make a server request to sort based on a given column with a given order.

◆ isSortable()

bool pqSpreadSheetViewModel::isSortable ( int  section)

Return true only if the given column is sortable.

◆ getFieldType()

int pqSpreadSheetViewModel::getFieldType ( ) const

Returns the field type for the data currently shown by this model.

◆ getVTKIndices()

QSet<vtkIndex> pqSpreadSheetViewModel::getVTKIndices ( const QModelIndexList &  indexes)

◆ setDecimalPrecision()

void pqSpreadSheetViewModel::setDecimalPrecision ( int  )

Set/Get the decimal precision for float and double type data.

◆ getDecimalPrecision()

int pqSpreadSheetViewModel::getDecimalPrecision ( )

◆ setFixedRepresentation()

void pqSpreadSheetViewModel::setFixedRepresentation ( bool  )

Set/Get whether the decimal representation is fixed or scientific.

True is fixed and False is scientific

◆ getFixedRepresentation()

bool pqSpreadSheetViewModel::getFixedRepresentation ( )

◆ setActiveRegion()

void pqSpreadSheetViewModel::setActiveRegion ( int  row_top,
int  row_bottom 
)

set the region (in row indices) that is currently being shown in the view.

the model will provide data-values only for the active-region. For any other region it will simply return a "..." text for display (in QAbstractTableModel::data(..) callback).

◆ activeRepresentation()

pqDataRepresentation* pqSpreadSheetViewModel::activeRepresentation ( ) const

Returns the active representation.

Active representation is the representation being shown by the view.

◆ activeRepresentationProxy()

vtkSMProxy* pqSpreadSheetViewModel::activeRepresentationProxy ( ) const

◆ flags()

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

Method needed for copy/past cell editor.

◆ setData()

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

◆ GetRowsAsString()

QString pqSpreadSheetViewModel::GetRowsAsString ( ) const

Returns the current rows as a CSV-formatted string, including header with column names.

Uses the vtkCSVExporter.

◆ forceUpdate

void pqSpreadSheetViewModel::forceUpdate ( )
slot

resets the model.

◆ setActiveRepresentation

void pqSpreadSheetViewModel::setActiveRepresentation ( pqDataRepresentation )
slot

Sets the active representation.

Active representation is the representation being shown by the view.

◆ setActiveRepresentationProxy

void pqSpreadSheetViewModel::setActiveRepresentationProxy ( vtkSMProxy )
slot

Sets the active representation.

When using this API instead of setActiveRepresentation(pqDataRepresentation*), some functionality won't be available.

◆ selectionChanged

void pqSpreadSheetViewModel::selectionChanged ( const QItemSelection &  selection)
signal

Fired whenever the server side selection changes.

◆ isDataValid()

bool pqSpreadSheetViewModel::isDataValid ( const QModelIndex &  idx) const
protected

Given an index into the model, check to see that its row number is less than the length of the data array associated with its column.

◆ GetView()

vtkSpreadSheetView* pqSpreadSheetViewModel::GetView ( ) const
protected

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