QElectroTech
0.70
sources
SearchAndReplace
ui
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
27
ReplaceElementDialog::ReplaceElementDialog
(
DiagramContext
context, QWidget *parent) :
28
QDialog(parent),
29
ui(new
Ui
::
ReplaceElementDialog
)
30
{
31
ui
->setupUi(
this
);
32
buildWidget
();
33
setContext
(
context
);
34
}
35
36
ReplaceElementDialog::~ReplaceElementDialog
()
37
{
38
delete
ui
;
39
}
40
46
void
ReplaceElementDialog::setContext
(
DiagramContext
context)
47
{
48
m_context
=
context
;
49
50
for
(
ElementInfoPartWidget
*eipw :
m_eipw_list
) {
51
eipw->setText(
m_context
[eipw->key()].toString());
52
}
53
}
54
59
DiagramContext
ReplaceElementDialog::context
()
const
60
{
61
DiagramContext
context
;
62
for
(
ElementInfoPartWidget
*eipw :
m_eipw_list
) {
63
context
.
addValue
(eipw->key(), eipw->text());
64
}
65
66
return
context
;
67
}
68
69
void
ReplaceElementDialog::buildWidget
()
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
{
77
ElementInfoPartWidget
*eipw =
new
ElementInfoPartWidget
(str,
QETApp::elementTranslatedInfoKey
(str),
this
);
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
}
ReplaceElementDialog::setContext
void setContext(DiagramContext context)
ReplaceElementDialog::setContext Set the current diagram context to be edited.
Definition:
replaceelementdialog.cpp:46
qetapp.h
Ui
Definition:
autonumberingdockwidget.h:25
DiagramContext
Definition:
diagramcontext.h:53
searchandreplaceworker.h
DiagramContext::addValue
bool addValue(const QString &, const QVariant &, bool show=true)
Definition:
diagramcontext.cpp:83
ElementInfoPartWidget
Definition:
elementinfopartwidget.h:27
ReplaceElementDialog::buildWidget
void buildWidget()
Definition:
replaceelementdialog.cpp:69
elementinfopartwidget.h
ElementInfoPartWidget::setEraseTextVisible
void setEraseTextVisible(bool visible)
ElementInfoPartWidget::setEraseTextVisible.
Definition:
elementinfopartwidget.cpp:115
QET::Icons::tr
QIcon tr
Definition:
qeticons.cpp:204
QETApp::elementInfoKeys
static QStringList elementInfoKeys()
QETApp::elementInfoKeys.
Definition:
qetapp.cpp:289
ReplaceElementDialog
Definition:
replaceelementdialog.h:30
ReplaceElementDialog::context
DiagramContext context() const
ReplaceElementDialog::context.
Definition:
replaceelementdialog.cpp:59
ReplaceElementDialog::ui
Ui::ReplaceElementDialog * ui
Definition:
replaceelementdialog.h:45
ReplaceElementDialog::~ReplaceElementDialog
~ReplaceElementDialog()
Definition:
replaceelementdialog.cpp:36
ReplaceElementDialog::m_eipw_list
QList< ElementInfoPartWidget * > m_eipw_list
Definition:
replaceelementdialog.h:46
ElementInfoPartWidget::setPlaceHolderText
void setPlaceHolderText(const QString &text)
ElementInfoPartWidget::setPlaceHolderText.
Definition:
elementinfopartwidget.cpp:81
QETApp::elementTranslatedInfoKey
static QString elementTranslatedInfoKey(const QString &)
ElementsProperties::translatedInfo Return the translated information key given by If don't match...
Definition:
qetapp.cpp:321
ReplaceElementDialog::ReplaceElementDialog
ReplaceElementDialog(DiagramContext context, QWidget *parent=nullptr)
Definition:
replaceelementdialog.cpp:27
replaceelementdialog.h
ReplaceElementDialog::m_context
DiagramContext m_context
Definition:
replaceelementdialog.h:47
Generated by
1.8.15