-
Notifications
You must be signed in to change notification settings - Fork 681
Unbind containers from DockManager to prevent accidental reuse #823
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -86,6 +86,9 @@ class ADS_EXPORT CDockContainerWidget : public QFrame | |
| friend AutoHideDockContainerPrivate; | ||
| friend CAutoHideSideBar; | ||
|
|
||
| private Q_SLOTS: | ||
| void removeFromDockManager(); | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Name may be realigned with |
||
|
|
||
| protected: | ||
| /** | ||
| * Handles activation events to update zOrderIndex | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -370,14 +370,14 @@ struct FloatingDockContainerPrivate | |
| eDragState DraggingState = DraggingInactive; | ||
| QPoint DragStartMousePosition; | ||
| CDockContainerWidget *DropContainer = nullptr; | ||
| CDockAreaWidget *SingleDockArea = nullptr; | ||
| QPoint DragStartPos; | ||
| bool Hiding = false; | ||
| bool AutoHideChildren = true; | ||
| bool HideContentOnNextHide = false; | ||
| #if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) | ||
| QWidget* MouseEventHandler = nullptr; | ||
| CFloatingWidgetTitleBar* TitleBar = nullptr; | ||
| CDockAreaWidget *SingleDockArea = nullptr; | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. bbde511 had introduced inconsistent line endings. This repository does not appear to be using AUTOCLRF nor specify |
||
| QPoint DragStartPos; | ||
| bool Hiding = false; | ||
| bool AutoHideChildren = true; | ||
| bool HideContentOnNextHide = false; | ||
| #if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) | ||
| QWidget* MouseEventHandler = nullptr; | ||
| CFloatingWidgetTitleBar* TitleBar = nullptr; | ||
| bool IsResizing = false; | ||
| bool MousePressed = false; | ||
| #endif | ||
|
|
@@ -500,6 +500,9 @@ void FloatingDockContainerPrivate::titleMouseReleaseEvent() | |
| return; | ||
| } | ||
|
|
||
| // DockManager will be unlinked from this within DropContainer->dropFloatingWidget | ||
| const auto OriginalDockManager = this->DockManager.data(); | ||
|
|
||
| if (DockManager->dockAreaOverlay()->dropAreaUnderCursor() != InvalidDockWidgetArea | ||
| || DockManager->containerOverlay()->dropAreaUnderCursor() != InvalidDockWidgetArea) | ||
| { | ||
|
|
@@ -533,8 +536,8 @@ void FloatingDockContainerPrivate::titleMouseReleaseEvent() | |
| DropContainer->dropFloatingWidget(_this, QCursor::pos()); | ||
| } | ||
|
|
||
| DockManager->containerOverlay()->hideOverlay(); | ||
| DockManager->dockAreaOverlay()->hideOverlay(); | ||
| OriginalDockManager->containerOverlay()->hideOverlay(); | ||
| OriginalDockManager->dockAreaOverlay()->hideOverlay(); | ||
| } | ||
|
|
||
|
|
||
|
|
@@ -928,11 +931,11 @@ bool CFloatingDockContainer::nativeEvent(const QByteArray &eventType, void *mess | |
|
|
||
|
|
||
| //============================================================================ | ||
| void CFloatingDockContainer::closeEvent(QCloseEvent *event) | ||
| { | ||
| ADS_PRINT("CFloatingDockContainer closeEvent"); | ||
| d->setState(DraggingInactive); | ||
| event->ignore(); | ||
| void CFloatingDockContainer::closeEvent(QCloseEvent *event) | ||
| { | ||
| ADS_PRINT("CFloatingDockContainer closeEvent"); | ||
| d->setState(DraggingInactive); | ||
| event->ignore(); | ||
| if (!isClosable()) | ||
| { | ||
| return; | ||
|
|
@@ -960,55 +963,55 @@ void CFloatingDockContainer::closeEvent(QCloseEvent *event) | |
| return; | ||
| } | ||
|
|
||
| // New bug (QWebEngineView reload side effect): | ||
| // when a WebEngine-based dock is tabified into a floating container, the | ||
| // embedded native/web process can trigger delayed hide/show cycles on the | ||
| // floating window. If every non-spontaneous hide propagates to | ||
| // DockWidget->toggleView(false), unrelated tabs are marked closed and seem | ||
| // New bug (QWebEngineView reload side effect): | ||
| // when a WebEngine-based dock is tabified into a floating container, the | ||
| // embedded native/web process can trigger delayed hide/show cycles on the | ||
| // floating window. If every non-spontaneous hide propagates to | ||
| // DockWidget->toggleView(false), unrelated tabs are marked closed and seem | ||
| // to "disappear". We therefore arm HideContentOnNextHide only for the | ||
| // explicit close path. | ||
| d->HideContentOnNextHide = true; | ||
| // explicit close path. | ||
| d->HideContentOnNextHide = true; | ||
|
|
||
| // In Qt version after 5.9.2 there seems to be a bug that causes the | ||
| // QWidget::event() function to not receive any NonClientArea mouse | ||
| // events anymore after a close/show cycle. The bug is reported here: | ||
| // https://bugreports.qt.io/browse/QTBUG-73295 | ||
| // The following code is a workaround for Qt versions > 5.9.2 that seems | ||
| // to work | ||
| // Starting from Qt version 5.12.2 this seems to work again. But | ||
| // now the QEvent::NonClientAreaMouseButtonPress function returns always | ||
| // Qt::RightButton even if the left button was pressed | ||
| this->hide(); | ||
| } | ||
|
|
||
| //============================================================================ | ||
| void CFloatingDockContainer::hideEvent(QHideEvent *event) | ||
| { | ||
| Super::hideEvent(event); | ||
| if (event->spontaneous()) | ||
| { | ||
| return; | ||
| } | ||
| // Starting from Qt version 5.12.2 this seems to work again. But | ||
| // now the QEvent::NonClientAreaMouseButtonPress function returns always | ||
| // Qt::RightButton even if the left button was pressed | ||
| this->hide(); | ||
| } | ||
| //============================================================================ | ||
| void CFloatingDockContainer::hideEvent(QHideEvent *event) | ||
| { | ||
| Super::hideEvent(event); | ||
| if (event->spontaneous()) | ||
| { | ||
| return; | ||
| } | ||
|
|
||
| // Prevent toogleView() events during restore state | ||
| if (d->DockManager->isRestoringState()) | ||
| { | ||
| return; | ||
| } | ||
|
|
||
| // Only a close operation should propagate hide->toggleView(false) to | ||
| // child dock widgets. Generic hide/show cycles (e.g. from platform or | ||
| // embedded native content) must not change dock open/closed state. | ||
| if (!d->HideContentOnNextHide) | ||
| { | ||
| return; | ||
| } | ||
| d->HideContentOnNextHide = false; | ||
|
|
||
| if ( d->AutoHideChildren ) | ||
| { | ||
| d->Hiding = true; | ||
| for ( auto DockArea : d->DockContainer->openedDockAreas() ) | ||
| if (d->DockManager->isRestoringState()) | ||
| { | ||
| return; | ||
| } | ||
| // Only a close operation should propagate hide->toggleView(false) to | ||
| // child dock widgets. Generic hide/show cycles (e.g. from platform or | ||
| // embedded native content) must not change dock open/closed state. | ||
| if (!d->HideContentOnNextHide) | ||
| { | ||
| return; | ||
| } | ||
| d->HideContentOnNextHide = false; | ||
| if ( d->AutoHideChildren ) | ||
| { | ||
| d->Hiding = true; | ||
| for ( auto DockArea : d->DockContainer->openedDockAreas() ) | ||
| { | ||
| for ( auto DockWidget : DockArea->openedDockWidgets() ) | ||
| { | ||
|
|
@@ -1220,8 +1223,9 @@ void CFloatingDockContainer::finishDropOperation() | |
| if (d->DockManager) | ||
| { | ||
| d->DockManager->removeFloatingWidget(this); | ||
| d->DockManager->removeDockContainer(this->dockContainer()); | ||
| d->DockManager.clear(); | ||
| } | ||
| this->dockContainer()->removeFromDockManager(); | ||
| } | ||
|
|
||
| //============================================================================ | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hideAndDeleteLaterhas been recently renamed tofinishDropOperation, but its functionality isn't just required for drop-operations.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably should be renamed to
close()orteardown().