From ca767adf7b80c57763f2b03cf958f913e9a2ad0c Mon Sep 17 00:00:00 2001 From: dnk-88 Date: Fri, 21 Jan 2011 12:20:57 +0200 Subject: [PATCH] Changed: #1193 Added menu entry change render mode. --- .../3d/object_viewer_qt/src/main_window.cpp | 44 +++++++++---------- .../3d/object_viewer_qt/src/main_window.h | 3 -- .../3d/object_viewer_qt/src/object_viewer.h | 2 +- 3 files changed, 22 insertions(+), 27 deletions(-) diff --git a/code/nel/tools/3d/object_viewer_qt/src/main_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/main_window.cpp index 60246db4e..b1fe605e3 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/main_window.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/main_window.cpp @@ -206,6 +206,19 @@ void CMainWindow::resetScene() void CMainWindow::changeRenderMode() { + // Change render mode + switch (Modules::objView().getDriver()->getPolygonMode()) + { + case NL3D::UDriver::Filled: + Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Line); + break; + case NL3D::UDriver::Line: + Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Point); + break; + case NL3D::UDriver::Point: + Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Filled); + break; + } } void CMainWindow::resetCamera() @@ -355,11 +368,16 @@ void CMainWindow::createActions() _setBackColorAction->setIcon(QIcon(":/images/ico_bgcolor.png")); _setBackColorAction->setStatusTip(tr("Set background color")); - _resetCameraAction = new QAction(tr("R&eset camera"), this); + _resetCameraAction = new QAction(tr("Reset camera"), this); _resetCameraAction->setShortcut(tr("Ctrl+R")); _resetCameraAction->setStatusTip(tr("Reset current camera")); connect(_resetCameraAction, SIGNAL(triggered()), this, SLOT(resetCamera())); + _renderModeAction = new QAction("Change render mode", this); + _renderModeAction->setShortcut(tr("Ctrl+M")); + _renderModeAction->setStatusTip(tr("Change render mode (Line, Point, Filled)")); + connect(_renderModeAction, SIGNAL(triggered()), this, SLOT(changeRenderMode())); + _resetSceneAction = new QAction(tr("&Reset scene"), this); _resetSceneAction->setStatusTip(tr("Reset current scene")); connect(_resetSceneAction, SIGNAL(triggered()), this, SLOT(resetScene())); @@ -393,8 +411,9 @@ void CMainWindow::createMenus() _viewMenu = menuBar()->addMenu(tr("&View")); _viewMenu->setObjectName("ovqt.Menu.View"); _viewMenu->addAction(_setBackColorAction); - _viewMenu->addAction(_SetupFog->toggleViewAction()); + _viewMenu->addAction(_renderModeAction); _viewMenu->addAction(_resetCameraAction); + _viewMenu->addAction(_SetupFog->toggleViewAction()); _sceneMenu = menuBar()->addMenu(tr("&Scene")); _sceneMenu->setObjectName("ovqt.Menu.Scene"); @@ -704,27 +723,6 @@ void CMainWindow::updateRender() } } -void CMainWindow::keyPressEvent(QKeyEvent *keyEvent) -{ - if (keyEvent->key() == Qt::Key_F1) - { - // Change render mode - switch (Modules::objView().getDriver()->getPolygonMode()) - { - case NL3D::UDriver::Filled: - Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Line); - break; - case NL3D::UDriver::Line: - Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Point); - break; - case NL3D::UDriver::Point: - Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Filled); - break; - } - } - QMainWindow::keyPressEvent(keyEvent); -} - } /* namespace NLQT */ /* end of file */ diff --git a/code/nel/tools/3d/object_viewer_qt/src/main_window.h b/code/nel/tools/3d/object_viewer_qt/src/main_window.h index 40bb56975..599aa31c2 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/main_window.h +++ b/code/nel/tools/3d/object_viewer_qt/src/main_window.h @@ -86,9 +86,6 @@ private Q_SLOTS: void updateStatusBar(); void updateRender(); -protected: - virtual void keyPressEvent(QKeyEvent *keyEvent); - private: void createActions(); void createMenus(); diff --git a/code/nel/tools/3d/object_viewer_qt/src/object_viewer.h b/code/nel/tools/3d/object_viewer_qt/src/object_viewer.h index f52f5ca85..c846a7dae 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/object_viewer.h +++ b/code/nel/tools/3d/object_viewer_qt/src/object_viewer.h @@ -239,7 +239,7 @@ private: NL3D::UCamera *_Camera; NL3D::UTextContext *_TextContext; NL3D::U3dMouseListener *_MouseListener; - std::vector _ListIG; + std::vector _ListIG; // The entities storage CEntities _Entities;