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.
whellvalue/src/tpMain/qworkItemdlg.cpp

53 lines
1.2 KiB
C++

5 years ago
#include "qworkItemdlg.h"
#include <QFileDialog>
#include <QPixmap>
#include <QMessageBox>
#include <QCheckBox>
#pragma execution_character_set("utf-8")
QWorkItemDlg::QWorkItemDlg(QWidget *parent)
: QDialog(parent)
{
ui.setupUi(this);
setWindowIcon(QIcon(":/image/leaper"));
setWindowTitle(tr("工单信息设置"));
setWindowFlags(Qt::WindowCloseButtonHint);
connect(ui.m_OK, SIGNAL(clicked()), this, SLOT(onOk()));
connect(ui.m_Cancle, SIGNAL(clicked()), this, SLOT(close()));
ntreeItem.bUse = true;
}
QWorkItemDlg::~QWorkItemDlg()
{
}
void QWorkItemDlg::setItemData(SimuItem *p)
{
if (p){
ui.lineEdit_key->setText(p->key);
ui.textEdit_about->setText(p->strAbout);
ntreeItem = (*p);
}
}
Q_SLOT void QWorkItemDlg::onOk()
{
QString strKey = ui.lineEdit_key->text();
if (strKey.isEmpty()){
QMessageBox::warning(this, tr("警告"), tr("名称不能为空."), QMessageBox::Ok);
return;
}
if (ptr != NULL&&ntreeItem.key != strKey)
{
if (ptr->contains(strKey))
{
QMessageBox::warning(this, tr("警告"), tr("你输入的名称:%1 重复.").arg(strKey), QMessageBox::Ok);
return;
}
}
ntreeItem.key = strKey;
ntreeItem.strAbout = ui.textEdit_about->toPlainText();
QDialog::accept();
}