QElectroTech  0.70
formulaassistantdialog.cpp
Go to the documentation of this file.
1 /*
2  Copyright 2006-2019 The QElectroTech Team
3  This file is part of QElectroTech.
4 
5  QElectroTech is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 2 of the License, or
8  (at your option) any later version.
9 
10  QElectroTech is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #include "formulaassistantdialog.h"
19 #include "ui_formulaassistantdialog.h"
20 
21 #include <QPushButton>
22 
24  QDialog(parent),
25  ui(new Ui::FormulaAssistantDialog)
26 {
27  ui->setupUi(this);
28 }
29 
31 {
32  delete ui;
33 }
34 
35 void FormulaAssistantDialog::setForbiddenVariables(const QStringList& list)
36 {
37  m_rx.setPattern(list.join("|"));
38 }
39 
40 void FormulaAssistantDialog::setText(const QString& text)
41 {
42  ui->m_label->setText(text);
43 }
44 
45 void FormulaAssistantDialog::setFormula(const QString& text)
46 {
47  ui->m_line_edit->setText(text);
48 }
49 
51 {
52  return ui->m_line_edit->text();
53 }
54 
56 {
57  QPushButton *b = ui->m_button_box->button(QDialogButtonBox::Ok);
58 
59  if (arg1.contains(m_rx))
60  b->setDisabled(true);
61  else
62  b->setEnabled(true);
63 }
void setForbiddenVariables(const QStringList &list)
FormulaAssistantDialog(QWidget *parent=nullptr)
void setFormula(const QString &text)
Ui::FormulaAssistantDialog * ui
void setText(const QString &text)
void on_m_line_edit_textChanged(const QString &arg1)