Added support for make a single tab floating via double click

This commit is contained in:
Uwe Kindler 2018-09-07 13:13:44 +02:00
parent aa7b36dbd1
commit 5d380708e1
2 changed files with 22 additions and 0 deletions

View File

@ -373,6 +373,22 @@ const QIcon& CDockWidgetTab::icon() const
{
return d->Icon;
}
//============================================================================
void CDockWidgetTab::mouseDoubleClickEvent(QMouseEvent *event)
{
// If this is the last dock area in a dock container it does not make
// sense to move it to a new floating widget and leave this one
// empty
if (!d->DockArea->dockContainer()->isFloating() || d->DockArea->count() > 1)
{
d->startFloating();
}
Super::mouseDoubleClickEvent(event);
}
} // namespace ads
//---------------------------------------------------------------------------

View File

@ -59,7 +59,13 @@ protected:
virtual void mouseReleaseEvent(QMouseEvent* ev) override;
virtual void mouseMoveEvent(QMouseEvent* ev) override;
/**
* Double clicking the tab widget makes the assigned dock widget floating
*/
virtual void mouseDoubleClickEvent(QMouseEvent *event) override;
public:
using Super = QFrame;
/**
* Default Constructor
* param[in] DockWidget The dock widget this title bar belongs to