解决兼容性问题
This commit is contained in:
@ -23,33 +23,37 @@ AddApp::AddApp(bool isEdit, Record2 *row , QWidget* parent)
|
||||
setWindowFlags(Qt::WindowCloseButtonHint);
|
||||
form = new QFormLayout;
|
||||
name = new QLineEdit;
|
||||
form->addRow(QString::fromLocal8Bit("名称"), name);
|
||||
|
||||
if (isEdit)
|
||||
if(isEdit)
|
||||
{
|
||||
sqlite_helper.get_a_software(row->orig_name, &record);
|
||||
name_label = new QLabel(orig_name_str);
|
||||
form->addRow(QString::fromLocal8Bit("全名"), name_label);
|
||||
record = *row;//最初为啥这么写我也忘了
|
||||
if (!record.orig_name.isEmpty())
|
||||
{
|
||||
name_label->setText(record.orig_name);
|
||||
}
|
||||
orig_name_str = record.orig_name;
|
||||
record=*row;//最初为啥这么写我也忘了
|
||||
}
|
||||
else
|
||||
{
|
||||
orig_name = new QLineEdit;
|
||||
form->addRow(QString::fromLocal8Bit("全名"), orig_name);
|
||||
}
|
||||
|
||||
|
||||
if (record.orig_name.isEmpty())
|
||||
{
|
||||
path = new QPushButton(QString::fromLocal8Bit("浏览"));
|
||||
connect(path, &QPushButton::clicked, this, &AddApp::broswer_exe);
|
||||
form->addRow(QString::fromLocal8Bit("路径"), path);
|
||||
if (isEdit)
|
||||
{
|
||||
sqlite_helper.get_a_software(row->orig_name, &record);
|
||||
name_label = new QLabel(orig_name_str);
|
||||
form->addRow(QString::fromLocal8Bit("全名"), name_label);
|
||||
if (!record.orig_name.isEmpty())
|
||||
{
|
||||
name_label->setText(record.orig_name);
|
||||
}
|
||||
orig_name_str = record.orig_name;
|
||||
}
|
||||
else
|
||||
{
|
||||
orig_name = new QLineEdit;
|
||||
form->addRow(QString::fromLocal8Bit("全名"), orig_name);
|
||||
}
|
||||
form->addRow(QString::fromLocal8Bit("名称"), name);
|
||||
|
||||
sort = new QLineEdit;
|
||||
sort->setValidator(new QIntValidator(10, 100));
|
||||
sort->setText("50");
|
||||
form->addRow(QString::fromLocal8Bit("排序"), sort);
|
||||
QList<Categrory> categrories;
|
||||
layout_inner = new QVBoxLayout;
|
||||
@ -83,6 +87,24 @@ AddApp::AddApp(bool isEdit, Record2 *row , QWidget* parent)
|
||||
{
|
||||
form->addRow(QString::fromLocal8Bit("路径"), path);
|
||||
}
|
||||
if (isEdit)
|
||||
{
|
||||
sqlite_helper.get_a_software(row->orig_name, &record);
|
||||
name_label = new QLabel(orig_name_str);
|
||||
form->addRow(QString::fromLocal8Bit("全名"), name_label);
|
||||
if (!record.orig_name.isEmpty())
|
||||
{
|
||||
name_label->setText(record.orig_name);
|
||||
}
|
||||
orig_name_str = record.orig_name;
|
||||
}
|
||||
else
|
||||
{
|
||||
orig_name = new QLineEdit;
|
||||
form->addRow(QString::fromLocal8Bit("全名"), orig_name);
|
||||
}
|
||||
form->addRow(QString::fromLocal8Bit("名称"), name);
|
||||
|
||||
sort = new QLineEdit;
|
||||
sort->setText(QString::number(record.sort));
|
||||
sort->setValidator(new QIntValidator(10, 100));
|
||||
@ -145,7 +167,10 @@ void AddApp::broswer_exe(){
|
||||
}
|
||||
fs::path file(path_str.toStdWString());
|
||||
path->setText(QString::fromStdWString(file.filename().c_str()));
|
||||
|
||||
if(!isEdit)
|
||||
{
|
||||
orig_name->setText(QString::fromStdWString(file.filename().c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
void AddApp::submit() {
|
||||
|
Reference in New Issue
Block a user