mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-25 05:55:34 +00:00
Fix bug #3871: Shortcut to switch from TOC to text pane.
M-o now switches to the TOC pane, and Esc always returns from any DockView to the main window. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34293 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
f65f5be6d7
commit
f8d64b4799
@ -115,6 +115,7 @@
|
|||||||
\bind "S-F7" "thesaurus-entry"
|
\bind "S-F7" "thesaurus-entry"
|
||||||
|
|
||||||
\bind "M-x" "command-execute"
|
\bind "M-x" "command-execute"
|
||||||
|
\bind "M-o" "dialog-show toc"
|
||||||
|
|
||||||
\bind "F11" "ui-toggle fullscreen"
|
\bind "F11" "ui-toggle fullscreen"
|
||||||
|
|
||||||
|
@ -134,6 +134,7 @@
|
|||||||
#bind "F10" "------"
|
#bind "F10" "------"
|
||||||
|
|
||||||
\bind "M-x" "command-execute"
|
\bind "M-x" "command-execute"
|
||||||
|
\bind "M-o" "dialog-show toc"
|
||||||
|
|
||||||
\bind "M-equal" "buffer-zoom-in"
|
\bind "M-equal" "buffer-zoom-in"
|
||||||
\bind "M-plus" "buffer-zoom-in"
|
\bind "M-plus" "buffer-zoom-in"
|
||||||
|
@ -101,6 +101,7 @@
|
|||||||
\bind "S-F7" "thesaurus-entry"
|
\bind "S-F7" "thesaurus-entry"
|
||||||
|
|
||||||
\bind "M-x" "command-execute"
|
\bind "M-x" "command-execute"
|
||||||
|
\bind "M-o" "dialog-show toc"
|
||||||
|
|
||||||
\bind "M-equal" "buffer-zoom-in"
|
\bind "M-equal" "buffer-zoom-in"
|
||||||
\bind "M-plus" "buffer-zoom-in"
|
\bind "M-plus" "buffer-zoom-in"
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include "GuiView.h"
|
#include "GuiView.h"
|
||||||
|
|
||||||
#include <QDockWidget>
|
#include <QDockWidget>
|
||||||
|
#include <QKeyEvent>
|
||||||
|
|
||||||
namespace lyx {
|
namespace lyx {
|
||||||
namespace frontend {
|
namespace frontend {
|
||||||
@ -51,6 +52,19 @@ public:
|
|||||||
/// We don't want to restore geometry session for dock widgets.
|
/// We don't want to restore geometry session for dock widgets.
|
||||||
void restoreSession() {}
|
void restoreSession() {}
|
||||||
|
|
||||||
|
void keyPressEvent(QKeyEvent * ev)
|
||||||
|
{
|
||||||
|
if (ev->key() == Qt::Key_Escape) {
|
||||||
|
QMainWindow * mw = static_cast<QMainWindow *>(parent());
|
||||||
|
if (!mw) {
|
||||||
|
ev->ignore();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mw->activateWindow();
|
||||||
|
mw->setFocus();
|
||||||
|
ev->accept();
|
||||||
|
}
|
||||||
|
}
|
||||||
/// Dialog inherited methods
|
/// Dialog inherited methods
|
||||||
//@{
|
//@{
|
||||||
void applyView() {}
|
void applyView() {}
|
||||||
|
@ -37,6 +37,7 @@ GuiToc::GuiToc(GuiView & parent, Qt::DockWidgetArea area, Qt::WindowFlags flags)
|
|||||||
{
|
{
|
||||||
widget_ = new TocWidget(parent, this);
|
widget_ = new TocWidget(parent, this);
|
||||||
setWidget(widget_);
|
setWidget(widget_);
|
||||||
|
setFocusProxy(widget_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3490,9 +3490,17 @@ void GuiView::doShowDialog(QString const & qname, QString const & qdata,
|
|||||||
try {
|
try {
|
||||||
Dialog * dialog = findOrBuild(name, false);
|
Dialog * dialog = findOrBuild(name, false);
|
||||||
if (dialog) {
|
if (dialog) {
|
||||||
|
bool const visible = dialog->isVisibleView();
|
||||||
dialog->showData(data);
|
dialog->showData(data);
|
||||||
if (inset && currentBufferView())
|
if (inset && currentBufferView())
|
||||||
currentBufferView()->editInset(name, inset);
|
currentBufferView()->editInset(name, inset);
|
||||||
|
// We only set the focus to the new dialog if it was not yet
|
||||||
|
// visible in order not to change the existing previous behaviour
|
||||||
|
if (visible) {
|
||||||
|
// activateWindow is needed for floating dockviews
|
||||||
|
dialog->asQWidget()->activateWindow();
|
||||||
|
dialog->asQWidget()->setFocus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (ExceptionMessage const & ex) {
|
catch (ExceptionMessage const & ex) {
|
||||||
|
@ -68,6 +68,7 @@ TocWidget::TocWidget(GuiView & gui_view, QWidget * parent)
|
|||||||
|
|
||||||
// Only one item selected at a time.
|
// Only one item selected at a time.
|
||||||
tocTV->setSelectionMode(QAbstractItemView::SingleSelection);
|
tocTV->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||||
|
setFocusProxy(tocTV);
|
||||||
|
|
||||||
// The toc types combo won't change its model.
|
// The toc types combo won't change its model.
|
||||||
typeCO->setModel(gui_view_.tocModels().nameModel());
|
typeCO->setModel(gui_view_.tocModels().nameModel());
|
||||||
@ -402,6 +403,7 @@ void TocWidget::updateView()
|
|||||||
sortCB->setEnabled(is_sortable);
|
sortCB->setEnabled(is_sortable);
|
||||||
depthSL->setEnabled(true);
|
depthSL->setEnabled(true);
|
||||||
typeCO->setEnabled(true);
|
typeCO->setEnabled(true);
|
||||||
|
bool focus_ = tocTV->hasFocus();
|
||||||
tocTV->setEnabled(false);
|
tocTV->setEnabled(false);
|
||||||
tocTV->setUpdatesEnabled(false);
|
tocTV->setUpdatesEnabled(false);
|
||||||
|
|
||||||
@ -437,6 +439,8 @@ void TocWidget::updateView()
|
|||||||
filterContents();
|
filterContents();
|
||||||
tocTV->setEnabled(true);
|
tocTV->setEnabled(true);
|
||||||
tocTV->setUpdatesEnabled(true);
|
tocTV->setUpdatesEnabled(true);
|
||||||
|
if (focus_)
|
||||||
|
tocTV->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user