18#ifndef ITEMMODELCOMMAND_H
19#define ITEMMODELCOMMAND_H
21#include <QUndoCommand>
25class QAbstractItemModel;
34 ModelIndexCommand(QAbstractItemModel *model,
const QModelIndex &index, QUndoCommand *parent =
nullptr);
35 void setData(
const QVariant &value,
int role = Qt::DisplayRole);
37 virtual void redo()
override;
38 virtual void undo()
override;
56 void setData(
int section, Qt::Orientation orientation,
const QVariant &value,
int role = Qt::DisplayRole);
58 virtual void redo()
override;
59 virtual void undo()
override;
The ModelHeaderDataCommand class Change the data of a header.
Definition itemmodelcommand.h:53
virtual void undo() override
ModelHeaderDataCommand::undo Reimplemented from QUndoCommand.
Definition itemmodelcommand.cpp:117
virtual void redo() override
ModelHeaderDataCommand::redo Reimplemented from QUndoCommand.
Definition itemmodelcommand.cpp:106
QPointer< QAbstractItemModel > m_model
Definition itemmodelcommand.h:62
int m_section
Definition itemmodelcommand.h:66
QVariant m_old_value
Definition itemmodelcommand.h:64
Qt::Orientation m_orientation
Definition itemmodelcommand.h:63
QVariant m_new_value
Definition itemmodelcommand.h:65
int m_role
Definition itemmodelcommand.h:67
void setData(int section, Qt::Orientation orientation, const QVariant &value, int role=Qt::DisplayRole)
ModelHeaderDataCommand::setData See QAbstractItemModel::setHeaderData.
Definition itemmodelcommand.cpp:89
The ModelIndexCommand class Change a data of an index of QAbstractItemModel.
Definition itemmodelcommand.h:32
int m_role
Definition itemmodelcommand.h:45
QModelIndex m_index
Definition itemmodelcommand.h:42
void setData(const QVariant &value, int role=Qt::DisplayRole)
ModelIndexCommand::setData.
Definition itemmodelcommand.cpp:37
QPointer< QAbstractItemModel > m_model
Definition itemmodelcommand.h:41
QVariant m_old_value
Definition itemmodelcommand.h:43
virtual void undo() override
ModelIndexCommand::undo Reimplemented from QUndoCommand.
Definition itemmodelcommand.cpp:64
QVariant m_new_value
Definition itemmodelcommand.h:44
virtual void redo() override
ModelIndexCommand::redo Reimplemented from QUndoCommand.
Definition itemmodelcommand.cpp:53