MCPcopy Create free account
hub / github.com/PlotJuggler/PlotJuggler / XYCurveDialog

Method XYCurveDialog

pj_plotting/widget/src/XYCurveDialog.cpp:16–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14namespace PJ {
15
16XYCurveDialog::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
45XYCurveDialog::~XYCurveDialog() {
46 delete ui_;

Callers

nothing calls this directly

Calls 5

trFunction · 0.85
setupUiMethod · 0.80
setAlignmentMethod · 0.45
setTextMethod · 0.45
textMethod · 0.45

Tested by

no test coverage detected