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();
|
QSize Size = DockArea->size();
|
||||||
this->DragState = DragState;
|
this->DragState = DragState;
|
||||||
bool OpaqueUndocking = CDockManager::testConfigFlag(CDockManager::OpaqueUndocking) ||
|
bool CreateFloatingDockContainer = CDockManager::testConfigFlag(
|
||||||
(DraggingFloatingWidget != DragState);
|
CDockManager::OpaqueUndocking) || (DraggingFloatingWidget != DragState);
|
||||||
CFloatingDockContainer* FloatingDockContainer = nullptr;
|
CFloatingDockContainer* FloatingDockContainer = nullptr;
|
||||||
IFloatingWidget* FloatingWidget;
|
IFloatingWidget* FloatingWidget;
|
||||||
if (OpaqueUndocking)
|
if (CreateFloatingDockContainer)
|
||||||
{
|
{
|
||||||
|
if (DockArea->autoHideDockContainer())
|
||||||
|
{
|
||||||
|
DockArea->autoHideDockContainer()->cleanupAndDelete();
|
||||||
|
}
|
||||||
FloatingWidget = FloatingDockContainer = new CFloatingDockContainer(DockArea);
|
FloatingWidget = FloatingDockContainer = new CFloatingDockContainer(DockArea);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -297,7 +301,7 @@ IFloatingWidget* DockAreaTitleBarPrivate::makeAreaFloating(const QPoint& Offset,
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
void DockAreaTitleBarPrivate::startFloating(const QPoint& Offset)
|
void DockAreaTitleBarPrivate::startFloating(const QPoint& Offset)
|
||||||
{
|
{
|
||||||
if (DockArea->autoHideDockContainer() != nullptr)
|
if (DockArea->autoHideDockContainer())
|
||||||
{
|
{
|
||||||
DockArea->autoHideDockContainer()->hide();
|
DockArea->autoHideDockContainer()->hide();
|
||||||
}
|
}
|
||||||
@ -428,11 +432,6 @@ void CDockAreaTitleBar::onUndockButtonClicked()
|
|||||||
{
|
{
|
||||||
if (d->DockArea->features().testFlag(CDockWidget::DockWidgetFloatable))
|
if (d->DockArea->features().testFlag(CDockWidget::DockWidgetFloatable))
|
||||||
{
|
{
|
||||||
if (d->DockArea->autoHideDockContainer())
|
|
||||||
{
|
|
||||||
d->DockArea->autoHideDockContainer()->cleanupAndDelete();
|
|
||||||
}
|
|
||||||
|
|
||||||
d->makeAreaFloating(mapFromGlobal(QCursor::pos()), DraggingInactive);
|
d->makeAreaFloating(mapFromGlobal(QCursor::pos()), DraggingInactive);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -590,6 +589,10 @@ void CDockAreaTitleBar::mouseReleaseEvent(QMouseEvent* ev)
|
|||||||
if (ev->button() == Qt::LeftButton)
|
if (ev->button() == Qt::LeftButton)
|
||||||
{
|
{
|
||||||
ADS_PRINT("CDockAreaTitleBar::mouseReleaseEvent");
|
ADS_PRINT("CDockAreaTitleBar::mouseReleaseEvent");
|
||||||
|
if (CDockManager::testConfigFlag(CDockManager::OpaqueUndocking))
|
||||||
|
{
|
||||||
|
releaseMouse();
|
||||||
|
}
|
||||||
ev->accept();
|
ev->accept();
|
||||||
auto CurrentDragState = d->DragState;
|
auto CurrentDragState = d->DragState;
|
||||||
d->DragStartMousePos = QPoint();
|
d->DragStartMousePos = QPoint();
|
||||||
@ -650,6 +653,10 @@ void CDockAreaTitleBar::mouseMoveEvent(QMouseEvent* ev)
|
|||||||
d->startFloating(d->DragStartMousePos);
|
d->startFloating(d->DragStartMousePos);
|
||||||
auto Overlay = d->DockArea->dockManager()->containerOverlay();
|
auto Overlay = d->DockArea->dockManager()->containerOverlay();
|
||||||
Overlay->setAllowedAreas(OuterDockAreas);
|
Overlay->setAllowedAreas(OuterDockAreas);
|
||||||
|
if (CDockManager::testConfigFlag(CDockManager::OpaqueUndocking))
|
||||||
|
{
|
||||||
|
grabMouse();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -671,10 +678,6 @@ void CDockAreaTitleBar::mouseDoubleClickEvent(QMouseEvent *event)
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (d->DockArea->autoHideDockContainer())
|
|
||||||
{
|
|
||||||
d->DockArea->autoHideDockContainer()->cleanupAndDelete();
|
|
||||||
}
|
|
||||||
|
|
||||||
d->makeAreaFloating(event->pos(), DraggingInactive);
|
d->makeAreaFloating(event->pos(), DraggingInactive);
|
||||||
}
|
}
|
||||||
|
@ -392,6 +392,10 @@ void CDockWidgetTab::mouseReleaseEvent(QMouseEvent* ev)
|
|||||||
{
|
{
|
||||||
if (ev->button() == Qt::LeftButton)
|
if (ev->button() == Qt::LeftButton)
|
||||||
{
|
{
|
||||||
|
if (CDockManager::testConfigFlag(CDockManager::OpaqueUndocking))
|
||||||
|
{
|
||||||
|
releaseMouse();
|
||||||
|
}
|
||||||
auto CurrentDragState = d->DragState;
|
auto CurrentDragState = d->DragState;
|
||||||
d->GlobalDragStartMousePosition = QPoint();
|
d->GlobalDragStartMousePosition = QPoint();
|
||||||
d->DragStartMousePosition = QPoint();
|
d->DragStartMousePosition = QPoint();
|
||||||
@ -490,6 +494,10 @@ void CDockWidgetTab::mouseMoveEvent(QMouseEvent* ev)
|
|||||||
parentWidget()->layout()->update();
|
parentWidget()->layout()->update();
|
||||||
}
|
}
|
||||||
d->startFloating();
|
d->startFloating();
|
||||||
|
if (CDockManager::testConfigFlag(CDockManager::OpaqueUndocking))
|
||||||
|
{
|
||||||
|
grabMouse();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,8 @@
|
|||||||
#include <QStyle>
|
#include <QStyle>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#ifdef Q_OS_LINUX
|
#ifdef Q_OS_LINUX
|
||||||
#include <xcb/xcb.h>
|
#include <xcb/xcb.h>
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user