diff options
author | Henning Gruendl <henning.gruendl@qt.io> | 2020-03-09 08:25:03 +0100 |
---|---|---|
committer | Thomas Hartmann <thomas.hartmann@qt.io> | 2020-03-09 14:28:08 +0000 |
commit | 74eaa8f8832692cbd80e60754ecd85436e957cdd (patch) | |
tree | a907c327743fff23774c235be9bc7ccb6876407b /src/libs | |
parent | aaa9a5151198fefb63fdcfe9c56cbed5ea51e0cc (diff) |
ADS: Integrate newest base repository commits
f3c5d5138024acfb0991fa1794da70a19240c820
fe10b570d3c17eaaf7c4c67e4cf7d56550e6e9e4
4cb1931acec0ce21e0ebc38742b3d4f1c066e368
59c783831ad23238e41205a5da854a9eb39ce777
- Fix reception of escape key press events
- Fix display of container dock overlay
- Fix comments
Change-Id: I34387046335b3d57434decd5714da7ae307bcc05
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Diffstat (limited to 'src/libs')
-rw-r--r-- | src/libs/advanceddockingsystem/dockmanager.h | 8 | ||||
-rw-r--r-- | src/libs/advanceddockingsystem/floatingdragpreview.cpp | 16 |
2 files changed, 17 insertions, 7 deletions
diff --git a/src/libs/advanceddockingsystem/dockmanager.h b/src/libs/advanceddockingsystem/dockmanager.h index a987a1977b..506335714e 100644 --- a/src/libs/advanceddockingsystem/dockmanager.h +++ b/src/libs/advanceddockingsystem/dockmanager.h @@ -151,8 +151,8 @@ public: using Super = DockContainerWidget; /** - * These global configuration flags configure some global dock manager - * settings. + * These global configuration flags configure some global dock manager settings. + * Set the dock manager flags, before you create the dock manager instance. */ enum eConfigFlag { ActiveTabHasCloseButton @@ -238,12 +238,14 @@ public: /** * Sets the global configuration flags for the whole docking system. - * Call this function before you create your first dock widget. + * Call this function before you create the dock manager and before + * your create the first dock widget. */ static void setConfigFlags(const ConfigFlags flags); /** * Set a certain config flag + * \see setConfigFlags() */ static void setConfigFlag(eConfigFlag flag, bool on = true); diff --git a/src/libs/advanceddockingsystem/floatingdragpreview.cpp b/src/libs/advanceddockingsystem/floatingdragpreview.cpp index 33e0a5ac34..5732ae408e 100644 --- a/src/libs/advanceddockingsystem/floatingdragpreview.cpp +++ b/src/libs/advanceddockingsystem/floatingdragpreview.cpp @@ -68,6 +68,7 @@ namespace ADS DockContainerWidget *m_dropContainer = nullptr; bool m_hidden = false; QPixmap m_contentPreviewPixmap; + bool m_canceled = false; /** * Private data constructor @@ -86,6 +87,7 @@ namespace ADS */ void cancelDragging() { + m_canceled = true; emit q->draggingCanceled(); m_dockManager->containerOverlay()->hideOverlay(); m_dockManager->dockAreaOverlay()->hideOverlay(); @@ -149,6 +151,12 @@ namespace ADS } } else { dockAreaOverlay->hideOverlay(); + // If there is only one single visible dock area in a container, then + // it does not make sense to show a dock overlay because the dock area + // would be removed and inserted at the same position + if (visibleDockAreas <= 1) + containerOverlay->hide(); + if (dockArea == m_contentSourceArea && InvalidDockWidgetArea == containerDropArea) m_dropContainer = nullptr; } @@ -195,9 +203,9 @@ namespace ADS &QApplication::applicationStateChanged, this, &FloatingDragPreview::onApplicationStateChanged); - // The focused object will receive key press events and therefore we install - // the event filter on it to receive escape key press for drag canceling - QApplication::focusObject()->installEventFilter(this); + // The only safe way to receive escape key presses is to install an event + // filter for the application object + QApplication::instance()->installEventFilter(this); } FloatingDragPreview::FloatingDragPreview(DockWidget *content) @@ -329,7 +337,7 @@ namespace ADS bool FloatingDragPreview::eventFilter(QObject *watched, QEvent *event) { - if (event->type() == QEvent::KeyPress) { + if (!d->m_canceled && event->type() == QEvent::KeyPress) { QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event); if (keyEvent->key() == Qt::Key_Escape) { watched->removeEventFilter(this); |