mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-11-15 13:15:43 +08:00
Fixed #481 issue Undocking an autohide dock widget does not close the AutoHideTab from the sidebar
This commit is contained in:
parent
bbfe99ce7d
commit
378c647952
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -38,6 +38,8 @@
|
||||
#include <QStyle>
|
||||
#include <QMouseEvent>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
#include <xcb/xcb.h>
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user