You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
2.0 KiB
C++
64 lines
2.0 KiB
C++
#include "nmWxSelectWellsDlg.h"
|
|
|
|
#include "ZxBaseUtil.h"
|
|
|
|
#include <QDialogButtonBox>
|
|
#include <QHBoxLayout>
|
|
#include <QPushButton>
|
|
#include <QVBoxLayout>
|
|
|
|
nmWxSelectWellsDlg::nmWxSelectWellsDlg(QWidget* parent)
|
|
: iDlgBase(parent),
|
|
m_pMainLayout(nullptr)
|
|
{
|
|
setWindowTitle(tr("Select Wells"));
|
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
|
initUI();
|
|
}
|
|
|
|
nmWxSelectWellsDlg::~nmWxSelectWellsDlg()
|
|
{
|
|
}
|
|
|
|
void nmWxSelectWellsDlg::setWidget(QWidget* pWidget)
|
|
{
|
|
if (pWidget == nullptr)
|
|
{
|
|
return;
|
|
}
|
|
|
|
// 内容随窗口水平、垂直拉伸,初始尺寸交由字体、主题和子控件推荐值决定。
|
|
m_pMainLayout->insertWidget(0, pWidget, 1);
|
|
adjustSize();
|
|
}
|
|
|
|
void nmWxSelectWellsDlg::initUI()
|
|
{
|
|
m_pMainLayout = new QVBoxLayout(this);
|
|
m_pMainLayout->setContentsMargins(12, 10, 12, 0);
|
|
m_pMainLayout->setSpacing(10);
|
|
|
|
// 按钮组整体靠右,沿用已统一对话框的底部边距和框架图标。
|
|
QWidget* pFooter = new QWidget(this);
|
|
pFooter->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
|
QHBoxLayout* pFooterLayout = new QHBoxLayout(pFooter);
|
|
pFooterLayout->setContentsMargins(4, 5, 4, 5);
|
|
pFooterLayout->setSpacing(8);
|
|
pFooterLayout->addStretch();
|
|
QDialogButtonBox* pButtons = new QDialogButtonBox(
|
|
QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, pFooter);
|
|
QPushButton* pOkButton = pButtons->button(QDialogButtonBox::Ok);
|
|
pOkButton->setText(tr("OK"));
|
|
pOkButton->setIcon(zxLoadIcon("OK"));
|
|
pOkButton->setDefault(true);
|
|
QPushButton* pCancelButton = pButtons->button(QDialogButtonBox::Cancel);
|
|
pCancelButton->setText(tr("Cancel"));
|
|
pCancelButton->setIcon(zxLoadIcon("Cancel"));
|
|
pFooterLayout->addWidget(pButtons);
|
|
m_pMainLayout->addWidget(pFooter);
|
|
|
|
// 对话框只返回操作结果;项目井的增删仍由调用方在确认后处理。
|
|
connect(pButtons, SIGNAL(accepted()), this, SLOT(accept()));
|
|
connect(pButtons, SIGNAL(rejected()), this, SLOT(reject()));
|
|
}
|