QElectroTech  0.8-dev
Public Member Functions | Private Attributes | List of all members
ModelIndexCommand Class Reference

The ModelIndexCommand class Change a data of an index of QAbstractItemModel. More...

#include <itemmodelcommand.h>

Inherits QUndoCommand.

Collaboration diagram for ModelIndexCommand:
Collaboration graph

Public Member Functions

 ModelIndexCommand (QAbstractItemModel *model, const QModelIndex &index, QUndoCommand *parent=nullptr)
 ModelIndexCommand::ModelIndexCommand. More...
 
void setData (const QVariant &value, int role=Qt::DisplayRole)
 ModelIndexCommand::setData. More...
 
virtual void redo () override
 ModelIndexCommand::redo Reimplemented from QUndoCommand. More...
 
virtual void undo () override
 ModelIndexCommand::undo Reimplemented from QUndoCommand. More...
 

Private Attributes

QPointer< QAbstractItemModel > m_model
 
QModelIndex m_index
 
QVariant m_old_value
 
QVariant m_new_value
 
int m_role =0
 

Detailed Description

The ModelIndexCommand class Change a data of an index of QAbstractItemModel.

Constructor & Destructor Documentation

◆ ModelIndexCommand()

ModelIndexCommand::ModelIndexCommand ( QAbstractItemModel *  model,
const QModelIndex &  index,
QUndoCommand *  parent = nullptr 
)

ModelIndexCommand::ModelIndexCommand.

Parameters
model
index
parent

Member Function Documentation

◆ redo()

void ModelIndexCommand::redo ( )
overridevirtual

ModelIndexCommand::redo Reimplemented from QUndoCommand.

◆ setData()

void ModelIndexCommand::setData ( const QVariant &  value,
int  role = Qt::DisplayRole 
)

ModelIndexCommand::setData.

Parameters
value
role

◆ undo()

void ModelIndexCommand::undo ( )
overridevirtual

ModelIndexCommand::undo Reimplemented from QUndoCommand.

Member Data Documentation

◆ m_index

QModelIndex ModelIndexCommand::m_index
private

◆ m_model

QPointer<QAbstractItemModel> ModelIndexCommand::m_model
private

◆ m_new_value

QVariant ModelIndexCommand::m_new_value
private

◆ m_old_value

QVariant ModelIndexCommand::m_old_value
private

◆ m_role

int ModelIndexCommand::m_role =0
private

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