func:导入导出添加基本替换功能。
This commit is contained in:
parent
e4aec3b2e1
commit
69801b6f9b
@ -16,13 +16,13 @@ MainWidget::MainWidget(QWidget* parent) : QWidget(parent), ui(new Ui::MainWidget
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
setWindowTitle(u8"OneLevelXmlOpr v1.2.11");
|
setWindowTitle(u8"OneLevelXmlOpr v1.2.12");
|
||||||
setWindowIcon(QIcon("://resource/xml.ico"));
|
setWindowIcon(QIcon("://resource/xml.ico"));
|
||||||
|
|
||||||
QScreen* primaryScreen = QGuiApplication::primaryScreen();
|
QScreen* primaryScreen = QGuiApplication::primaryScreen();
|
||||||
QRect screenGeometry = primaryScreen->geometry();
|
QRect screenGeometry = primaryScreen->geometry();
|
||||||
setMinimumWidth(screenGeometry.width() * 0.5);
|
setMinimumWidth(screenGeometry.width() * 0.5);
|
||||||
setMinimumHeight(screenGeometry.height() * 0.8);
|
setMinimumHeight(screenGeometry.height() * 0.9);
|
||||||
// setMinimumWidth(900);
|
// setMinimumWidth(900);
|
||||||
// setMinimumHeight(800);
|
// setMinimumHeight(800);
|
||||||
|
|
||||||
|
@ -15,6 +15,8 @@ CDataEdit::CDataEdit(QWidget* parent) : QDialog(parent), ui(new Ui::CDataEdit)
|
|||||||
setWindowTitle(u8"源编辑");
|
setWindowTitle(u8"源编辑");
|
||||||
|
|
||||||
connect(ui->btnExit, &QPushButton::clicked, this, [&]() { close(); });
|
connect(ui->btnExit, &QPushButton::clicked, this, [&]() { close(); });
|
||||||
|
connect(ui->btnReplace, &QPushButton::clicked, this, [&]() { replace(); });
|
||||||
|
connect(ui->btnWithDraw, &QPushButton::clicked, this, [&]() { with_draw(); });
|
||||||
connect(ui->btnAdd, &QPushButton::clicked, this, [&]() { import_data(); });
|
connect(ui->btnAdd, &QPushButton::clicked, this, [&]() { import_data(); });
|
||||||
connect(ui->btnCopy, &QPushButton::clicked, this, [&]() {
|
connect(ui->btnCopy, &QPushButton::clicked, this, [&]() {
|
||||||
QClipboard* clip = QApplication::clipboard();
|
QClipboard* clip = QApplication::clipboard();
|
||||||
@ -99,3 +101,20 @@ void CDataEdit::show_before()
|
|||||||
ui->plainTextEdit->appendPlainText(data_);
|
ui->plainTextEdit->appendPlainText(data_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CDataEdit::replace()
|
||||||
|
{
|
||||||
|
if (ui->edPre->text().isEmpty()) {
|
||||||
|
CUtil::msg(this, u8"未填入内容。");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QString data = ui->plainTextEdit->toPlainText();
|
||||||
|
pre_content_ = data;
|
||||||
|
data.replace(ui->edPre->text(), ui->edAfter->text());
|
||||||
|
ui->plainTextEdit->setPlainText(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDataEdit::with_draw()
|
||||||
|
{
|
||||||
|
ui->plainTextEdit->setPlainText(pre_content_);
|
||||||
|
}
|
||||||
|
@ -30,6 +30,13 @@ public:
|
|||||||
bool is_import_{false};
|
bool is_import_{false};
|
||||||
bool is_import_sucess_{false};
|
bool is_import_sucess_{false};
|
||||||
|
|
||||||
|
private:
|
||||||
|
void replace();
|
||||||
|
void with_draw();
|
||||||
|
|
||||||
|
public:
|
||||||
|
QString pre_content_{};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::CDataEdit* ui;
|
Ui::CDataEdit* ui;
|
||||||
QString data_{};
|
QString data_{};
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>643</width>
|
<width>949</width>
|
||||||
<height>407</height>
|
<height>411</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -19,6 +19,54 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>将</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="edPre">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>替换为</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="edAfter">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btnReplace">
|
||||||
|
<property name="text">
|
||||||
|
<string>替换</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btnWithDraw">
|
||||||
|
<property name="text">
|
||||||
|
<string>撤回</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user