Ejemplo n.º 1
0
void FullscreenSpacerLabel::mouseMoveEvent (QMouseEvent *event)
{
	MainWindow *wnd = Core::Instance ().GetReallyMainWindow ();
	if (wnd && (wnd->windowState () == Qt::WindowFullScreen))
	{
		QMenuBar *menu = wnd->findChild<QMenuBar*> ("MenuBar_");
		if (!menu)
		{
			qWarning () << Q_FUNC_INFO
						<< "menu is null";
			return;
		}
		QToolBar *toolbar = wnd->findChild<QToolBar*> ("MainToolbar_");
		if (!toolbar)
		{
			qWarning () << Q_FUNC_INFO
						<< "toolbar is null";
			return;
		}
		LeechCraft::TabWidget *tabwidget = wnd->GetTabWidget ();
		if (!tabwidget)
		{
			qWarning () << Q_FUNC_INFO
						<< "tabwidget is null";
			return;
		}
		QToolBar *bar = Core::Instance ().GetToolBar (tabwidget->currentIndex ());
		if (!bar)
		{
			qWarning () << Q_FUNC_INFO
						<< "bar is null";
			return;
		}

		const bool asButton = XmlSettingsManager::Instance ()->property ("ShowMenuBarAsButton").toBool ();

		if (event->y () < 5)
		{
			if (asButton)
				menu->hide ();
			else if (menu->isHidden ())
				menu->show ();

			if (toolbar->isHidden ())
				toolbar->show ();
			if (bar && bar->isHidden ())
				bar->show ();
		}
		else
		{
			if (!menu->isHidden ())
				menu->hide ();
			if (!toolbar->isHidden ())
				toolbar->hide ();
			if (bar && !bar->isHidden ())
				bar->hide ();
		}
	}
}
Ejemplo n.º 2
0
void MainWindow::on_actionShowMenubar_toggled(bool enable)
{
    QMenuBar *mb = menuBar();
    if (enable)
        mb->show();
    else
        mb->hide();
}