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); }