#include "diagramEditor/diagramEditorBayPreviewDlg.h" #include "diagramEditor/diagramEditorBayDetailSettingDlg.h" #include "diagramEditor/editView.h" #include "diagramEditor/editScene.h" #include "graphicsDataModel/diagramEditorModel.h" //#include "global.h" #include "common/core_model/constants.h" DiagramEditorBayPreviewDlg::DiagramEditorBayPreviewDlg(QWidget *parent) : QDialog(parent) ,_pView(nullptr) ,_pScene(nullptr) ,_pMainLayout(nullptr) ,_pParent(nullptr) { this->setWindowFlags(Qt::FramelessWindowHint | windowFlags()); QRect recParent = parent->geometry(); setGeometry(recParent.right(),recParent.y(),recParent.width(),recParent.height()); initial(); } DiagramEditorBayPreviewDlg::~DiagramEditorBayPreviewDlg() { } void DiagramEditorBayPreviewDlg::initial() { _pMainLayout = new QVBoxLayout(this); _pView = new EditView(this); _pView->scale(0.5,0.5); //缩放为一半 _pMainLayout->addWidget(_pView); _pScene = new EditPreviewScene(this); _pScene->setSceneRect(-Constants::SCENE_WIDTH / 2, -Constants::SCENE_HEIGHT / 2, Constants::SCENE_WIDTH, Constants::SCENE_HEIGHT); //初始大小 _pView->setScene(_pScene); } void DiagramEditorBayPreviewDlg::showDlg(int nLayout) { if(_pParent){ _pParent->getModel()->setCurPreviewScene(_pScene); } //show(); int nDir = 0; if(nLayout == 0){ //纵,下右 nDir = 41; } else if(nLayout == 1){ //横,右下 nDir = 14; } _pParent->getModel()->clearCompoDir(_pParent->getBayInfo().mapRoute,_pParent->getBayInfo().mapComponent,0); _pParent->getModel()->updateTarget(_pParent->getBayInfo().mapRoute,_pParent->getBayInfo().mapComponent,nDir,0); } void DiagramEditorBayPreviewDlg::setSceneRect(const QRect rec) { if(_pScene) _pScene->setSceneRect(-rec.width()*0.5,-rec.height()*0.5,rec.width(),rec.height()); }