forked from teamnwah/openmw-tes3coop
changed CreateCommand to work directly on the model instead of the proxy
This commit is contained in:
parent
f93af52486
commit
2d46a1db2f
4 changed files with 5 additions and 12 deletions
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <QAbstractItemModel>
|
||||
|
||||
#include "idtableproxymodel.hpp"
|
||||
#include "idtable.hpp"
|
||||
#include "idtable.hpp"
|
||||
|
||||
CSMWorld::ModifyCommand::ModifyCommand (QAbstractItemModel& model, const QModelIndex& index,
|
||||
|
@ -25,7 +25,7 @@ void CSMWorld::ModifyCommand::undo()
|
|||
mModel.setData (mIndex, mOld);
|
||||
}
|
||||
|
||||
CSMWorld::CreateCommand::CreateCommand (IdTableProxyModel& model, const std::string& id, QUndoCommand *parent)
|
||||
CSMWorld::CreateCommand::CreateCommand (IdTable& model, const std::string& id, QUndoCommand *parent)
|
||||
: QUndoCommand (parent), mModel (model), mId (id)
|
||||
{
|
||||
setText (("Create record " + id).c_str());
|
||||
|
|
|
@ -14,7 +14,7 @@ class QAbstractItemModel;
|
|||
|
||||
namespace CSMWorld
|
||||
{
|
||||
class IdTableProxyModel;
|
||||
class IdTable;
|
||||
class IdTable;
|
||||
class RecordBase;
|
||||
|
||||
|
@ -37,12 +37,12 @@ namespace CSMWorld
|
|||
|
||||
class CreateCommand : public QUndoCommand
|
||||
{
|
||||
IdTableProxyModel& mModel;
|
||||
IdTable& mModel;
|
||||
std::string mId;
|
||||
|
||||
public:
|
||||
|
||||
CreateCommand (IdTableProxyModel& model, const std::string& id, QUndoCommand *parent = 0);
|
||||
CreateCommand (IdTable& model, const std::string& id, QUndoCommand *parent = 0);
|
||||
|
||||
virtual void redo();
|
||||
|
||||
|
|
|
@ -7,11 +7,6 @@ CSMWorld::IdTableProxyModel::IdTableProxyModel (QObject *parent)
|
|||
: QSortFilterProxyModel (parent)
|
||||
{}
|
||||
|
||||
void CSMWorld::IdTableProxyModel::addRecord (const std::string& id)
|
||||
{
|
||||
dynamic_cast<IdTable&> (*sourceModel()).addRecord (id);
|
||||
}
|
||||
|
||||
QModelIndex CSMWorld::IdTableProxyModel::getModelIndex (const std::string& id, int column) const
|
||||
{
|
||||
return mapFromSource (dynamic_cast<IdTable&> (*sourceModel()).getModelIndex (id, column));
|
||||
|
|
|
@ -15,8 +15,6 @@ namespace CSMWorld
|
|||
|
||||
IdTableProxyModel (QObject *parent = 0);
|
||||
|
||||
virtual void addRecord (const std::string& id);
|
||||
|
||||
virtual QModelIndex getModelIndex (const std::string& id, int column) const;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue