3 #include "ui_suggest_dialog.h" 11 restoreGeometry(settings.value(
"SuggestDialog.geometry").toByteArray());
13 ui->lineEditX->setText(QString::fromStdString(name_x));
14 ui->lineEditY->setText(QString::fromStdString(name_y));
21 settings.setValue(
"SuggestDialog.geometry", saveGeometry());
27 return ui->lineEditX->text();
32 return ui->lineEditY->text();
37 return ui->lineEditName->text();
42 std::string common_prefix;
43 std::string name_x =
ui->lineEditX->text().toStdString();
44 std::string name_y =
ui->lineEditY->text().toStdString();
46 if (name_x.size() > name_y.size())
50 common_prefix = std::string(name_x.begin(), std::mismatch(name_x.begin(), name_x.end(), name_y.begin()).first);
52 std::string suffix_x = name_x.substr(common_prefix.size());
53 std::string suffix_y = name_y.substr(common_prefix.size());
55 std::string suggestion = common_prefix +
"[" + suffix_x +
";" + suffix_y +
"]";
56 ui->lineEditName->setText(QString::fromStdString(suggestion));
61 auto temp =
ui->lineEditX->text();
62 ui->lineEditX->setText(
ui->lineEditY->text());
63 ui->lineEditY->setText(temp);
void on_pushButtonSwap_pressed()
SuggestDialog(const std::string &name_x, const std::string &name_y, QWidget *parent=nullptr)
QString suggestedName() const