Changed: #1193 Added menu entry change render mode.

This commit is contained in:
dnk-88 2011-01-21 12:20:57 +02:00
parent 099e632129
commit a7181ef762
3 changed files with 22 additions and 27 deletions

View file

@ -206,6 +206,19 @@ void CMainWindow::resetScene()
void CMainWindow::changeRenderMode() 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() void CMainWindow::resetCamera()
@ -355,11 +368,16 @@ void CMainWindow::createActions()
_setBackColorAction->setIcon(QIcon(":/images/ico_bgcolor.png")); _setBackColorAction->setIcon(QIcon(":/images/ico_bgcolor.png"));
_setBackColorAction->setStatusTip(tr("Set background color")); _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->setShortcut(tr("Ctrl+R"));
_resetCameraAction->setStatusTip(tr("Reset current camera")); _resetCameraAction->setStatusTip(tr("Reset current camera"));
connect(_resetCameraAction, SIGNAL(triggered()), this, SLOT(resetCamera())); 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 = new QAction(tr("&Reset scene"), this);
_resetSceneAction->setStatusTip(tr("Reset current scene")); _resetSceneAction->setStatusTip(tr("Reset current scene"));
connect(_resetSceneAction, SIGNAL(triggered()), this, SLOT(resetScene())); connect(_resetSceneAction, SIGNAL(triggered()), this, SLOT(resetScene()));
@ -393,8 +411,9 @@ void CMainWindow::createMenus()
_viewMenu = menuBar()->addMenu(tr("&View")); _viewMenu = menuBar()->addMenu(tr("&View"));
_viewMenu->setObjectName("ovqt.Menu.View"); _viewMenu->setObjectName("ovqt.Menu.View");
_viewMenu->addAction(_setBackColorAction); _viewMenu->addAction(_setBackColorAction);
_viewMenu->addAction(_SetupFog->toggleViewAction()); _viewMenu->addAction(_renderModeAction);
_viewMenu->addAction(_resetCameraAction); _viewMenu->addAction(_resetCameraAction);
_viewMenu->addAction(_SetupFog->toggleViewAction());
_sceneMenu = menuBar()->addMenu(tr("&Scene")); _sceneMenu = menuBar()->addMenu(tr("&Scene"));
_sceneMenu->setObjectName("ovqt.Menu.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 */ } /* namespace NLQT */
/* end of file */ /* end of file */

View file

@ -86,9 +86,6 @@ private Q_SLOTS:
void updateStatusBar(); void updateStatusBar();
void updateRender(); void updateRender();
protected:
virtual void keyPressEvent(QKeyEvent *keyEvent);
private: private:
void createActions(); void createActions();
void createMenus(); void createMenus();

View file

@ -239,7 +239,7 @@ private:
NL3D::UCamera *_Camera; NL3D::UCamera *_Camera;
NL3D::UTextContext *_TextContext; NL3D::UTextContext *_TextContext;
NL3D::U3dMouseListener *_MouseListener; NL3D::U3dMouseListener *_MouseListener;
std::vector<NL3D::UInstanceGroup*> _ListIG; std::vector<NL3D::UInstanceGroup *> _ListIG;
// The entities storage // The entities storage
CEntities _Entities; CEntities _Entities;