|
|
|
|
@ -64,7 +64,13 @@ void nmWxPebiGridViewWidget::createUi()
|
|
|
|
|
pMainLayout->setContentsMargins(0, 0, 0, 0);
|
|
|
|
|
pMainLayout->setSpacing(0);
|
|
|
|
|
|
|
|
|
|
m_pRenderContainer = new nmWxVTKRenderContainerWidget(this);
|
|
|
|
|
// 绘图区单独使用水平布局,渲染容器伸展,竖向工具栏固定在右侧。
|
|
|
|
|
QWidget* pRenderArea = new QWidget(this);
|
|
|
|
|
QHBoxLayout* pRenderLayout = new QHBoxLayout(pRenderArea);
|
|
|
|
|
pRenderLayout->setContentsMargins(0, 0, 0, 0);
|
|
|
|
|
pRenderLayout->setSpacing(0);
|
|
|
|
|
|
|
|
|
|
m_pRenderContainer = new nmWxVTKRenderContainerWidget(pRenderArea);
|
|
|
|
|
m_pRenderContainer->setSizePolicy(
|
|
|
|
|
QSizePolicy::Expanding, QSizePolicy::Expanding);
|
|
|
|
|
m_pRenderContainer->setViewCommandCapabilities(
|
|
|
|
|
@ -77,18 +83,16 @@ void nmWxPebiGridViewWidget::createUi()
|
|
|
|
|
nmVTKViewCommandController::ViewCommand_Print |
|
|
|
|
|
nmVTKViewCommandController::ViewCommand_PrintPreview);
|
|
|
|
|
|
|
|
|
|
m_pToolBar = new QToolBar(this);
|
|
|
|
|
m_pToolBar = new QToolBar(pRenderArea);
|
|
|
|
|
m_pToolBar->setOrientation(Qt::Vertical);
|
|
|
|
|
m_pToolBar->setMovable(false);
|
|
|
|
|
m_pToolBar->setFloatable(false);
|
|
|
|
|
m_pToolBar->setIconSize(QSize(20, 20));
|
|
|
|
|
m_pToolBar->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
|
|
|
|
pMainLayout->addWidget(m_pToolBar);
|
|
|
|
|
m_pToolBar->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
|
|
|
|
|
|
|
|
|
|
nmVTKViewCommandController* pCommandController =
|
|
|
|
|
m_pRenderContainer->getViewCommandController();
|
|
|
|
|
if(pCommandController != NULL) {
|
|
|
|
|
pCommandController->populateToolBar(m_pToolBar);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 三个业务 QAction 与公共命令一样长期持有,并同时用于工具栏和右键菜单。
|
|
|
|
|
m_pGridLinesAction = new QAction(
|
|
|
|
|
@ -107,23 +111,48 @@ void nmWxPebiGridViewWidget::createUi()
|
|
|
|
|
m_pBoundsGridAction->setToolTip(tr("Coordinate Grid"));
|
|
|
|
|
m_pBoundsGridAction->setCheckable(true);
|
|
|
|
|
|
|
|
|
|
QAction* pCopyAction = pCommandController != NULL
|
|
|
|
|
? pCommandController->getAction(
|
|
|
|
|
nmVTKViewCommandController::ViewCommand_CopyImage)
|
|
|
|
|
: NULL;
|
|
|
|
|
if(pCopyAction != NULL) {
|
|
|
|
|
// 公共控制器已放置复制动作,在它之前插入业务组即可得到约定顺序。
|
|
|
|
|
m_pToolBar->insertAction(pCopyAction, m_pGridLinesAction);
|
|
|
|
|
m_pToolBar->insertAction(pCopyAction, m_pScalarBarAction);
|
|
|
|
|
m_pToolBar->insertAction(pCopyAction, m_pBoundsGridAction);
|
|
|
|
|
m_pToolBar->insertSeparator(pCopyAction);
|
|
|
|
|
} else {
|
|
|
|
|
if(pCommandController != NULL) {
|
|
|
|
|
// 网格视图按自身工作流排序,但仍引用命令控制器持有的公共 QAction。
|
|
|
|
|
QAction* pZoomOutAction = pCommandController->getAction(
|
|
|
|
|
nmVTKViewCommandController::ViewCommand_ZoomOut);
|
|
|
|
|
QAction* pFitAction = pCommandController->getAction(
|
|
|
|
|
nmVTKViewCommandController::ViewCommand_Fit);
|
|
|
|
|
QAction* pZoomInAction = pCommandController->getAction(
|
|
|
|
|
nmVTKViewCommandController::ViewCommand_ZoomIn);
|
|
|
|
|
QAction* pTopAction = pCommandController->getAction(
|
|
|
|
|
nmVTKViewCommandController::ViewCommand_Top);
|
|
|
|
|
QAction* pCopyAction = pCommandController->getAction(
|
|
|
|
|
nmVTKViewCommandController::ViewCommand_CopyImage);
|
|
|
|
|
if(pZoomOutAction != NULL) {
|
|
|
|
|
m_pToolBar->addAction(pZoomOutAction);
|
|
|
|
|
}
|
|
|
|
|
if(pFitAction != NULL) {
|
|
|
|
|
m_pToolBar->addAction(pFitAction);
|
|
|
|
|
}
|
|
|
|
|
if(pZoomInAction != NULL) {
|
|
|
|
|
m_pToolBar->addAction(pZoomInAction);
|
|
|
|
|
}
|
|
|
|
|
if(pTopAction != NULL) {
|
|
|
|
|
m_pToolBar->addAction(pTopAction);
|
|
|
|
|
}
|
|
|
|
|
m_pToolBar->addSeparator();
|
|
|
|
|
m_pToolBar->addAction(m_pGridLinesAction);
|
|
|
|
|
m_pToolBar->addAction(m_pScalarBarAction);
|
|
|
|
|
m_pToolBar->addAction(m_pBoundsGridAction);
|
|
|
|
|
m_pToolBar->addSeparator();
|
|
|
|
|
if(pCopyAction != NULL) {
|
|
|
|
|
m_pToolBar->addAction(pCopyAction);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// 理论上不会进入;仍保留业务动作,避免容器初始化异常时布局跳动。
|
|
|
|
|
m_pToolBar->addAction(m_pGridLinesAction);
|
|
|
|
|
m_pToolBar->addAction(m_pScalarBarAction);
|
|
|
|
|
m_pToolBar->addAction(m_pBoundsGridAction);
|
|
|
|
|
}
|
|
|
|
|
pMainLayout->addWidget(m_pRenderContainer, 1);
|
|
|
|
|
|
|
|
|
|
pRenderLayout->addWidget(m_pRenderContainer, 1);
|
|
|
|
|
pRenderLayout->addWidget(m_pToolBar);
|
|
|
|
|
pMainLayout->addWidget(pRenderArea, 1);
|
|
|
|
|
|
|
|
|
|
m_pStatusLabel = new QLabel(this);
|
|
|
|
|
m_pStatusLabel->setWordWrap(true);
|
|
|
|
|
|