From 9f54bc5ff12191196e982fb4924df0f2d862c9f9 Mon Sep 17 00:00:00 2001 From: codeboss <2422523675@qq.com> Date: Thu, 8 Feb 2024 22:13:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=8B=96=E5=8A=A8=E6=97=B6?= =?UTF-8?q?=E6=B8=B2=E6=9F=93=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libSplitView/acceptpanel.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/libSplitView/acceptpanel.cpp b/libSplitView/acceptpanel.cpp index dd53e71..69b1bb7 100644 --- a/libSplitView/acceptpanel.cpp +++ b/libSplitView/acceptpanel.cpp @@ -14,10 +14,18 @@ accept_panel::AcceptPanel::AcceptPanel(QMainWindow *win, split_frame::ResManager void accept_panel::AcceptPanel::bindWith(split_frame::ViewBase *target) { - this->setParent(target->widget()); + if (target) { + this->setParent(target->widget()); + + if(this->anchor_view != target || this->paint_panel.rect() != target->widget()->rect()){ + this->paint_panel = target->widget()->grab(); + } + this->setGeometry(QRect(QPoint(), target->widget()->size())); + } + else { + this->setParent(bind_win); + } this->anchor_view = target; - this->paint_panel = this->anchor_view->widget()->grab(); - this->setGeometry(QRect(QPoint(), target->widget()->size())); } void accept_panel::AcceptPanel::resizeEvent(QResizeEvent *ev) @@ -35,6 +43,7 @@ void accept_panel::AcceptPanel::resizeEvent(QResizeEvent *ev) this->target_type = HoverType::CUBE_UNDEFINED; } +#include void accept_panel::AcceptPanel::paintEvent(QPaintEvent *ev) { QWidget::paintEvent(ev); @@ -133,7 +142,7 @@ void accept_panel::AcceptPanel::dropEvent(QDropEvent *ev) target_type = HoverType::CUBE_UNDEFINED; } - this->setParent(bind_win); + this->bindWith(nullptr); }