From ea587608cbf18d35f3df3f30ca89fe4105dc6932 Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 10 Oct 2016 18:50:11 +0200 Subject: [PATCH] Don't allow dropping dockables onto the tabs where textures sit --- .../3rdparty/toolwindowmanager/ToolWindowManager.cpp | 2 +- .../3rdparty/toolwindowmanager/ToolWindowManagerArea.cpp | 1 + .../3rdparty/toolwindowmanager/ToolWindowManagerArea.h | 7 +++++++ qrenderdoc/Windows/TextureViewer.cpp | 2 ++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/qrenderdoc/3rdparty/toolwindowmanager/ToolWindowManager.cpp b/qrenderdoc/3rdparty/toolwindowmanager/ToolWindowManager.cpp index 2cfbad0e9..9ccf09a16 100644 --- a/qrenderdoc/3rdparty/toolwindowmanager/ToolWindowManager.cpp +++ b/qrenderdoc/3rdparty/toolwindowmanager/ToolWindowManager.cpp @@ -656,7 +656,7 @@ void ToolWindowManager::findSuggestions(ToolWindowManagerWrapper* wrapper) { m_suggestions << AreaReference(side, widget); } } - if (area && area->rect().contains(area->mapFromGlobal(globalPos))) { + if (area && area->allowUserDrop() && area->rect().contains(area->mapFromGlobal(globalPos))) { m_suggestions << AreaReference(AddTo, area); } } diff --git a/qrenderdoc/3rdparty/toolwindowmanager/ToolWindowManagerArea.cpp b/qrenderdoc/3rdparty/toolwindowmanager/ToolWindowManagerArea.cpp index f7e7ef0bb..251d78b2c 100644 --- a/qrenderdoc/3rdparty/toolwindowmanager/ToolWindowManagerArea.cpp +++ b/qrenderdoc/3rdparty/toolwindowmanager/ToolWindowManagerArea.cpp @@ -35,6 +35,7 @@ ToolWindowManagerArea::ToolWindowManagerArea(ToolWindowManager *manager, QWidget m_dragCanStart = false; m_tabDragCanStart = false; m_inTabMoved = false; + m_userCanDrop = true; setMovable(true); setTabsClosable(true); setDocumentMode(true); diff --git a/qrenderdoc/3rdparty/toolwindowmanager/ToolWindowManagerArea.h b/qrenderdoc/3rdparty/toolwindowmanager/ToolWindowManagerArea.h index d87789a5e..ca474f203 100644 --- a/qrenderdoc/3rdparty/toolwindowmanager/ToolWindowManagerArea.h +++ b/qrenderdoc/3rdparty/toolwindowmanager/ToolWindowManagerArea.h @@ -52,6 +52,11 @@ public: */ void addToolWindows(const QList& toolWindows); + void enableUserDrop() { m_userCanDrop = true; } + void disableUserDrop() { m_userCanDrop = false; } + + bool allowUserDrop() { return m_userCanDrop; } + /*! * Returns a list of all tool windows in this area. */ @@ -84,6 +89,8 @@ private: // that can be considered as dragging current tab // if the cursor will leave the tab bar area + bool m_userCanDrop; // indictes the user is allowed to drop things on this area + bool m_inTabMoved; // if we're in the tabMoved() function (so if we call tabMove to cancel // the movement, we shouldn't re-check the tabMoved behaviour) diff --git a/qrenderdoc/Windows/TextureViewer.cpp b/qrenderdoc/Windows/TextureViewer.cpp index e6c12893a..1e3a767f1 100644 --- a/qrenderdoc/Windows/TextureViewer.cpp +++ b/qrenderdoc/Windows/TextureViewer.cpp @@ -1463,6 +1463,8 @@ void TextureViewer::SetupTextureTabs() &TextureViewer::textureTab_Changed); QObject::connect(textureTabs, &QTabWidget::tabCloseRequested, this, &TextureViewer::textureTab_Closing); + + textureTabs->disableUserDrop(); } void TextureViewer::textureTab_Changed(int index)