Qt/IOWindow: Remove Apply button.

This commit is contained in:
Admiral H. Curtiss 2020-11-22 04:00:28 +01:00
parent 334100509b
commit 11e226a91a
2 changed files with 4 additions and 12 deletions

View File

@ -240,7 +240,6 @@ void IOWindow::CreateMainLayout()
m_test_button = new QPushButton(tr("Test"), this); m_test_button = new QPushButton(tr("Test"), this);
m_button_box = new QDialogButtonBox(); m_button_box = new QDialogButtonBox();
m_clear_button = new QPushButton(tr("Clear")); m_clear_button = new QPushButton(tr("Clear"));
m_apply_button = new QPushButton(tr("Apply"));
m_range_slider = new QSlider(Qt::Horizontal); m_range_slider = new QSlider(Qt::Horizontal);
m_range_spinbox = new QSpinBox(); m_range_spinbox = new QSpinBox();
@ -376,7 +375,6 @@ void IOWindow::CreateMainLayout()
// Button Box // Button Box
m_main_layout->addWidget(m_button_box); m_main_layout->addWidget(m_button_box);
m_button_box->addButton(m_clear_button, QDialogButtonBox::ActionRole); m_button_box->addButton(m_clear_button, QDialogButtonBox::ActionRole);
m_button_box->addButton(m_apply_button, QDialogButtonBox::ActionRole);
m_button_box->addButton(QDialogButtonBox::Ok); m_button_box->addButton(QDialogButtonBox::Ok);
setLayout(m_main_layout); setLayout(m_main_layout);
@ -419,11 +417,8 @@ void IOWindow::ConnectWidgets()
connect(m_range_spinbox, qOverload<int>(&QSpinBox::valueChanged), this, connect(m_range_spinbox, qOverload<int>(&QSpinBox::valueChanged), this,
&IOWindow::OnRangeChanged); &IOWindow::OnRangeChanged);
connect(m_expression_text, &QPlainTextEdit::textChanged, [this] { connect(m_expression_text, &QPlainTextEdit::textChanged,
m_apply_button->setText(m_apply_button->text().remove(QStringLiteral("*"))); [this] { UpdateExpression(m_expression_text->toPlainText().toStdString()); });
m_apply_button->setText(m_apply_button->text() + QStringLiteral("*"));
UpdateExpression(m_expression_text->toPlainText().toStdString());
});
connect(m_operators_combo, qOverload<int>(&QComboBox::activated), [this](int index) { connect(m_operators_combo, qOverload<int>(&QComboBox::activated), [this](int index) {
if (0 == index) if (0 == index)
@ -475,14 +470,12 @@ void IOWindow::OnDialogButtonPressed(QAbstractButton* button)
UpdateExpression(m_expression_text->toPlainText().toStdString()); UpdateExpression(m_expression_text->toPlainText().toStdString());
m_original_expression = m_reference->GetExpression(); m_original_expression = m_reference->GetExpression();
m_apply_button->setText(m_apply_button->text().remove(QStringLiteral("*")));
if (ciface::ExpressionParser::ParseStatus::SyntaxError == m_reference->GetParseStatus()) if (ciface::ExpressionParser::ParseStatus::SyntaxError == m_reference->GetParseStatus())
{ {
ModalMessageBox::warning(this, tr("Error"), tr("The expression contains a syntax error.")); ModalMessageBox::warning(this, tr("Error"), tr("The expression contains a syntax error."));
} }
if (button != m_apply_button) // must be the OK button
accept(); accept();
} }

View File

@ -115,7 +115,6 @@ private:
// Buttonbox // Buttonbox
QDialogButtonBox* m_button_box; QDialogButtonBox* m_button_box;
QPushButton* m_clear_button; QPushButton* m_clear_button;
QPushButton* m_apply_button;
ControlReference* m_reference; ControlReference* m_reference;
std::string m_original_expression; std::string m_original_expression;