Fixed #481 issue Undocking an autohide dock widget does not close the AutoHideTab from the sidebar

This commit is contained in:
Uwe Kindler 2023-01-20 09:44:18 +01:00
parent bbfe99ce7d
commit 378c647952
3 changed files with 26 additions and 13 deletions

View File

@ -262,12 +262,16 @@ IFloatingWidget* DockAreaTitleBarPrivate::makeAreaFloating(const QPoint& Offset,
{
QSize Size = DockArea->size();
this->DragState = DragState;
bool OpaqueUndocking = CDockManager::testConfigFlag(CDockManager::OpaqueUndocking) ||
(DraggingFloatingWidget != DragState);
bool CreateFloatingDockContainer = CDockManager::testConfigFlag(
CDockManager::OpaqueUndocking) || (DraggingFloatingWidget != DragState);
CFloatingDockContainer* FloatingDockContainer = nullptr;
IFloatingWidget* FloatingWidget;
if (OpaqueUndocking)
if (CreateFloatingDockContainer)
{
if (DockArea->autoHideDockContainer())
{
DockArea->autoHideDockContainer()->cleanupAndDelete();
}
FloatingWidget = FloatingDockContainer = new CFloatingDockContainer(DockArea);
}
else
@ -297,7 +301,7 @@ IFloatingWidget* DockAreaTitleBarPrivate::makeAreaFloating(const QPoint& Offset,
//============================================================================
void DockAreaTitleBarPrivate::startFloating(const QPoint& Offset)
{
if (DockArea->autoHideDockContainer() != nullptr)
if (DockArea->autoHideDockContainer())
{
DockArea->autoHideDockContainer()->hide();
}
@ -428,11 +432,6 @@ void CDockAreaTitleBar::onUndockButtonClicked()
{
if (d->DockArea->features().testFlag(CDockWidget::DockWidgetFloatable))
{
if (d->DockArea->autoHideDockContainer())
{
d->DockArea->autoHideDockContainer()->cleanupAndDelete();
}
d->makeAreaFloating(mapFromGlobal(QCursor::pos()), DraggingInactive);
}
}
@ -590,6 +589,10 @@ void CDockAreaTitleBar::mouseReleaseEvent(QMouseEvent* ev)
if (ev->button() == Qt::LeftButton)
{
ADS_PRINT("CDockAreaTitleBar::mouseReleaseEvent");
if (CDockManager::testConfigFlag(CDockManager::OpaqueUndocking))
{
releaseMouse();
}
ev->accept();
auto CurrentDragState = d->DragState;
d->DragStartMousePos = QPoint();
@ -650,6 +653,10 @@ void CDockAreaTitleBar::mouseMoveEvent(QMouseEvent* ev)
d->startFloating(d->DragStartMousePos);
auto Overlay = d->DockArea->dockManager()->containerOverlay();
Overlay->setAllowedAreas(OuterDockAreas);
if (CDockManager::testConfigFlag(CDockManager::OpaqueUndocking))
{
grabMouse();
}
}
return;
@ -671,10 +678,6 @@ void CDockAreaTitleBar::mouseDoubleClickEvent(QMouseEvent *event)
{
return;
}
if (d->DockArea->autoHideDockContainer())
{
d->DockArea->autoHideDockContainer()->cleanupAndDelete();
}
d->makeAreaFloating(event->pos(), DraggingInactive);
}

View File

@ -392,6 +392,10 @@ void CDockWidgetTab::mouseReleaseEvent(QMouseEvent* ev)
{
if (ev->button() == Qt::LeftButton)
{
if (CDockManager::testConfigFlag(CDockManager::OpaqueUndocking))
{
releaseMouse();
}
auto CurrentDragState = d->DragState;
d->GlobalDragStartMousePosition = QPoint();
d->DragStartMousePosition = QPoint();
@ -490,6 +494,10 @@ void CDockWidgetTab::mouseMoveEvent(QMouseEvent* ev)
parentWidget()->layout()->update();
}
d->startFloating();
if (CDockManager::testConfigFlag(CDockManager::OpaqueUndocking))
{
grabMouse();
}
}
return;
}

View File

@ -38,6 +38,8 @@
#include <QStyle>
#include <QMouseEvent>
#include <iostream>
#ifdef Q_OS_LINUX
#include <xcb/xcb.h>
#endif