diff --git a/MainWindow.cpp b/MainWindow.cpp index 6bcd60a..4b5cee8 100644 --- a/MainWindow.cpp +++ b/MainWindow.cpp @@ -1180,6 +1180,14 @@ void MainWindow::createActions() // Output window should be displayed for full screen option to be available. connect(displayOutputWindow, SIGNAL(toggled(bool)), outputWindowFullScreen, SLOT(setEnabled(bool))); + + // outputWindowHasCursor = new QAction(tr("O&utput window has cursor"), this); + // outputWindowHasCursor->setStatusTip(tr("Show cursor in output window")); + // outputWindowHasCursor->setIconVisibleInMenu(false); + // outputWindowHasCursor->setCheckable(true); + // outputWindowHasCursor->setChecked(true); + // connect(outputWindowHasCursor, SIGNAL(toggled(bool)), outputWindow, SLOT(setFullScreen(bool))); + // Toggle display of canvas controls. displayCanvasControls = new QAction(tr("&Display canvas controls"), this); // displayCanvasControls->setShortcut(tr("Ctrl+E")); @@ -1254,6 +1262,7 @@ void MainWindow::createMenus() viewMenu->addAction(outputWindowFullScreen); viewMenu->addAction(displayCanvasControls); viewMenu->addAction(stickyVertices); + //viewMenu->addAction(outputWindowHasCursor); // Run. runMenu = menuBar->addMenu(tr("&Run")); diff --git a/MainWindow.h b/MainWindow.h index 5df305d..54ac351 100644 --- a/MainWindow.h +++ b/MainWindow.h @@ -256,6 +256,7 @@ private: QAction *rewindAction; QAction *displayOutputWindow; + //QAction *outputWindowHasCursor; QAction *outputWindowFullScreen; QAction *displayCanvasControls; QAction *stickyVertices; diff --git a/OutputGLWindow.cpp b/OutputGLWindow.cpp index e9ce620..4a58770 100644 --- a/OutputGLWindow.cpp +++ b/OutputGLWindow.cpp @@ -36,6 +36,24 @@ OutputGLWindow::OutputGLWindow(MainWindow* mainWindow, QWidget* parent, const QG // Save window geometry. _geometry = saveGeometry(); + + _pointerIsVisible = true; +} + +void OutputGLWindow::setCursorVisible(bool visible) +{ + _pointerIsVisible = visible; + + if (_pointerIsVisible) + { + this->setCursor(Qt::ArrowCursor); + _pointerIsVisible = true; + } + else + { + this->setCursor(Qt::BlankCursor); + _pointerIsVisible = false; + } } void OutputGLWindow::closeEvent(QCloseEvent *event) @@ -47,14 +65,16 @@ void OutputGLWindow::closeEvent(QCloseEvent *event) void OutputGLWindow::keyPressEvent(QKeyEvent *event) { // Escape from full screen mode. - if (isFullScreen() && event->key() == Qt::Key_Escape) + if (event->key() == Qt::Key_Escape) { - setFullScreen(false); - emit fullScreenToggled(false); - } - else if (event->key() == Qt::Key_Escape) - { - // pass + if (isFullScreen()) + { + setFullScreen(false); + emit fullScreenToggled(false); + } else { + setFullScreen(true); + emit fullScreenToggled(true); + } } else { diff --git a/OutputGLWindow.h b/OutputGLWindow.h index 8c85572..768df62 100644 --- a/OutputGLWindow.h +++ b/OutputGLWindow.h @@ -2,6 +2,7 @@ * OutputGLWindow.h * * (c) 2014 Sofian Audry -- info(@)sofianaudry(.)com + * (c) 2014 Alexandre Quessy -- alexandre(@)quessy(.)net * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,6 +23,7 @@ #include #include +#include #include "DestinationGLCanvas.h" // TODO: add SLOT for mySetVisible @@ -47,10 +49,14 @@ signals: public: DestinationGLCanvas* getCanvas() const { return canvas; } + void setPointerHasMoved(); + void setCursorVisible(bool visible); private: DestinationGLCanvas* canvas; QByteArray _geometry; + + bool _pointerIsVisible; }; #endif /* OutputGLWINDOW_H_ */