Double clicking on a tab will make it float
Also really required for Wayland, where we don't another way to float a single tab, as the float button affects all of them.
This commit is contained in:
@@ -111,6 +111,11 @@ void TabBarWidget::mouseMoveEvent(QMouseEvent *e)
|
||||
}
|
||||
}
|
||||
|
||||
void TabBarWidget::mouseDoubleClickEvent(QMouseEvent *e)
|
||||
{
|
||||
TabBar::onMouseDoubleClick(e->pos());
|
||||
}
|
||||
|
||||
bool TabBarWidget::dragCanStart(QPoint pressPos, QPoint pos) const
|
||||
{
|
||||
// Here we allow the user to re-order tabs instead of dragging them off.
|
||||
|
||||
@@ -47,6 +47,7 @@ protected:
|
||||
bool dragCanStart(QPoint pressPos, QPoint pos) const override;
|
||||
void mousePressEvent(QMouseEvent *) override;
|
||||
void mouseMoveEvent(QMouseEvent *e) override;
|
||||
void mouseDoubleClickEvent(QMouseEvent *e) override;
|
||||
private:
|
||||
TabWidget *const m_tabWidget;
|
||||
};
|
||||
|
||||
@@ -115,6 +115,12 @@ void TabBar::onMousePress(QPoint localPos)
|
||||
m_lastPressedDockWidget = dockWidgetAt(localPos);
|
||||
}
|
||||
|
||||
void TabBar::onMouseDoubleClick(QPoint localPos)
|
||||
{
|
||||
if (DockWidgetBase *dw = dockWidgetAt(localPos))
|
||||
dw->setFloating(true);
|
||||
}
|
||||
|
||||
bool TabBar::hasSingleDockWidget() const
|
||||
{
|
||||
return numDockWidgets() == 1;
|
||||
|
||||
@@ -67,6 +67,7 @@ public:
|
||||
FloatingWindow *detachTab(DockWidgetBase *dockWidget);
|
||||
|
||||
void onMousePress(QPoint localPos);
|
||||
void onMouseDoubleClick(QPoint localPos);
|
||||
|
||||
///@brief returns whether there's only 1 tab
|
||||
bool hasSingleDockWidget() const;
|
||||
|
||||
Reference in New Issue
Block a user