FocusScope: Also focus when the user clicks on tab widget background

Relevant when you don't have a title bar
This commit is contained in:
Sergio Martins
2020-11-03 15:29:13 +00:00
parent ddad0feaf3
commit 0a2aebd78d
2 changed files with 11 additions and 0 deletions

View File

@@ -88,6 +88,16 @@ void TabWidgetWidget::mouseDoubleClickEvent(QMouseEvent *ev)
}
}
void TabWidgetWidget::mousePressEvent(QMouseEvent *ev)
{
QTabWidget::mousePressEvent(ev);
if ((Config::self().flags() & Config::Flag_TitleBarIsFocusable) && !frame()->isFocused()) {
// User clicked on the tab widget itself
frame()->FocusScope::focus(Qt::MouseFocusReason);
}
}
void TabWidgetWidget::tabInserted(int)
{
onTabInserted();

View File

@@ -42,6 +42,7 @@ public:
protected:
void paintEvent(QPaintEvent *) override;
void mouseDoubleClickEvent(QMouseEvent *) override;
void mousePressEvent(QMouseEvent *) override;
void tabInserted(int index) override;
void tabRemoved(int index) override;
bool isPositionDraggable(QPoint p) const override;