From e2bafb16fbd2caf6c8ff53a5ebdf73b2d1d35a3b Mon Sep 17 00:00:00 2001 From: codeboss <2422523675@qq.com> Date: Thu, 8 Feb 2024 23:14:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=BA=E5=8C=96=E6=8B=96=E6=8B=BD=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libSplitView/dockpanel.cpp | 4 +++- libSplitView/splitwindow.cpp | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/libSplitView/dockpanel.cpp b/libSplitView/dockpanel.cpp index 7856014..087f860 100644 --- a/libSplitView/dockpanel.cpp +++ b/libSplitView/dockpanel.cpp @@ -69,7 +69,9 @@ void DragHeader::mouseReleaseEvent(QMouseEvent *event) void DragHeader::mouseMoveEvent(QMouseEvent *event) { QFrame::mouseMoveEvent(event); - if(std::get<0>(this->press_flag)){ + auto sub = event->pos() - std::get<1>(press_flag); + + if(std::get<0>(this->press_flag) && sub.manhattanLength() > QApplication::startDragDistance()){ emit this->adjustRequest(event->pos()); } } diff --git a/libSplitView/splitwindow.cpp b/libSplitView/splitwindow.cpp index b984301..5e1549c 100644 --- a/libSplitView/splitwindow.cpp +++ b/libSplitView/splitwindow.cpp @@ -119,6 +119,7 @@ void SplitWindow::present_remove(split_frame::ViewRes *inst) } else if(inst == view_root){ setRoot(nullptr); + inst->setParentRes(nullptr); } } void SplitWindow::doRetrieve(split_frame::ViewBase *inst) @@ -150,10 +151,10 @@ void SplitWindow::doClose(split_frame::ViewBase *inst) void SplitWindow::siblingAttach(ViewBase *view, ViewRes *pos, SplitType ori) { + auto remains_frm = pos->parentRes(); doRetrieve(view); auto split_slot = new split_panel::SplitPanel(this, ori); - auto remains_frm = pos->parentRes(); remains_frm->replaceView(split_slot, pos); switch (ori) {