fix:1.修正同结构导入问题。2.历史界面添加删除。3.导入排序问题。

This commit is contained in:
2024-08-28 08:42:45 +08:00
parent f2b1525b92
commit f9796c7090
7 changed files with 81 additions and 38 deletions

View File

@@ -13,11 +13,11 @@ public:
public:
bool push(const std::string& content);
bool get_history(std::vector<std::string>& vec);
bool read_file(std::vector<std::string>& vec);
bool write_file(std::vector<std::string>& vec);
private:
void default_set();
bool read_file(std::vector<std::string>& vec);
bool write_file(std::vector<std::string>& vec);
private:
std::string work_dir_{};

View File

@@ -10,6 +10,7 @@ CUIHistory::CUIHistory(QWidget* parent, CHistory* his) : QDialog(parent), ui(new
connect(ui->btnExit, &QPushButton::clicked, this, [&]() { close(); });
connect(ui->btnOk, &QPushButton::clicked, this, [&]() { select_ok(); });
connect(ui->btnDel, &QPushButton::clicked, this, [&]() { del_item(); });
}
CUIHistory::~CUIHistory()
@@ -42,3 +43,22 @@ void CUIHistory::select_ok()
cur_ = re[0]->text();
close();
}
void CUIHistory::del_item()
{
auto re = ui->listWidget->selectedItems();
if (re.empty()) {
return ;
}
for (auto& item : re) {
delete ui->listWidget->takeItem(ui->listWidget->row(item));
}
std::vector<std::string> vec;
for (int i = 0; i < ui->listWidget->count(); ++i) {
QListWidgetItem* item = ui->listWidget->item(i);
if (item) {
vec.push_back(item->text().toStdString());
}
}
his_->write_file(vec);
}

View File

@@ -19,6 +19,7 @@ public:
private:
void showEvent(QShowEvent* event);
void select_ok();
void del_item();
public:
QString cur_{};

View File

@@ -32,6 +32,13 @@
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="btnDel">
<property name="text">
<string>删除</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnOk">
<property name="sizePolicy">

View File

@@ -244,6 +244,7 @@ bool CXmlOpr::import_newer_data(const std::vector<std::string>& vec, std::size_t
++success_count;
auto* nitem = copy_element(item);
insert_brother_node(last_item, nitem);
last_item = nitem;
}
return true;
}