mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-30 21:56:39 +00:00 
			
		
		
		
	Undo now working via signals.
This commit is contained in:
		
							parent
							
								
									1a31aecc2f
								
							
						
					
					
						commit
						e7bd298739
					
				
					 11 changed files with 169 additions and 75 deletions
				
			
		|  | @ -18,7 +18,8 @@ opencs_hdrs_noqt (model/doc | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| opencs_units (model/world | opencs_units (model/world | ||||||
|     idtable idtableproxymodel regionmap data commanddispatcher idtablebase resourcetable nestedtableproxymodel idtree |     idtable idtableproxymodel regionmap data commanddispatcher idtablebase resourcetable | ||||||
|  |     nestedtableproxymodel idtree pathgridcommands | ||||||
|     ) |     ) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -6,7 +6,6 @@ | ||||||
| #include "idtree.hpp" | #include "idtree.hpp" | ||||||
| #include <components/misc/stringops.hpp> | #include <components/misc/stringops.hpp> | ||||||
| #include "nestedtablewrapper.hpp" | #include "nestedtablewrapper.hpp" | ||||||
| #include "../../view/render/cell.hpp" |  | ||||||
| 
 | 
 | ||||||
| CSMWorld::ModifyCommand::ModifyCommand (QAbstractItemModel& model, const QModelIndex& index, | CSMWorld::ModifyCommand::ModifyCommand (QAbstractItemModel& model, const QModelIndex& index, | ||||||
|                                         const QVariant& new_, QUndoCommand* parent) |                                         const QVariant& new_, QUndoCommand* parent) | ||||||
|  | @ -245,31 +244,3 @@ const CSMWorld::NestedTableWrapperBase& CSMWorld::NestedTableStoring::getOld() c | ||||||
| { | { | ||||||
|     return *mOld; |     return *mOld; | ||||||
| } | } | ||||||
| 
 |  | ||||||
| // Current interface does not allow adding a non-blank row, so we're forced to modify
 |  | ||||||
| // the whole record.
 |  | ||||||
| CSMWorld::ModifyPathgridCommand::ModifyPathgridCommand(IdTree& model, |  | ||||||
|     const std::string& id, int parentColumn, CSVRender::Cell *cell, |  | ||||||
|     NestedTableWrapperBase* newRecord, QUndoCommand* parent) |  | ||||||
|     : mModel(model), mId(id), mParentColumn(parentColumn), mRecord(newRecord), mCell(cell) |  | ||||||
|     , QUndoCommand(parent), NestedTableStoring(model, id, parentColumn) |  | ||||||
| { |  | ||||||
|     setText (("Modify Pathgrid record " + mId).c_str()); // FIXME: better description
 |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void CSMWorld::ModifyPathgridCommand::redo() |  | ||||||
| { |  | ||||||
|     const QModelIndex& parentIndex = mModel.getModelIndex(mId, mParentColumn); |  | ||||||
| 
 |  | ||||||
|     mModel.setNestedTable(parentIndex, *mRecord); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void CSMWorld::ModifyPathgridCommand::undo() |  | ||||||
| { |  | ||||||
|     const QModelIndex& parentIndex = mModel.getModelIndex(mId, mParentColumn); |  | ||||||
| 
 |  | ||||||
|     mModel.setNestedTable(parentIndex, getOld()); |  | ||||||
| 
 |  | ||||||
|     mCell->clearPathgrid(); |  | ||||||
|     mCell->buildPathgrid(); |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  | @ -12,16 +12,11 @@ | ||||||
| #include <QModelIndex> | #include <QModelIndex> | ||||||
| 
 | 
 | ||||||
| #include "universalid.hpp" | #include "universalid.hpp" | ||||||
| #include "nestedtablewrapper.hpp" | //#include "nestedtablewrapper.hpp"
 | ||||||
| 
 | 
 | ||||||
| class QModelIndex; | class QModelIndex; | ||||||
| class QAbstractItemModel; | class QAbstractItemModel; | ||||||
| 
 | 
 | ||||||
| namespace CSVRender |  | ||||||
| { |  | ||||||
|     class Cell; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| namespace CSMWorld | namespace CSMWorld | ||||||
| { | { | ||||||
|     class IdTable; |     class IdTable; | ||||||
|  | @ -200,28 +195,6 @@ namespace CSMWorld | ||||||
| 
 | 
 | ||||||
|             virtual void undo(); |             virtual void undo(); | ||||||
|     }; |     }; | ||||||
| 
 |  | ||||||
|     class ModifyPathgridCommand : public QUndoCommand, private NestedTableStoring |  | ||||||
|     { |  | ||||||
|             IdTree& mModel; |  | ||||||
|             std::string mId; |  | ||||||
| 
 |  | ||||||
|             int mParentColumn; |  | ||||||
| 
 |  | ||||||
|             NestedTableWrapperBase* mRecord; |  | ||||||
|             CSVRender::Cell *mCell; |  | ||||||
| 
 |  | ||||||
|         public: |  | ||||||
| 
 |  | ||||||
|             // if newEdges is NULL, only the paths are updated
 |  | ||||||
|             ModifyPathgridCommand(IdTree& model, |  | ||||||
|                     const std::string& id, int parentColumn, CSVRender::Cell *cell, |  | ||||||
|                     NestedTableWrapperBase* newRecord, QUndoCommand* parent = 0); |  | ||||||
| 
 |  | ||||||
|             virtual void redo(); |  | ||||||
| 
 |  | ||||||
|             virtual void undo(); |  | ||||||
|     }; |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
							
								
								
									
										48
									
								
								apps/opencs/model/world/pathgridcommands.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								apps/opencs/model/world/pathgridcommands.cpp
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,48 @@ | ||||||
|  | #include "pathgridcommands.hpp" | ||||||
|  | 
 | ||||||
|  | #include "../../view/render/cell.hpp" | ||||||
|  | #include "idtree.hpp" | ||||||
|  | #include "nestedtablewrapper.hpp" | ||||||
|  | 
 | ||||||
|  | // Current interface does not allow adding a non-blank row, so we're forced to modify
 | ||||||
|  | // the whole record.
 | ||||||
|  | CSMWorld::ModifyPathgridCommand::ModifyPathgridCommand(IdTree& model, | ||||||
|  |     const std::string& id, int parentColumn, NestedTableWrapperBase* newRecord, QUndoCommand* parent) | ||||||
|  |     : mModel(model), mId(id), mParentColumn(parentColumn), mRecord(newRecord) | ||||||
|  |     , QUndoCommand(parent), NestedTableStoring(model, id, parentColumn) | ||||||
|  | { | ||||||
|  |     setText (("Modify Pathgrid record " + mId).c_str()); // FIXME: better description
 | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void CSMWorld::ModifyPathgridCommand::redo() | ||||||
|  | { | ||||||
|  |     const QModelIndex& parentIndex = mModel.getModelIndex(mId, mParentColumn); | ||||||
|  | 
 | ||||||
|  |     mModel.setNestedTable(parentIndex, *mRecord); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void CSMWorld::ModifyPathgridCommand::undo() | ||||||
|  | { | ||||||
|  |     const QModelIndex& parentIndex = mModel.getModelIndex(mId, mParentColumn); | ||||||
|  | 
 | ||||||
|  |     mModel.setNestedTable(parentIndex, getOld()); | ||||||
|  | 
 | ||||||
|  |     emit undoActioned(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void CSMWorld::SignalHandler::rebuildPathgrid() | ||||||
|  | { | ||||||
|  |     mParent->clearPathgrid(); | ||||||
|  |     mParent->buildPathgrid(); | ||||||
|  | 
 | ||||||
|  |     emit flagAsModified(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | CSMWorld::SignalHandler::SignalHandler (CSVRender::Cell *parent) : mParent(parent) | ||||||
|  | {} | ||||||
|  | 
 | ||||||
|  | void CSMWorld::SignalHandler::connectToCommand(const CSMWorld::ModifyPathgridCommand *command) | ||||||
|  | { | ||||||
|  |     connect (command, SIGNAL(undoActioned()), | ||||||
|  |             this, SLOT(rebuildPathgrid())); | ||||||
|  | } | ||||||
							
								
								
									
										65
									
								
								apps/opencs/model/world/pathgridcommands.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										65
									
								
								apps/opencs/model/world/pathgridcommands.hpp
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,65 @@ | ||||||
|  | #ifndef CSM_WOLRD_PATHGRIDCOMMANDS_H | ||||||
|  | #define CSM_WOLRD_PATHGRIDCOMMANDS_H | ||||||
|  | 
 | ||||||
|  | #include <QObject> | ||||||
|  | 
 | ||||||
|  | #include "commands.hpp" | ||||||
|  | 
 | ||||||
|  | namespace CSVRender | ||||||
|  | { | ||||||
|  |     class Cell; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | namespace CSMWorld | ||||||
|  | { | ||||||
|  |     class IdTree; | ||||||
|  |     class NestedTableWrapperBase; | ||||||
|  | 
 | ||||||
|  |     class ModifyPathgridCommand : public QObject, public QUndoCommand, private NestedTableStoring | ||||||
|  |     { | ||||||
|  |         Q_OBJECT | ||||||
|  | 
 | ||||||
|  |             IdTree& mModel; | ||||||
|  |             std::string mId; | ||||||
|  | 
 | ||||||
|  |             int mParentColumn; | ||||||
|  | 
 | ||||||
|  |             NestedTableWrapperBase* mRecord; | ||||||
|  | 
 | ||||||
|  |         public: | ||||||
|  | 
 | ||||||
|  |             ModifyPathgridCommand(IdTree& model, | ||||||
|  |                     const std::string& id, int parentColumn, NestedTableWrapperBase* newRecord, | ||||||
|  |                     QUndoCommand* parent = 0); | ||||||
|  | 
 | ||||||
|  |             virtual void redo(); | ||||||
|  | 
 | ||||||
|  |             virtual void undo(); | ||||||
|  | 
 | ||||||
|  |         signals: | ||||||
|  | 
 | ||||||
|  |             void undoActioned(); | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |     class SignalHandler : public QObject | ||||||
|  |     { | ||||||
|  |         Q_OBJECT | ||||||
|  | 
 | ||||||
|  |             CSVRender::Cell *mParent; | ||||||
|  | 
 | ||||||
|  |         public: | ||||||
|  | 
 | ||||||
|  |             SignalHandler (CSVRender::Cell *parent); | ||||||
|  | 
 | ||||||
|  |             void connectToCommand(const ModifyPathgridCommand *command); | ||||||
|  | 
 | ||||||
|  |         private slots: | ||||||
|  | 
 | ||||||
|  |             void rebuildPathgrid(); | ||||||
|  | 
 | ||||||
|  |         signals: | ||||||
|  | 
 | ||||||
|  |             void flagAsModified(); | ||||||
|  |     }; | ||||||
|  | } | ||||||
|  | #endif // CSM_WOLRD_PATHGRIDCOMMANDS_H
 | ||||||
|  | @ -16,6 +16,7 @@ | ||||||
| #include "../../model/world/refcollection.hpp" | #include "../../model/world/refcollection.hpp" | ||||||
| #include "../../model/world/pathgrid.hpp" | #include "../../model/world/pathgrid.hpp" | ||||||
| #include "../../model/world/commands.hpp" | #include "../../model/world/commands.hpp" | ||||||
|  | #include "../../model/world/pathgridcommands.hpp" | ||||||
| #include "../../model/world/pathgridpointswrap.hpp" | #include "../../model/world/pathgridpointswrap.hpp" | ||||||
| #include "../../model/world/nestedtableproxymodel.hpp" | #include "../../model/world/nestedtableproxymodel.hpp" | ||||||
| #include "../world/physicssystem.hpp" | #include "../world/physicssystem.hpp" | ||||||
|  | @ -119,8 +120,9 @@ bool CSVRender::Cell::addObjects (int start, int end) | ||||||
| 
 | 
 | ||||||
| CSVRender::Cell::Cell (CSMDoc::Document& document, Ogre::SceneManager *sceneManager, | CSVRender::Cell::Cell (CSMDoc::Document& document, Ogre::SceneManager *sceneManager, | ||||||
|     const std::string& id, boost::shared_ptr<CSVWorld::PhysicsSystem> physics, const Ogre::Vector3& origin) |     const std::string& id, boost::shared_ptr<CSVWorld::PhysicsSystem> physics, const Ogre::Vector3& origin) | ||||||
| : mDocument (document), mId (Misc::StringUtils::lowerCase (id)), mSceneMgr(sceneManager) |     : mDocument (document), mId (Misc::StringUtils::lowerCase (id)), mSceneMgr(sceneManager) | ||||||
| , mPhysics(physics), mX(0), mY(0), mPgIndex(-1), mModel(0), mProxyModel(0) |     , mPhysics(physics), mX(0), mY(0), mPgIndex(-1), mModel(0), mProxyModel(0) | ||||||
|  |     , mHandler(new CSMWorld::SignalHandler(this)) | ||||||
| { | { | ||||||
|     mCellNode = sceneManager->getRootSceneNode()->createChildSceneNode(); |     mCellNode = sceneManager->getRootSceneNode()->createChildSceneNode(); | ||||||
|     mCellNode->setPosition (origin); |     mCellNode->setPosition (origin); | ||||||
|  | @ -163,6 +165,7 @@ CSVRender::Cell::~Cell() | ||||||
|     destroyGridMaterials(); |     destroyGridMaterials(); | ||||||
| 
 | 
 | ||||||
|     delete mProxyModel; |     delete mProxyModel; | ||||||
|  |     delete mHandler; | ||||||
| 
 | 
 | ||||||
|     if (mTerrain.get()) |     if (mTerrain.get()) | ||||||
|         mPhysics->removeHeightField(mSceneMgr, mX, mY); |         mPhysics->removeHeightField(mSceneMgr, mX, mY); | ||||||
|  | @ -431,10 +434,12 @@ void CSVRender::Cell::pathgridPointAdded(const Ogre::Vector3 &pos, bool interior | ||||||
| 
 | 
 | ||||||
|     pathgrid.mData.mS2 += 1; // increment the number of points
 |     pathgrid.mData.mS2 += 1; // increment the number of points
 | ||||||
| 
 | 
 | ||||||
|     // FIXME: probably will crash if this cell is deleted and undo() is actioned afterwards
 |     // FIXME: possible issue if this cell is deleted and undo() is actioned afterwards
 | ||||||
|     mDocument.getUndoStack().push(new CSMWorld::ModifyPathgridCommand(*mModel, |     CSMWorld::ModifyPathgridCommand *cmd = new CSMWorld::ModifyPathgridCommand(*mModel, | ||||||
|             mProxyModel->getParentId(), mProxyModel->getParentColumn(), this, |             mProxyModel->getParentId(), mProxyModel->getParentColumn(), | ||||||
|             new CSMWorld::PathgridPointsWrap(pathgrid))); |             new CSMWorld::PathgridPointsWrap(pathgrid)); | ||||||
|  |     mHandler->connectToCommand(cmd); | ||||||
|  |     mDocument.getUndoStack().push(cmd); | ||||||
|     // emit signal here?
 |     // emit signal here?
 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -488,10 +493,12 @@ void CSVRender::Cell::pathgridPointRemoved(const std::string &name) | ||||||
|             << pathgridId + "_" + QString::number(index).toStdString() << std::endl; |             << pathgridId + "_" + QString::number(index).toStdString() << std::endl; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     // FIXME: probably will crash if this cell is deleted and undo() is actioned afterwards
 |     // FIXME: possible issue if this cell is deleted and undo() is actioned afterwards
 | ||||||
|     mDocument.getUndoStack().push(new CSMWorld::ModifyPathgridCommand(*mModel, |     CSMWorld::ModifyPathgridCommand *cmd = new CSMWorld::ModifyPathgridCommand(*mModel, | ||||||
|             mProxyModel->getParentId(), mProxyModel->getParentColumn(), this, |             mProxyModel->getParentId(), mProxyModel->getParentColumn(), | ||||||
|             new CSMWorld::PathgridPointsWrap(pathgrid))); |             new CSMWorld::PathgridPointsWrap(pathgrid)); | ||||||
|  |     mHandler->connectToCommand(cmd); | ||||||
|  |     mDocument.getUndoStack().push(cmd); | ||||||
| 
 | 
 | ||||||
|     clearPathgrid(); |     clearPathgrid(); | ||||||
|     buildPathgrid(); |     buildPathgrid(); | ||||||
|  | @ -529,10 +536,12 @@ void CSVRender::Cell::pathgridPointMoved(const std::string &name, | ||||||
|     pathgrid.mPoints[index].mY = y; |     pathgrid.mPoints[index].mY = y; | ||||||
|     pathgrid.mPoints[index].mZ = newPos.z; |     pathgrid.mPoints[index].mZ = newPos.z; | ||||||
| 
 | 
 | ||||||
|     // FIXME: probably will crash if this cell is deleted and undo() is actioned afterwards
 |     // FIXME: possible issue if this cell is deleted and undo() is actioned afterwards
 | ||||||
|     mDocument.getUndoStack().push(new CSMWorld::ModifyPathgridCommand(*mModel, |     CSMWorld::ModifyPathgridCommand *cmd = new CSMWorld::ModifyPathgridCommand(*mModel, | ||||||
|             mProxyModel->getParentId(), mProxyModel->getParentColumn(), this, |             mProxyModel->getParentId(), mProxyModel->getParentColumn(), | ||||||
|             new CSMWorld::PathgridPointsWrap(pathgrid))); |             new CSMWorld::PathgridPointsWrap(pathgrid)); | ||||||
|  |     mHandler->connectToCommand(cmd); | ||||||
|  |     mDocument.getUndoStack().push(cmd); | ||||||
| 
 | 
 | ||||||
|     clearPathgrid(); |     clearPathgrid(); | ||||||
|     buildPathgrid(); |     buildPathgrid(); | ||||||
|  | @ -551,3 +560,8 @@ void CSVRender::Cell::addPathgridEdge() | ||||||
| void CSVRender::Cell::removePathgridEdge() | void CSVRender::Cell::removePathgridEdge() | ||||||
| { | { | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | CSMWorld::SignalHandler *CSVRender::Cell::getSignalHandler() | ||||||
|  | { | ||||||
|  |     return mHandler; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -31,10 +31,10 @@ namespace CSMDoc | ||||||
| 
 | 
 | ||||||
| namespace CSMWorld | namespace CSMWorld | ||||||
| { | { | ||||||
|     //class Data;
 |  | ||||||
|     class Pathgrid; |     class Pathgrid; | ||||||
|     class NestedTableProxyModel; |     class NestedTableProxyModel; | ||||||
|     class IdTree; |     class IdTree; | ||||||
|  |     class SignalHandler; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| namespace CSVWorld | namespace CSVWorld | ||||||
|  | @ -58,6 +58,7 @@ namespace CSVRender | ||||||
|             CSMWorld::NestedTableProxyModel *mProxyModel; |             CSMWorld::NestedTableProxyModel *mProxyModel; | ||||||
|             CSMWorld::IdTree *mModel; |             CSMWorld::IdTree *mModel; | ||||||
|             int mPgIndex; |             int mPgIndex; | ||||||
|  |             CSMWorld::SignalHandler *mHandler; | ||||||
| 
 | 
 | ||||||
|             std::auto_ptr<Terrain::TerrainGrid> mTerrain; |             std::auto_ptr<Terrain::TerrainGrid> mTerrain; | ||||||
|             boost::shared_ptr<CSVWorld::PhysicsSystem> mPhysics; |             boost::shared_ptr<CSVWorld::PhysicsSystem> mPhysics; | ||||||
|  | @ -126,6 +127,7 @@ namespace CSVRender | ||||||
| 
 | 
 | ||||||
|             void clearPathgrid(); |             void clearPathgrid(); | ||||||
|             void buildPathgrid(); |             void buildPathgrid(); | ||||||
|  |             CSMWorld::SignalHandler *getSignalHandler(); | ||||||
|     }; |     }; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -19,6 +19,7 @@ | ||||||
| 
 | 
 | ||||||
| #include "../../model/world/tablemimedata.hpp" | #include "../../model/world/tablemimedata.hpp" | ||||||
| #include "../../model/world/idtable.hpp" | #include "../../model/world/idtable.hpp" | ||||||
|  | #include "../../model/world/pathgridcommands.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../widget/scenetooltoggle.hpp" | #include "../widget/scenetooltoggle.hpp" | ||||||
| #include "../widget/scenetoolmode.hpp" | #include "../widget/scenetoolmode.hpp" | ||||||
|  | @ -115,6 +116,7 @@ bool CSVRender::PagedWorldspaceWidget::adjustCells() | ||||||
|         { |         { | ||||||
|             Cell *cell = new Cell (mDocument, getSceneManager(), |             Cell *cell = new Cell (mDocument, getSceneManager(), | ||||||
|                     iter->getId (mWorldspace), mDocument.getPhysics()); |                     iter->getId (mWorldspace), mDocument.getPhysics()); | ||||||
|  |             connect (cell->getSignalHandler(), SIGNAL(flagAsModified()), this, SLOT(flagAsModSlot())); | ||||||
|             mCells.insert (std::make_pair (*iter, cell)); |             mCells.insert (std::make_pair (*iter, cell)); | ||||||
| 
 | 
 | ||||||
|             float height = cell->getTerrainHeightAt(Ogre::Vector3( |             float height = cell->getTerrainHeightAt(Ogre::Vector3( | ||||||
|  | @ -637,3 +639,8 @@ void CSVRender::PagedWorldspaceWidget::cellAdded (const QModelIndex& index, int | ||||||
|     if (adjustCells()) |     if (adjustCells()) | ||||||
|         flagAsModified(); |         flagAsModified(); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | void CSVRender::PagedWorldspaceWidget::flagAsModSlot () | ||||||
|  | { | ||||||
|  |     flagAsModified(); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -120,6 +120,7 @@ namespace CSVRender | ||||||
| 
 | 
 | ||||||
|             virtual void cellAdded (const QModelIndex& index, int start, int end); |             virtual void cellAdded (const QModelIndex& index, int start, int end); | ||||||
| 
 | 
 | ||||||
|  |             virtual void flagAsModSlot(); | ||||||
|     }; |     }; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -13,6 +13,7 @@ | ||||||
| #include "../../model/world/data.hpp" | #include "../../model/world/data.hpp" | ||||||
| #include "../../model/world/idtable.hpp" | #include "../../model/world/idtable.hpp" | ||||||
| #include "../../model/world/tablemimedata.hpp" | #include "../../model/world/tablemimedata.hpp" | ||||||
|  | #include "../../model/world/pathgridcommands.hpp" | ||||||
| 
 | 
 | ||||||
| #include "../widget/scenetooltoggle.hpp" | #include "../widget/scenetooltoggle.hpp" | ||||||
| #include "../widget/scenetooltoggle2.hpp" | #include "../widget/scenetooltoggle2.hpp" | ||||||
|  | @ -49,7 +50,9 @@ CSVRender::UnpagedWorldspaceWidget::UnpagedWorldspaceWidget (const std::string& | ||||||
| 
 | 
 | ||||||
|     update(); |     update(); | ||||||
| 
 | 
 | ||||||
|     mCell.reset (new Cell (document, getSceneManager(), mCellId, document.getPhysics())); |     Cell *cell = new Cell (document, getSceneManager(), mCellId, document.getPhysics()); | ||||||
|  |     connect (cell->getSignalHandler(), SIGNAL(flagAsModified()), this, SLOT(flagAsModSlot())); | ||||||
|  |     mCell.reset (cell); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void CSVRender::UnpagedWorldspaceWidget::cellDataChanged (const QModelIndex& topLeft, | void CSVRender::UnpagedWorldspaceWidget::cellDataChanged (const QModelIndex& topLeft, | ||||||
|  | @ -91,7 +94,9 @@ bool CSVRender::UnpagedWorldspaceWidget::handleDrop (const std::vector<CSMWorld: | ||||||
|         return false; |         return false; | ||||||
| 
 | 
 | ||||||
|     mCellId = data.begin()->getId(); |     mCellId = data.begin()->getId(); | ||||||
|     mCell.reset (new Cell (getDocument(), getSceneManager(), mCellId, getDocument().getPhysics())); |     Cell *cell = new Cell (getDocument(), getSceneManager(), mCellId, getDocument().getPhysics()); | ||||||
|  |     connect (cell->getSignalHandler(), SIGNAL(flagAsModified()), this, SLOT(flagAsModSlot())); | ||||||
|  |     mCell.reset (cell); | ||||||
| 
 | 
 | ||||||
|     update(); |     update(); | ||||||
|     emit cellChanged(*data.begin()); |     emit cellChanged(*data.begin()); | ||||||
|  | @ -212,3 +217,8 @@ CSVRender::WorldspaceWidget::dropRequirments CSVRender::UnpagedWorldspaceWidget: | ||||||
|             return ignored; |             return ignored; | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | void CSVRender::UnpagedWorldspaceWidget::flagAsModSlot () | ||||||
|  | { | ||||||
|  |     flagAsModified(); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -76,6 +76,8 @@ namespace CSVRender | ||||||
| 
 | 
 | ||||||
|             void cellRowsAboutToBeRemoved (const QModelIndex& parent, int start, int end); |             void cellRowsAboutToBeRemoved (const QModelIndex& parent, int start, int end); | ||||||
| 
 | 
 | ||||||
|  |             virtual void flagAsModSlot(); | ||||||
|  | 
 | ||||||
|         signals: |         signals: | ||||||
| 
 | 
 | ||||||
|             void cellChanged(const CSMWorld::UniversalId& id); |             void cellChanged(const CSMWorld::UniversalId& id); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue