Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
sf::ListModel Class Reference

#include <ListModel.h>

Inheritance diagram for sf::ListModel:
Collaboration diagram for sf::ListModel:

Classes

class  Columns
 Holds all columns information. More...
 

Public Member Functions

 ListModel (QObject *parent)
 QObject type of constructor. When the parent is a QTreeView or derived type the setTreeView is called upon it.
 
 ~ListModel () override
 Virtual destructor.
 
void setTreeView (QTreeView *treeview)
 Attaches the given tree view and attached a new sf::CommonItemDelegate instance when the default is a QStyledItemDelegate instance.
 
QTreeView * getTreeView ()
 Gets the current attached treeview.
 
ColumnsgetColumns ()
 Gets the instance holding the column information.
 
const ColumnsgetColumns () const
 Gets the constant instance holding the column information.
 
QModelIndex currentIndex () const
 Gets the current focussed list entry.
 
QModelIndex index (int row, int column=0) const
 Creates an index from the given row and column.
 
void setCurrentIndex (const QModelIndex &index)
 Sets the current focussed list entry by the given index.
 
void setCurrentIndex (int row, int column=0)
 Sets the current focussed list entry by the given row and optional column.
 
void setRowCount (int count)
 Sets the row count.
 
void update (const QModelIndex &index, const QList< int > &roles={})
 Update value in the field pointed at by the given index.
 
void update (int row=-1, int column=-1, const QList< int > &roles={})
 Update values in the given column and row.
 
void removeRow (const QModelIndex &index)
 Removes a row indicated by the index from the model.
 
void scrollTo (int row, int column=0)
 Makes the associated tree view scroll to this row.
 
void scrollTo (const QModelIndex &index)
 Makes the associated tree view scroll to this index.
 
void removeRows (int row, int count=1)
 Removes rows from the list.
 
void insertRows (int row, int count)
 Insert rows into the list.
 
void moveRow (int from, int to)
 Relocates a row to another location.
 
void refresh () const
 Makes the list refresh itself with by retrieving new data.
 
Q_SIGNAL void getRowData (const QModelIndex &index, int role, QVariant &value)
 Signal emitted to retrieve data to populate the rows.
 
Q_SIGNAL void setRowData (const QModelIndex &index, int role, const QVariant &value)
 Signal emitted to set on the data source.
 
Q_SIGNAL void contextMenuRequested (const QModelIndex &index, const QPoint &point)
 Signal emitted when a context menu is requested.
 
Q_SIGNAL void currentRowChanged (int current, int previous)
 Signal emitted when the selected row changed.
 

Constructor & Destructor Documentation

◆ ListModel()

sf::ListModel::ListModel ( QObject *  parent)
explicit

QObject type of constructor. When the parent is a QTreeView or derived type the setTreeView is called upon it.

◆ ~ListModel()

sf::ListModel::~ListModel ( )
override

Virtual destructor.

Member Function Documentation

◆ contextMenuRequested()

Q_SIGNAL void sf::ListModel::contextMenuRequested ( const QModelIndex &  index,
const QPoint &  point 
)

Signal emitted when a context menu is requested.

◆ currentIndex()

QModelIndex sf::ListModel::currentIndex ( ) const

Gets the current focussed list entry.

◆ currentRowChanged()

Q_SIGNAL void sf::ListModel::currentRowChanged ( int  current,
int  previous 
)

Signal emitted when the selected row changed.

◆ getColumns() [1/2]

Columns & sf::ListModel::getColumns ( )

Gets the instance holding the column information.

◆ getColumns() [2/2]

const Columns & sf::ListModel::getColumns ( ) const

Gets the constant instance holding the column information.

◆ getRowData()

Q_SIGNAL void sf::ListModel::getRowData ( const QModelIndex &  index,
int  role,
QVariant &  value 
)

Signal emitted to retrieve data to populate the rows.

◆ getTreeView()

QTreeView * sf::ListModel::getTreeView ( )

Gets the current attached treeview.

◆ index()

QModelIndex sf::ListModel::index ( int  row,
int  column = 0 
) const

Creates an index from the given row and column.

◆ insertRows()

void sf::ListModel::insertRows ( int  row,
int  count 
)

Insert rows into the list.

Parameters
rowStart row index.
countAmount of rows which defaults to 1.

◆ moveRow()

void sf::ListModel::moveRow ( int  from,
int  to 
)

Relocates a row to another location.

Parameters
fromFrom index position.
toTo index position.

◆ refresh()

void sf::ListModel::refresh ( ) const

Makes the list refresh itself with by retrieving new data.

◆ removeRow()

void sf::ListModel::removeRow ( const QModelIndex &  index)

Removes a row indicated by the index from the model.

Parameters
indexRow to be removed.

◆ removeRows()

void sf::ListModel::removeRows ( int  row,
int  count = 1 
)

Removes rows from the list.

Parameters
rowStart row index.
countAmount of rows which defaults to 1.

◆ scrollTo() [1/2]

void sf::ListModel::scrollTo ( const QModelIndex &  index)

Makes the associated tree view scroll to this index.

Parameters
index

◆ scrollTo() [2/2]

void sf::ListModel::scrollTo ( int  row,
int  column = 0 
)

Makes the associated tree view scroll to this row.

Parameters
rowTargeted row.
columnTargeted column which default to the first one.

◆ setCurrentIndex() [1/2]

void sf::ListModel::setCurrentIndex ( const QModelIndex &  index)

Sets the current focussed list entry by the given index.

◆ setCurrentIndex() [2/2]

void sf::ListModel::setCurrentIndex ( int  row,
int  column = 0 
)

Sets the current focussed list entry by the given row and optional column.

◆ setRowCount()

void sf::ListModel::setRowCount ( int  count)

Sets the row count.

◆ setRowData()

Q_SIGNAL void sf::ListModel::setRowData ( const QModelIndex &  index,
int  role,
const QVariant &  value 
)

Signal emitted to set on the data source.

◆ setTreeView()

void sf::ListModel::setTreeView ( QTreeView *  treeview)

Attaches the given tree view and attached a new sf::CommonItemDelegate instance when the default is a QStyledItemDelegate instance.

Parameters
treeview

◆ update() [1/2]

void sf::ListModel::update ( const QModelIndex &  index,
const QList< int > &  roles = {} 
)

Update value in the field pointed at by the given index.

Parameters
indexIndex value of the list.
rolesRoles to update. Default is all.

◆ update() [2/2]

void sf::ListModel::update ( int  row = -1,
int  column = -1,
const QList< int > &  roles = {} 
)

Update values in the given column and row.

Parameters
rowWhen -1 all rows are updated.
columnWhen -1 all columns are updated.
rolesRoles to update. Default is all.

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