| 14 | namespace PJ { |
| 15 | |
| 16 | XYCurveDialog::XYCurveDialog(const QString& x_label, const QString& y_label, QWidget* parent) |
| 17 | : Dialog(parent), ui_(new Ui::XYCurveDialog) { |
| 18 | setDialogTitle(tr("New XY Curve")); |
| 19 | |
| 20 | auto* body = new QWidget; |
| 21 | ui_->setupUi(body); |
| 22 | contentLayout()->addWidget(body); |
| 23 | |
| 24 | // The Swap button spans the X and Y rows; centre it vertically so it sits |
| 25 | // between the two fields it exchanges. |
| 26 | ui_->formLayout->setAlignment(ui_->pushButtonSwap, Qt::AlignVCenter); |
| 27 | |
| 28 | ui_->lineEditX->setText(x_label); |
| 29 | ui_->lineEditY->setText(y_label); |
| 30 | refreshSuggestion(); |
| 31 | |
| 32 | connect(ui_->pushButtonSwap, &QPushButton::clicked, this, [this]() { |
| 33 | const QString x = ui_->lineEditX->text(); |
| 34 | ui_->lineEditX->setText(ui_->lineEditY->text()); |
| 35 | ui_->lineEditY->setText(x); |
| 36 | swapped_ = !swapped_; |
| 37 | refreshSuggestion(); |
| 38 | }); |
| 39 | connect(ui_->lineEditName, &QLineEdit::textChanged, this, [this](const QString&) { refreshOkState(); }); |
| 40 | connect(ui_->buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); |
| 41 | connect(ui_->buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); |
| 42 | refreshOkState(); |
| 43 | } |
| 44 | |
| 45 | XYCurveDialog::~XYCurveDialog() { |
| 46 | delete ui_; |
nothing calls this directly
no test coverage detected