mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-06 11:23:45 +00:00
Re-focus workarea after some outline context-menu actions (see #1624)
Thanks Pavel for the main idea
This commit is contained in:
parent
194b53ef9d
commit
126cbec5e7
@ -214,6 +214,8 @@ void TocWidget::doDispatch(Cursor & cur, FuncRequest const & cmd,
|
|||||||
|
|
||||||
// Start an undo group.
|
// Start an undo group.
|
||||||
cur.beginUndoGroup();
|
cur.beginUndoGroup();
|
||||||
|
// re-focus the workarea after the action?
|
||||||
|
bool refocus_wa = false;
|
||||||
|
|
||||||
switch (cmd.action())
|
switch (cmd.action())
|
||||||
{
|
{
|
||||||
@ -259,6 +261,7 @@ void TocWidget::doDispatch(Cursor & cur, FuncRequest const & cmd,
|
|||||||
: item.parIDs();
|
: item.parIDs();
|
||||||
docstring const arg = (type.empty()) ? id : id + " " + type;
|
docstring const arg = (type.empty()) ? id : id + " " + type;
|
||||||
dispatch(FuncRequest(cmd, arg));
|
dispatch(FuncRequest(cmd, arg));
|
||||||
|
refocus_wa = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -269,12 +272,22 @@ void TocWidget::doDispatch(Cursor & cur, FuncRequest const & cmd,
|
|||||||
outline(cmd.action());
|
outline(cmd.action());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case LFUN_LABEL_INSERT_AS_REFERENCE:
|
||||||
|
refocus_wa = true;
|
||||||
|
// fall through
|
||||||
default: {
|
default: {
|
||||||
FuncRequest tmpcmd(cmd);
|
FuncRequest tmpcmd(cmd);
|
||||||
if (inset)
|
if (inset)
|
||||||
inset->dispatch(cur, tmpcmd);
|
inset->dispatch(cur, tmpcmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (refocus_wa) {
|
||||||
|
QMainWindow * mw = static_cast<QMainWindow *>(&gui_view_);
|
||||||
|
if (mw) {
|
||||||
|
mw->activateWindow();
|
||||||
|
mw->setFocus();
|
||||||
|
}
|
||||||
|
}
|
||||||
cur.endUndoGroup();
|
cur.endUndoGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user