From 06b2a88fb6f730c7fd157f9543671c2c39efc373 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Thu, 20 Aug 2015 19:11:15 -0700 Subject: [PATCH] toggle menu near top of window --- interface/src/Application.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 0bc4f9b943..a088c42f87 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -1744,6 +1744,27 @@ void Application::mouseMoveEvent(QMouseEvent* event, unsigned int deviceID) { return; } +#if 1 //ndef Q_OS_MAC + // If in full screen, and our main windows menu bar is hidden, and we're close to the top of the QMainWindow + // then show the menubar. + if (_window->isFullScreen()) { + QMenuBar* menuBar = _window->menuBar(); + if (menuBar) { + static const int MENU_TOGGLE_AREA = 10; + if (!menuBar->isVisible()) { + if (event->pos().y() <= MENU_TOGGLE_AREA) { + menuBar->setVisible(true); + } + } else { + if (event->pos().y() > MENU_TOGGLE_AREA) { + menuBar->setVisible(false); + } + } + } + } +#endif + + _entities.mouseMoveEvent(event, deviceID); _controllerScriptingInterface.emitMouseMoveEvent(event, deviceID); // send events to any registered scripts @@ -4986,11 +5007,13 @@ void Application::setFullscreen(const QScreen* target) { _window->windowHandle()->setScreen((QScreen*)target); _window->showFullScreen(); +#ifndef Q_OS_MAC // also hide the QMainWindow's menuBar QMenuBar* menuBar = _window->menuBar(); if (menuBar) { menuBar->setVisible(false); } +#endif } void Application::unsetFullscreen(const QScreen* avoid) { @@ -5022,11 +5045,13 @@ void Application::unsetFullscreen(const QScreen* avoid) { _window->setGeometry(targetGeometry); #endif +#ifndef Q_OS_MAC // also show the QMainWindow's menuBar QMenuBar* menuBar = _window->menuBar(); if (menuBar) { menuBar->setVisible(true); } +#endif }