mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-14 06:57:01 +00:00
- using Alt key in fullscreen mode: don't autoshow the menubar but popup directly relevant menu if possible. This code will I guess not work on Mac. The solution is I think for GlobalMenuBar to subclass MenuBar instead of QMenuBar.
- remove autohide of menu and status bar. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24787 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
5691d8d8ce
commit
40f50f2a94
@ -276,6 +276,17 @@ public:
|
|||||||
TocModels toc_models_;
|
TocModels toc_models_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
class MenuBar : public QMenuBar
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
///
|
||||||
|
MenuBar() : QMenuBar(0) {}
|
||||||
|
void keyPressEvent(QKeyEvent * e) { QMenuBar::keyPressEvent(e); }
|
||||||
|
};
|
||||||
|
|
||||||
|
} // anon
|
||||||
|
|
||||||
GuiView::GuiView(int id)
|
GuiView::GuiView(int id)
|
||||||
: d(*new GuiViewPrivate), id_(id)
|
: d(*new GuiViewPrivate), id_(id)
|
||||||
@ -288,6 +299,10 @@ GuiView::GuiView(int id)
|
|||||||
// they are greyed out.
|
// they are greyed out.
|
||||||
theLyXFunc().setLyXView(this);
|
theLyXFunc().setLyXView(this);
|
||||||
|
|
||||||
|
#ifndef Q_WS_MACX
|
||||||
|
setMenuBar(new MenuBar());
|
||||||
|
#endif
|
||||||
|
|
||||||
// Fill up the menu bar.
|
// Fill up the menu bar.
|
||||||
guiApp->menus().fillMenuBar(menuBar(), this, true);
|
guiApp->menus().fillMenuBar(menuBar(), this, true);
|
||||||
|
|
||||||
@ -642,17 +657,19 @@ bool GuiView::event(QEvent * e)
|
|||||||
|
|
||||||
case QEvent::ShortcutOverride: {
|
case QEvent::ShortcutOverride: {
|
||||||
|
|
||||||
|
#ifndef Q_WS_MACX
|
||||||
if (isFullScreen() && menuBar()->isHidden()) {
|
if (isFullScreen() && menuBar()->isHidden()) {
|
||||||
QKeyEvent * ke = static_cast<QKeyEvent*>(e);
|
QKeyEvent * ke = static_cast<QKeyEvent*>(e);
|
||||||
// FIXME: we should also try to detect special LyX shortcut such as
|
|
||||||
// Alt-P and Alt-M
|
|
||||||
if (!(ke->modifiers() & Qt::AltModifier)
|
if (!(ke->modifiers() & Qt::AltModifier)
|
||||||
|| ke->key() == Qt::Key_Alt)
|
|| ke->key() == Qt::Key_Alt)
|
||||||
return QMainWindow::event(e);
|
return QMainWindow::event(e);
|
||||||
menuBar()->show();
|
static_cast<MenuBar *>(menuBar())->keyPressEvent(ke);
|
||||||
// Continue with even.
|
if (ke->isAccepted())
|
||||||
|
return true;
|
||||||
|
// Otherwise continue with even.
|
||||||
return QMainWindow::event(e);
|
return QMainWindow::event(e);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
QKeyEvent * ke = static_cast<QKeyEvent*>(e);
|
QKeyEvent * ke = static_cast<QKeyEvent*>(e);
|
||||||
if (d.current_work_area_)
|
if (d.current_work_area_)
|
||||||
@ -1920,13 +1937,6 @@ bool GuiView::dispatch(FuncRequest const & cmd)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isFullScreen()) {
|
|
||||||
if (menuBar()->isVisible())
|
|
||||||
menuBar()->hide();
|
|
||||||
if (statusBar()->isVisible())
|
|
||||||
statusBar()->hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
return dispatched;
|
return dispatched;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user