Added support for make auto hide widget floating via double click or context menu

This commit is contained in:
Uwe Kindler
2023-07-07 11:21:54 +02:00
parent 0b3c3f0123
commit 1c6d86e70f
10 changed files with 149 additions and 28 deletions

View File

@@ -260,6 +260,7 @@ void DockAreaTitleBarPrivate::createTabBar()
//============================================================================
IFloatingWidget* DockAreaTitleBarPrivate::makeAreaFloating(const QPoint& Offset, eDragState DragState)
{
qDebug() << "DockAreaTitleBarPrivate::makeAreaFloating " << DockArea->size();
QSize Size = DockArea->size();
this->DragState = DragState;
bool CreateFloatingDockContainer = (DraggingFloatingWidget != DragState);
@@ -660,6 +661,7 @@ void CDockAreaTitleBar::mouseMoveEvent(QMouseEvent* ev)
//============================================================================
void CDockAreaTitleBar::mouseDoubleClickEvent(QMouseEvent *event)
{
std::cout << "CDockAreaTitleBar::mouseDoubleClickEvent" << std::endl;
// 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
@@ -677,6 +679,26 @@ void CDockAreaTitleBar::mouseDoubleClickEvent(QMouseEvent *event)
}
//============================================================================
void CDockAreaTitleBar::setAreaFloating()
{
// 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->dockContainer()->dockAreaCount() == 1)
{
return;
}
if (!d->DockArea->features().testFlag(CDockWidget::DockWidgetFloatable))
{
return;
}
d->makeAreaFloating(mapFromGlobal(QCursor::pos()), DraggingInactive);
}
//============================================================================
void CDockAreaTitleBar::contextMenuEvent(QContextMenuEvent* ev)
{