toggle menu near top of window

This commit is contained in:
ZappoMan 2015-08-20 19:11:15 -07:00
parent 9f501d4d72
commit 06b2a88fb6

View file

@ -1744,6 +1744,27 @@ void Application::mouseMoveEvent(QMouseEvent* event, unsigned int deviceID) {
return; 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); _entities.mouseMoveEvent(event, deviceID);
_controllerScriptingInterface.emitMouseMoveEvent(event, deviceID); // send events to any registered scripts _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->windowHandle()->setScreen((QScreen*)target);
_window->showFullScreen(); _window->showFullScreen();
#ifndef Q_OS_MAC
// also hide the QMainWindow's menuBar // also hide the QMainWindow's menuBar
QMenuBar* menuBar = _window->menuBar(); QMenuBar* menuBar = _window->menuBar();
if (menuBar) { if (menuBar) {
menuBar->setVisible(false); menuBar->setVisible(false);
} }
#endif
} }
void Application::unsetFullscreen(const QScreen* avoid) { void Application::unsetFullscreen(const QScreen* avoid) {
@ -5022,11 +5045,13 @@ void Application::unsetFullscreen(const QScreen* avoid) {
_window->setGeometry(targetGeometry); _window->setGeometry(targetGeometry);
#endif #endif
#ifndef Q_OS_MAC
// also show the QMainWindow's menuBar // also show the QMainWindow's menuBar
QMenuBar* menuBar = _window->menuBar(); QMenuBar* menuBar = _window->menuBar();
if (menuBar) { if (menuBar) {
menuBar->setVisible(true); menuBar->setVisible(true);
} }
#endif
} }