2025-09-05 17:30:07 +08:00
|
|
|
#include "diagramEditor/diagramEditorPreviewDlg.h"
|
|
|
|
|
#include "diagramEditor/editView.h"
|
|
|
|
|
#include "diagramEditor/editScene.h"
|
|
|
|
|
#include "graphicsDataModel/diagramEditorModel.h"
|
|
|
|
|
#include "diagramEditor/editPanel.h"
|
|
|
|
|
#include "global.h"
|
|
|
|
|
|
|
|
|
|
DiagramEditorPreviewDlg::DiagramEditorPreviewDlg(QWidget *parent)
|
|
|
|
|
: QDialog(parent)
|
|
|
|
|
,_pView(nullptr)
|
|
|
|
|
,_pScene(nullptr)
|
|
|
|
|
,_pMainLayout(nullptr)
|
|
|
|
|
,_pParent(nullptr)
|
|
|
|
|
{
|
|
|
|
|
auto pParent = dynamic_cast<EditPanel*>(parent);
|
|
|
|
|
if(pParent)
|
|
|
|
|
setParent(pParent);
|
|
|
|
|
QRect recParent = parent->geometry();
|
|
|
|
|
setGeometry(recParent.right(),recParent.y(),recParent.width(),recParent.height());
|
|
|
|
|
initial();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DiagramEditorPreviewDlg::~DiagramEditorPreviewDlg()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DiagramEditorPreviewDlg::initial()
|
|
|
|
|
{
|
|
|
|
|
_pMainLayout = new QVBoxLayout(this);
|
|
|
|
|
_pView = new EditView(this);
|
|
|
|
|
_pMainLayout->addWidget(_pView);
|
2025-09-12 17:28:47 +08:00
|
|
|
_pScene = new EditScene(this);
|
2025-09-05 17:30:07 +08:00
|
|
|
_pScene->setSceneRect(_pParent->getScene()->sceneRect()); //使用父窗口scene大小
|
|
|
|
|
_pView->setScene(_pScene);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DiagramEditorPreviewDlg::showDlg()
|
|
|
|
|
{
|
|
|
|
|
if(_pParent){
|
|
|
|
|
_pParent->getModel()->setCurPreviewScene(_pScene);
|
|
|
|
|
}
|
|
|
|
|
show();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|