From 697299d61bcced16cc716f9bb4a64c38fc43368f Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 17 Feb 2016 03:18:29 +0100 Subject: [PATCH] Fix exit --HG-- branch : feature-material-editor --- code/nel/tools/3d/mesh_editor/main_window.cpp | 12 +++++++++--- code/nel/tools/3d/mesh_editor/main_window.h | 3 +++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/code/nel/tools/3d/mesh_editor/main_window.cpp b/code/nel/tools/3d/mesh_editor/main_window.cpp index f25a548ad..b21994dde 100644 --- a/code/nel/tools/3d/mesh_editor/main_window.cpp +++ b/code/nel/tools/3d/mesh_editor/main_window.cpp @@ -60,6 +60,7 @@ CMainWindow::CMainWindow(QWidget *parent, Qt::WindowFlags flags) m_IsExiting(false) { setObjectName("CMainWindow"); + setWindowTitle(tr("NeL Mesh Editor")); m_UndoStack = new QUndoStack(this); @@ -78,11 +79,8 @@ CMainWindow::CMainWindow(QWidget *parent, Qt::WindowFlags flags) recalculateMinimumWidth(); - // As a special case, a QTimer with a timeout of 0 will time out as soon as all the events in the window system's event queue have been processed. This can be used to do heavy work while providing a snappy user interface. m_Timer = new QTimer(this); connect(m_Timer, SIGNAL(timeout()), this, SLOT(updateRender())); - // timer->start(); // <- timeout 0 - // it's heavy on cpu, though, when no 3d driver initialized :) m_Timer->start(40); // 25fps m_IsGraphicsEnabled = m_GraphicsConfig->getGraphicsEnabled(); @@ -104,6 +102,14 @@ CMainWindow::~CMainWindow() m_Configuration.release(); } +void CMainWindow::closeEvent(QCloseEvent *e) +{ + m_Timer->stop(); + updateInitialization(false); + + QMainWindow::closeEvent(e); +} + void CMainWindow::setVisible(bool visible) { // called by show() diff --git a/code/nel/tools/3d/mesh_editor/main_window.h b/code/nel/tools/3d/mesh_editor/main_window.h index 1553a218d..4e063cd36 100644 --- a/code/nel/tools/3d/mesh_editor/main_window.h +++ b/code/nel/tools/3d/mesh_editor/main_window.h @@ -92,6 +92,9 @@ private slots: void updateRender(); void printDebug(); +protected: + virtual void closeEvent(QCloseEvent *e); + private: void updateInitialization(bool visible);