QElectroTech  0.70
replaceelementdialog.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 "replaceelementdialog.h"
19 #include "ui_replaceelementdialog.h"
20 #include "replaceelementdialog.h"
21 #include "elementinfopartwidget.h"
22 #include "qetapp.h"
23 #include "searchandreplaceworker.h"
24 
25 #include <QAbstractButton>
26 
28  QDialog(parent),
29  ui(new Ui::ReplaceElementDialog)
30 {
31  ui->setupUi(this);
32  buildWidget();
34 }
35 
37 {
38  delete ui;
39 }
40 
47 {
49 
50  for (ElementInfoPartWidget *eipw : m_eipw_list) {
51  eipw->setText(m_context[eipw->key()].toString());
52  }
53 }
54 
60 {
62  for (ElementInfoPartWidget *eipw : m_eipw_list) {
63  context.addValue(eipw->key(), eipw->text());
64  }
65 
66  return context;
67 }
68 
70 {
71  connect(ui->m_button_box, &QDialogButtonBox::clicked, [this](QAbstractButton *button_) {
72  this->done(ui->m_button_box->buttonRole(button_));
73  });
74 
75  for (QString str : QETApp::elementInfoKeys())
76  {
78  eipw->setEraseTextVisible(true);
79  eipw->setPlaceHolderText(tr("Ne pas modifier"));
80  ui->m_scroll_layout->addWidget(eipw);
81  m_eipw_list << eipw;
82  }
83 }
void setContext(DiagramContext context)
ReplaceElementDialog::setContext Set the current diagram context to be edited.
bool addValue(const QString &, const QVariant &, bool show=true)
void setEraseTextVisible(bool visible)
ElementInfoPartWidget::setEraseTextVisible.
QIcon tr
Definition: qeticons.cpp:204
static QStringList elementInfoKeys()
QETApp::elementInfoKeys.
Definition: qetapp.cpp:289
DiagramContext context() const
ReplaceElementDialog::context.
Ui::ReplaceElementDialog * ui
QList< ElementInfoPartWidget * > m_eipw_list
void setPlaceHolderText(const QString &text)
ElementInfoPartWidget::setPlaceHolderText.
static QString elementTranslatedInfoKey(const QString &)
ElementsProperties::translatedInfo Return the translated information key given by If don&#39;t match...
Definition: qetapp.cpp:321
ReplaceElementDialog(DiagramContext context, QWidget *parent=nullptr)