#include "PaneDragController.h" using namespace Qt::Literals::StringLiterals; PaneDragController::PaneDragController(QObject* parent) : QObject(parent) { } AppModel* PaneDragController::model() const { return m_model; } void PaneDragController::setModel(AppModel* model) { if (m_model == model) { return; } m_model = model; emit modelChanged(); } QString PaneDragController::classifyZone(const qreal nx, const qreal ny) { if (nx < 1.0 / 3.0) { return u"left"_s; } if (nx > 2.0 / 3.0) { return u"right"_s; } if (ny < 1.0 / 3.0) { return u"up"_s; } if (ny > 2.0 / 3.0) { return u"down"_s; } return u"center"_s; } void PaneDragController::executeDrop(const QString& draggedPaneId, const QString& targetPaneId, const QString& zone) const { if (m_model == nullptr || draggedPaneId.isEmpty() || targetPaneId.isEmpty() || zone.isEmpty()) { return; } if (zone == u"center"_s) { m_model->swapPanes(draggedPaneId, targetPaneId); } else { m_model->movePaneBeside(draggedPaneId, targetPaneId, zone); } }