This commit is contained in:
yangjiaxuan 2022-12-29 10:37:26 +08:00
parent 68fd671615
commit 588e8a2652
3 changed files with 14 additions and 15 deletions

View File

@ -7,8 +7,7 @@ Dialog_UserInput::Dialog_UserInput(ui_helper::value_type type, const QString &ti
QDialog(parent),
ui(new Ui::Dialog_UserInput),
m_type(type),
m_title(title),
m_desc(desc)
m_title(title)
{
ui->setupUi(this);
@ -18,23 +17,25 @@ Dialog_UserInput::Dialog_UserInput(ui_helper::value_type type, const QString &ti
ui->comboBox->setVisible(false);
if (type == ui_helper::VAL_TYPE_BOOL)
{
ui->label->setText(QString::fromStdWString(m_desc));
ui->label->setText(QString::fromStdWString(desc));
ui->radioButton_yes->setVisible(true);
ui->radioButton_no->setVisible(true);
}
else if (type == ui_helper::VAL_TYPE_INT || type == ui_helper::VAL_TYPE_FLOAT || type == ui_helper::VAL_TYPE_STRING)
{
ui->label->setText(QString::fromStdWString(m_desc));
ui->label->setText(QString::fromStdWString(desc));
ui->lineEdit->setVisible(true);
}
else if (type == ui_helper::VAL_TYPE_RANGE)
else if (type == ui_helper::VAL_TYPE_TIPS_VAL)
{
while(*m_desc != '\0')
ui_helper::PINFOTIPS p = (ui_helper::PINFOTIPS)desc;
while(*(p->desc) != '\0')
{
ui->comboBox->addItem(QString::number(*m_desc));
m_desc++;
ui->comboBox->addItem(QString::number(*(p->desc)));
p->desc++;
}
ui->label->setText(QString::fromStdWString(p->info));
ui->comboBox->setVisible(true);
}
@ -75,7 +76,7 @@ parameter *Dialog_UserInput::getParam()
{
param->m_sData = ui->lineEdit->text().toStdWString();
}
else if (m_type == ui_helper::VAL_TYPE_RANGE)
else if (m_type == ui_helper::VAL_TYPE_TIPS_VAL)
{
param->m_iData = ui->comboBox->currentText().toInt();
}
@ -115,7 +116,7 @@ size_t UserInputParams::get_size()
{
if (m_type == ui_helper::VAL_TYPE_BOOL)
return sizeof(bool);
if (m_type == ui_helper::VAL_TYPE_INT || m_type == ui_helper::VAL_TYPE_RANGE)
if (m_type == ui_helper::VAL_TYPE_INT || m_type == ui_helper::VAL_TYPE_TIPS_VAL)
return sizeof(int);
if (m_type == ui_helper::VAL_TYPE_FLOAT)
return sizeof(double);
@ -128,7 +129,7 @@ void *UserInputParams::get_data()
{
if (m_type == ui_helper::VAL_TYPE_BOOL)
return &m_bData;
if (m_type == ui_helper::VAL_TYPE_INT || m_type == ui_helper::VAL_TYPE_RANGE)
if (m_type == ui_helper::VAL_TYPE_INT || m_type == ui_helper::VAL_TYPE_TIPS_VAL)
return &m_iData;
if (m_type == ui_helper::VAL_TYPE_FLOAT)
return &m_fData;

View File

@ -45,7 +45,6 @@ private:
ui_helper::value_type m_type;
QString m_title;
const wchar_t *m_desc;
};
#endif // DIALOG_USERINPUT_H

View File

@ -68,15 +68,14 @@ public:
VAL_TYPE_BOOL = 0,
VAL_TYPE_INT,
VAL_TYPE_FLOAT,
VAL_TYPE_STRING,
VAL_TYPE_RANGE,
VAL_TYPE_STRING,
VAL_TYPE_CUSTOM, // custom data, such as gamma table ...
VAL_TYPE_TIPS_VAL, // status info tips and data info
};
typedef struct _info// value_type == VAL_TUPE_TIPS
{
const wchar_t* desc; // desc is int
const wchar_t* desc; //data
const wchar_t* info; //info tips
}_INFOTIPS, * PINFOTIPS;
// get testing parameter ...