#include "nmWxWellLayerDlg.h" #include #include #include #include #include //#include "nmGUIComponentBase.h" Q_DECLARE_METATYPE(double *) nmWxWellLayerDlg::nmWxWellLayerDlg(QVector *vLayerHeights): m_vLayerHeights(vLayerHeights) { this->initLayerHeights(); this->initUI(); this->setWindowTitle(tr("layer setting")); this->resize(540, 180); } void nmWxWellLayerDlg::initUI() { QVBoxLayout* mainLayout = new QVBoxLayout; this->setLayout(mainLayout); // 设置内容区域 QVariant pValue = QVariant::fromValue(&((*m_vLayerHeights)[0])); // nmGUIComponentBase * contentCom = new nmGUIComponentBase(tr("LayerHeight: "), pValue, NM_GUI_Component_Value_Type_Double, tr("m")); // mainLayout->addWidget(contentCom); // 底部按钮 QHBoxLayout* hLayout = new QHBoxLayout; QPushButton* saveBT = new QPushButton(tr("Save")); QPushButton* cancelBT = new QPushButton(tr("Cancel")); connect(saveBT, SIGNAL(clicked()), this, SLOT(accept())); connect(cancelBT, SIGNAL(clicked()), this, SLOT(reject())); hLayout->addStretch(); hLayout->addWidget(saveBT); hLayout->addWidget(cancelBT); mainLayout->addLayout(hLayout); } void nmWxWellLayerDlg::initLayerHeights() { if (m_vLayerHeights != nullptr) { if (m_vLayerHeights->size() == 0) { m_vLayerHeights->append(30.48); } } } void nmWxWellLayerDlg::on_layerHeightChanged(QString v) { if (m_vLayerHeights != nullptr) { m_vLayerHeights->clear(); m_vLayerHeights->append(v.toDouble()); } }