Changed: #1302 Fixed undo/redo in world editor qt.

This commit is contained in:
dnk-88 2011-10-11 13:44:53 +03:00
parent 5c8ca221b9
commit 02e9bc2cc1
6 changed files with 11 additions and 7 deletions

View file

@ -32,6 +32,10 @@ const int PRIMITIVE_IS_MODIFIED = USER_TYPE + 5;
const int PRIMITIVE_FILE_IS_CREATED = USER_TYPE + 6; const int PRIMITIVE_FILE_IS_CREATED = USER_TYPE + 6;
const int PRIMITIVE_IS_VISIBLE = USER_TYPE + 7; const int PRIMITIVE_IS_VISIBLE = USER_TYPE + 7;
//properties editor
const char *const DIFFERENT_VALUE_STRING = "<different values>";
const char *const DIFFERENT_VALUE_MULTI_STRING = "<diff>";
//settings //settings
const char *const WORLD_EDITOR_SECTION = "WorldEditor"; const char *const WORLD_EDITOR_SECTION = "WorldEditor";
const char *const WORLD_WINDOW_STATE = "WorldWindowState"; const char *const WORLD_WINDOW_STATE = "WorldWindowState";

View file

@ -171,7 +171,7 @@ bool loadWorldEditFile(const std::string &fileName, WorldEditList &worldEditList
NLLIGO::CPrimitives ligoPrimitives; NLLIGO::CPrimitives ligoPrimitives;
// Read it // Read it
ligoPrimitives.read(primitives, fileName.c_str(), *NLLIGO::CPrimitiveContext::instance().CurrentLigoConfig); ligoPrimitives.read(primitives, fileName.c_str(), *ligoConfig());
//_DataHierarchy.back ().Primitives.read (primitives, filename, theApp.Config); //_DataHierarchy.back ().Primitives.read (primitives, filename, theApp.Config);
// Set the filename // Set the filename

View file

@ -181,7 +181,7 @@ void WorldEditorScene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent)
{ {
m_firstPick = mouseEvent->scenePos(); m_firstPick = mouseEvent->scenePos();
if (m_pointsMode) if (isEnabledEditPoints())
{ {
m_polygons = polygonsFromItems(m_selectedItems); m_polygons = polygonsFromItems(m_selectedItems);
@ -288,6 +288,8 @@ void WorldEditorScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent)
if (mouseEvent->button() == Qt::LeftButton) if (mouseEvent->button() == Qt::LeftButton)
{ {
checkUndo();
// Update selection // Update selection
if ((m_selectionArea.left() != 0) && (m_selectionArea.right() != 0)) if ((m_selectionArea.left() != 0) && (m_selectionArea.right() != 0))
{ {

View file

@ -223,10 +223,8 @@ public:
WorldItemZone(const QPolygonF &polygon, QGraphicsItem *parent = 0); WorldItemZone(const QPolygonF &polygon, QGraphicsItem *parent = 0);
virtual ~WorldItemZone(); virtual ~WorldItemZone();
virtual void setColor(const QColor &color); virtual void setColor(const QColor &color);
virtual bool removeSubPoint(WorldItemSubPoint *subPoint); virtual bool removeSubPoint(WorldItemSubPoint *subPoint);
virtual QPainterPath shape() const; virtual QPainterPath shape() const;
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);

View file

@ -384,8 +384,8 @@ void WorldEditorWindow::readSettings()
// Use OpenGL graphics system instead raster graphics system // Use OpenGL graphics system instead raster graphics system
if (settings->value(Constants::WORLD_EDITOR_USE_OPENGL, true).toBool()) if (settings->value(Constants::WORLD_EDITOR_USE_OPENGL, true).toBool())
{ {
//m_oglWidget = new QGLWidget(QGLFormat(QGL::DoubleBuffer)); m_oglWidget = new QGLWidget(QGLFormat(QGL::DoubleBuffer));
m_oglWidget = new QGLWidget(QGLFormat(QGL::DoubleBuffer | QGL::SampleBuffers)); //m_oglWidget = new QGLWidget(QGLFormat(QGL::DoubleBuffer | QGL::SampleBuffers));
m_ui.graphicsView->setViewport(m_oglWidget); m_ui.graphicsView->setViewport(m_oglWidget);
} }

View file

@ -28,7 +28,7 @@
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property> </property>
<property name="renderHints"> <property name="renderHints">
<set>QPainter::Antialiasing|QPainter::SmoothPixmapTransform|QPainter::TextAntialiasing</set> <set>QPainter::SmoothPixmapTransform</set>
</property> </property>
<property name="dragMode"> <property name="dragMode">
<enum>QGraphicsView::NoDrag</enum> <enum>QGraphicsView::NoDrag</enum>