42 if (diagram_list.isEmpty()) {
46 QETProject *project = diagram_list.first()->project();
47 for (
Diagram *d : diagram_list) {
48 if (d->project() != project) {
54 us->beginMacro(
QObject::tr(
"Chercher/remplacer les propriétés de folio"));
71 new_properties.
date = QDate();
79 if (old_propertie != new_properties) {
88 QList<Diagram *> list;
102 if (list.isEmpty() || !list.first()->diagram()) {
106 QETProject *project_ = list.first()->diagram()->project();
109 if (elmt->diagram()) {
110 if (elmt->diagram()->project() != project_) {
116 project_->
undoStack()->beginMacro(
QObject::tr(
"Chercher/remplacer les propriétés d'éléments."));
125 DiagramContext new_context = old_context = elmt->elementInformations();
132 if (old_context != new_context)
144 QList<Element *>list;
145 list.append(element);
157 if (list.isEmpty() || !list.first()->diagram()) {
160 QETProject *project_ = list.first()->diagram()->project();
162 if (!text->diagram() ||
163 text->diagram()->project() != project_) {
171 QString before = text->toPlainText();
180 QList<IndependentTextItem *>list;
194 if (list.isEmpty() || !list.first()->diagram()) {
198 QETProject *project_ = list.first()->diagram()->project();
201 c->diagram()->project() != project_) {
206 project_->
undoStack()->beginMacro(
QObject::tr(
"Chercher/remplacer les propriétés de conducteurs."));
211 if (cp != c->properties())
213 QSet <Conductor *> conductors_list = c->relatedPotentialConductors(
true);
214 conductors_list << c;
217 QVariant old_value, new_value;
218 old_value.setValue(cc->properties());
219 new_value.setValue(cp);
229 QList<Conductor *>list;
230 list.append(conductor);
250 if (!diagrams.isEmpty()) {
251 project_ = diagrams.first()->project();
252 }
else if (!elements.isEmpty() && elements.first()->diagram()) {
253 project_ = elements.first()->diagram()->project();
254 }
else if (!texts.isEmpty() && texts.first()->diagram()) {
255 project_ = texts.first()->diagram()->project();
256 }
else if (!conductors.isEmpty() && conductors.first()->diagram()) {
257 project_ = conductors.first()->diagram()->project();
263 if (dd->project() != project_) {
267 for (
Element *elmt : elements) {
268 if (!elmt->diagram() || elmt->diagram()->project() != project_) {
273 if (!text->diagram() || text->diagram()->project() != project_) {
278 if (!cc->diagram() || cc->diagram()->project() != project_) {
292 for (
Diagram *diagram : diagrams)
296 if (old_properties != new_properties) {
303 for (
Element *element : elements)
307 if (old_context != new_context) {
318 if (old_properties != new_properties)
320 QSet <Conductor *> potential_conductors = conductor->relatedPotentialConductors(
true);
321 potential_conductors << conductor;
323 for (
Conductor *c : potential_conductors)
325 QVariant old_value, new_value;
326 old_value.setValue(c->properties());
327 new_value.setValue(new_properties);
339 QString after = text->toPlainText();
340 after = after.replace(rx, replace);
342 if (after != text->toPlainText()) {
363 cb->setChecked(str ==
eraseText() ?
true :
false);
364 l->setDisabled(str ==
eraseText() ?
true :
false);
379 cp.
style = Qt::NoPen;
417 return new_properties;
428 if (change.isEmpty()) {
return original;}
429 else if (change ==
eraseText()) {
return QString();}
430 else {
return change;}
448 if (what ==
"title") {p.
title = p.
title.replace(rx, replace);}
449 else if (what ==
"author") {p.
author = p.
author.replace(rx, replace);}
450 else if (what ==
"filename") {p.
filename = p.
filename.replace(rx, replace);}
451 else if (what ==
"folio") {p.
folio = p.
folio.replace(rx, replace);}
452 else if (what ==
"plant") {p.
plant = p.
plant.replace(rx, replace);}
453 else if (what ==
"locmach") {p.
locmach = p.
locmach.replace(rx, replace);}
454 else if (what ==
"indexrev") {p.
indexrev = p.
indexrev.replace(rx, replace);}
476 QString value = context[what].toString();
477 context.
addValue(what, value.replace(rx, replace));
500 if (what ==
"formula") {properties.
m_formula.replace(rx, replace);}
501 else if (what ==
"text") {properties.
text.replace(rx, replace);}
502 else if (what ==
"function") {properties.
m_function.replace(rx, replace);}
503 else if (what ==
"tension/protocol") {properties.
m_tension_protocol.replace(rx, replace);}
The QPropertyUndoCommand class This undo command manage QProperty of a QObject. This undo command can...
QString locmach
Location(displayed by the default template)
Qt::Alignment m_vertical_alignment
ConductorProperties properties
Conductor::properties.
QString plant
Plant (displayed by the default template)
void replaceDiagram(QList< Diagram *> diagram_list)
SearchAndReplaceWorker::replaceDiagram Replace all properties of each diagram in , by the current titleblock propertie of this worker.
DiagramContext elementInformations() const
SingleLineProperties singleLineProperties
TitleBlockProperties exportTitleBlock()
void add(DiagramContext other)
DiagramContext::add Add all value of to this. If a key already exist, the value is replaced...
Qt::Alignment m_horizontal_alignment
QVariant value(const QString &key) const
advancedReplaceStruct m_advanced_struct
DiagramContext m_element_context
static ConductorProperties invalidConductorProperties()
QDate date
Date (displayed by the default template)
bool addValue(const QString &, const QVariant &, bool show=true)
QString filename
Filename (displayed by the default template)
The ChangeTitleBlockCommand class This command changes the title block properties for a particular di...
static QString eraseText()
static ConductorProperties applyChange(const ConductorProperties &original, const ConductorProperties &change)
SearchAndReplaceWorker::applyChange.
DiagramContext context
Container for the additional, user-defined fields.
bool contains(const QString &) const
void replaceIndiText(QList< IndependentTextItem *> list)
SearchAndReplaceWorker::replaceIndiText Replace all displayed text of independent text of Each must ...
static QStringList elementInfoKeys()
QETApp::elementInfoKeys.
void replaceElement(QList< Element *> list)
SearchAndReplaceWorker::replaceElement Replace all properties of each elements in All element must b...
QString author
Author of the diagram/folio (displayed by the default template)
static void setupLineEdit(QLineEdit *l, QCheckBox *cb, QString str)
SearchAndReplaceWorker::setupLineEdit With search and replace, when the variable to edit is a text...
QString m_tension_protocol
QString indexrev
Revision Index (displayed by the default template)
TitleBlockProperties m_titleblock_properties
void replaceConductor(QList< Conductor *> list)
SearchAndReplaceWorker::replaceConductor Replace all properties of each conductor in All conductor m...
QString folio
Folio information (displayed by the default template)
void replaceAdvanced(QList< Diagram *> diagrams=QList< Diagram *>(), QList< Element *> elements=QList< Element *>(), QList< IndependentTextItem *> texts=QList< IndependentTextItem *>(), QList< Conductor *> conductors=QList< Conductor *>())
SearchAndReplaceWorker::replaceAdvanced Apply the change of text according to the current advancedStr...
BorderTitleBlock border_and_titleblock
Diagram dimensions and title block.
ConductorProperties m_conductor_properties
QString title
Folio title (displayed by the default template)