mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Fixup [152811a27d242/lyxgit]
tabBarClicked() should really only reset focus if a click in a different TabBarGroup happened. And no need to issue workAreaChanged() again. This has lead to extra and erroneous focus changes (see #12954)
This commit is contained in:
parent
8659924abd
commit
026c4bd726
@ -1927,6 +1927,12 @@ GuiWorkArea const * GuiView::currentWorkArea() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TabWorkArea * GuiView::currentTabWorkArea() const
|
||||||
|
{
|
||||||
|
return d.currentTabWorkArea();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
GuiWorkArea * GuiView::currentWorkArea()
|
GuiWorkArea * GuiView::currentWorkArea()
|
||||||
{
|
{
|
||||||
return d.current_work_area_;
|
return d.current_work_area_;
|
||||||
|
@ -209,6 +209,8 @@ public:
|
|||||||
void removeWorkArea(GuiWorkArea * work_area);
|
void removeWorkArea(GuiWorkArea * work_area);
|
||||||
/// return true if \c wa is one of the visibles workareas of this view
|
/// return true if \c wa is one of the visibles workareas of this view
|
||||||
bool hasVisibleWorkArea(GuiWorkArea * wa) const;
|
bool hasVisibleWorkArea(GuiWorkArea * wa) const;
|
||||||
|
///
|
||||||
|
TabWorkArea * currentTabWorkArea() const;
|
||||||
/// return the current WorkArea (the one that has the focus).
|
/// return the current WorkArea (the one that has the focus).
|
||||||
GuiWorkArea const * currentWorkArea() const;
|
GuiWorkArea const * currentWorkArea() const;
|
||||||
/// return the current WorkArea (the one that has the focus).
|
/// return the current WorkArea (the one that has the focus).
|
||||||
|
@ -1644,7 +1644,7 @@ TabWorkArea::TabWorkArea(QWidget * parent)
|
|||||||
this, SLOT(on_currentTabChanged(int)));
|
this, SLOT(on_currentTabChanged(int)));
|
||||||
// Fix for #11835
|
// Fix for #11835
|
||||||
QObject::connect(this, SIGNAL(tabBarClicked(int)),
|
QObject::connect(this, SIGNAL(tabBarClicked(int)),
|
||||||
this, SLOT(on_currentTabChanged(int)));
|
this, SLOT(on_tabBarClicked(int)));
|
||||||
|
|
||||||
closeBufferButton = new QToolButton(this);
|
closeBufferButton = new QToolButton(this);
|
||||||
closeBufferButton->setPalette(pal);
|
closeBufferButton->setPalette(pal);
|
||||||
@ -1925,6 +1925,22 @@ bool TabWorkArea::removeWorkArea(GuiWorkArea * work_area)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void TabWorkArea::on_tabBarClicked(int i)
|
||||||
|
{
|
||||||
|
// returns e.g. on application destruction
|
||||||
|
if (i == -1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// if we click on a tab in a different TabWorkArea,
|
||||||
|
// focus needs to be set (#11835)
|
||||||
|
if (currentWorkArea() && currentWorkArea()->view().currentTabWorkArea() != this) {
|
||||||
|
GuiWorkArea * wa = workArea(i);
|
||||||
|
LASSERT(wa, return);
|
||||||
|
wa->setFocus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void TabWorkArea::on_currentTabChanged(int i)
|
void TabWorkArea::on_currentTabChanged(int i)
|
||||||
{
|
{
|
||||||
// returns e.g. on application destruction
|
// returns e.g. on application destruction
|
||||||
|
@ -267,6 +267,8 @@ private Q_SLOTS:
|
|||||||
///
|
///
|
||||||
void on_currentTabChanged(int index);
|
void on_currentTabChanged(int index);
|
||||||
///
|
///
|
||||||
|
void on_tabBarClicked(int index);
|
||||||
|
///
|
||||||
void showContextMenu(const QPoint & pos);
|
void showContextMenu(const QPoint & pos);
|
||||||
/// enable closing tab on middle-click
|
/// enable closing tab on middle-click
|
||||||
void mousePressEvent(QMouseEvent * me) override;
|
void mousePressEvent(QMouseEvent * me) override;
|
||||||
|
Loading…
Reference in New Issue
Block a user