mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-27 21:35:24 +00:00
716eebe616
Fix terrain selection crash See merge request OpenMW/openmw!1165 (cherry picked from commit ec4e3b04a7b394acaaa8319b89ce1237e9d4d6e6) b84e41bd Avoid storing ref, dynamic cast worldspacewidget for safety d62ddc00 Use QPointer to detect object existence, less verbose debug messages cb42b528 Remove friend, make getEditMode public to allow editmode testing. 4b148180 Restucture code 08f7c73e Fix text
43 lines
1.2 KiB
C++
43 lines
1.2 KiB
C++
#ifndef CSV_RENDER_COMMANDS_HPP
|
|
#define CSV_RENDER_COMMANDS_HPP
|
|
|
|
#include <QPointer>
|
|
|
|
#include <QUndoCommand>
|
|
|
|
#include "worldspacewidget.hpp"
|
|
|
|
namespace CSVRender
|
|
{
|
|
class TerrainSelection;
|
|
|
|
/*
|
|
Current solution to force a redrawing of the terrain-selection grid
|
|
when undoing/redoing changes in the editor.
|
|
This only triggers a simple redraw of the grid, so only use it in
|
|
conjunction with actual data changes which deform the grid.
|
|
|
|
Please note that this command needs to be put onto the QUndoStack twice:
|
|
at the start and at the end of the related terrain manipulation.
|
|
This makes sure that the grid is always updated after all changes have
|
|
been undone or redone -- but it also means that the selection is redrawn
|
|
once at the beginning of either action. Future refinement may solve that.
|
|
*/
|
|
class DrawTerrainSelectionCommand : public QUndoCommand
|
|
{
|
|
|
|
private:
|
|
QPointer<WorldspaceWidget> mWorldspaceWidget;
|
|
|
|
public:
|
|
DrawTerrainSelectionCommand(WorldspaceWidget* worldspaceWidget, QUndoCommand* parent = nullptr);
|
|
|
|
void redo() override;
|
|
void undo() override;
|
|
|
|
void tryUpdate();
|
|
};
|
|
}
|
|
|
|
#endif
|