|
|
|
|
@ -309,9 +309,14 @@ void nmWxTimeDependentSkin::initUI()
|
|
|
|
|
splitter->setHandleWidth(1);
|
|
|
|
|
|
|
|
|
|
// 创建左侧区域(图表+下拉框)
|
|
|
|
|
QWidget* leftWidget = new QWidget();
|
|
|
|
|
QWidget* leftWidget = new QWidget(splitter);
|
|
|
|
|
QVBoxLayout* leftLayout = new QVBoxLayout(leftWidget);
|
|
|
|
|
|
|
|
|
|
// 将左侧布局留白让给图表标题,绘图区用相同宽度补偿,保持位置和大小。
|
|
|
|
|
int chartLeftExtension, topMargin, rightMargin, bottomMargin;
|
|
|
|
|
leftLayout->getContentsMargins(&chartLeftExtension, &topMargin, &rightMargin, &bottomMargin);
|
|
|
|
|
leftLayout->setContentsMargins(0, topMargin, rightMargin, bottomMargin);
|
|
|
|
|
|
|
|
|
|
// 创建图表区域容器
|
|
|
|
|
QWidget* chartWidget = new QWidget();
|
|
|
|
|
m_pChartLayout = new QVBoxLayout(chartWidget);
|
|
|
|
|
@ -325,6 +330,8 @@ void nmWxTimeDependentSkin::initUI()
|
|
|
|
|
|
|
|
|
|
// 创建压力图表
|
|
|
|
|
m_pPressureChart = new nmWxPressFlowChartWidget(m_pChartSplitter);
|
|
|
|
|
m_pPressureChart->setContentsMargins(chartLeftExtension, 0, 0, 0);
|
|
|
|
|
m_pPressureChart->setMinimumWidth(300 + chartLeftExtension);
|
|
|
|
|
m_pPressureChart->setCurrentWellData(m_currentWell);
|
|
|
|
|
m_pPressureChart->setAxisLabels(tr(""), tr("Pressure"));
|
|
|
|
|
m_pPressureChart->setAxisUnits(tr("hr"), tr("MPa"));
|
|
|
|
|
@ -335,6 +342,8 @@ void nmWxTimeDependentSkin::initUI()
|
|
|
|
|
|
|
|
|
|
// 创建流量图表
|
|
|
|
|
m_pFlowRateChart = new nmWxPressFlowChartWidget(m_pChartSplitter);
|
|
|
|
|
m_pFlowRateChart->setContentsMargins(chartLeftExtension, 0, 0, 0);
|
|
|
|
|
m_pFlowRateChart->setMinimumWidth(300 + chartLeftExtension);
|
|
|
|
|
m_pFlowRateChart->setCurrentWellData(m_currentWell);
|
|
|
|
|
m_pFlowRateChart->setAxisLabels(tr("Time"), tr("Flow"));
|
|
|
|
|
m_pFlowRateChart->setAxisUnits(tr("hr"), tr("m^3/D"));
|
|
|
|
|
@ -363,7 +372,13 @@ void nmWxTimeDependentSkin::initUI()
|
|
|
|
|
|
|
|
|
|
// 将图表和下拉框添加到左侧布局
|
|
|
|
|
leftLayout->addWidget(chartWidget, 1); // 图表占据大部分空间
|
|
|
|
|
leftLayout->addWidget(m_pComboBox); // 下拉框固定高度
|
|
|
|
|
// 下拉框仍使用原来的左边距,只有图表标题向左扩展。
|
|
|
|
|
QHBoxLayout* comboLayout = new QHBoxLayout();
|
|
|
|
|
comboLayout->setContentsMargins(0, 0, 0, 0);
|
|
|
|
|
comboLayout->addSpacing(chartLeftExtension);
|
|
|
|
|
comboLayout->addWidget(m_pComboBox);
|
|
|
|
|
comboLayout->addStretch();
|
|
|
|
|
leftLayout->addLayout(comboLayout);
|
|
|
|
|
|
|
|
|
|
// 创建中间区域(表格+确定取消按钮)
|
|
|
|
|
QWidget* middleWidget = new QWidget();
|
|
|
|
|
@ -923,7 +938,14 @@ void nmWxTimeDependentSkin::showInteractiveChart()
|
|
|
|
|
|
|
|
|
|
// 创建交互式图表widget
|
|
|
|
|
m_pChartWidget = new nmWxChartWidget(this);
|
|
|
|
|
m_pChartWidget->setMinimumSize(400, 400);
|
|
|
|
|
// 切换模式后沿用压力图的左侧扩展宽度,保持绘图区位置不变。
|
|
|
|
|
const int chartLeftExtension = m_pPressureChart->contentsMargins().left();
|
|
|
|
|
// 将图表与下拉框之间的空白交给横轴标题,绘图区补偿相同高度。
|
|
|
|
|
QLayout* leftLayout = m_pComboBox->parentWidget()->layout();
|
|
|
|
|
const int chartBottomExtension = qMax(0, leftLayout->spacing());
|
|
|
|
|
leftLayout->setSpacing(0);
|
|
|
|
|
m_pChartWidget->setContentsMargins(chartLeftExtension, 0, 0, chartBottomExtension);
|
|
|
|
|
m_pChartWidget->setMinimumSize(400 + chartLeftExtension, 400 + chartBottomExtension);
|
|
|
|
|
|
|
|
|
|
// 连接信号槽
|
|
|
|
|
connect(m_pChartWidget, SIGNAL(skinValuesChanged(double, double)),
|
|
|
|
|
@ -1089,6 +1111,8 @@ void nmWxTimeDependentSkin::restoreOriginalCharts()
|
|
|
|
|
|
|
|
|
|
// 移除交互式图表
|
|
|
|
|
if(m_pChartWidget != nullptr) {
|
|
|
|
|
// 切回压力/流量图时恢复原来的布局间距。
|
|
|
|
|
m_pComboBox->parentWidget()->layout()->setSpacing(m_pChartWidget->contentsMargins().bottom());
|
|
|
|
|
m_pChartLayout->removeWidget(m_pChartWidget);
|
|
|
|
|
m_pChartWidget->deleteLater();
|
|
|
|
|
m_pChartWidget = nullptr;
|
|
|
|
|
|