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 but detaching the old one first.
 
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 entryby 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, 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 (const QModelIndex &index)
 
void removeRows (int row, int count=1)
 
void insertRows (int row, int count)
 
void refresh () const
 
void moveRow (int from, int to)
 
Q_SIGNAL void getRowData (const QModelIndex &index, int role, QVariant &data)
 Signal emitted to retrieve data to populate the rows.
 
Q_SIGNAL void setRowData (const QModelIndex &index, int role, const QVariant &data)
 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 &  data 
)

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 
)

◆ moveRow()

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

◆ refresh()

void sf::ListModel::refresh ( ) const

◆ 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 
)

◆ scrollTo()

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

◆ setCurrentIndex() [1/2]

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

Sets the current focussed list entryby 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 &  data 
)

Signal emitted to set on the data source.

◆ setTreeView()

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

Attaches the given tree view but detaching the old one first.

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,
int  column = -1,
const QList< int > &  roles = {} 
)

Update values in the given column and row.

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

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