mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 12:40:35 +01:00
Fix indentation code
This commit is contained in:
@@ -58,7 +58,7 @@ DynamicTextFieldEditor::~DynamicTextFieldEditor()
|
||||
*/
|
||||
bool DynamicTextFieldEditor::setPart(CustomElementPart *part)
|
||||
{
|
||||
disconnectConnections();
|
||||
disconnectConnections();
|
||||
|
||||
QGraphicsItem *qgi = part->toItem();
|
||||
if(!qgi)
|
||||
@@ -69,40 +69,40 @@ bool DynamicTextFieldEditor::setPart(CustomElementPart *part)
|
||||
m_text_field = static_cast<PartDynamicTextField *>(qgi);
|
||||
updateForm();
|
||||
|
||||
setUpConnections();
|
||||
setUpConnections();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DynamicTextFieldEditor::setParts(QList <CustomElementPart *> parts) {
|
||||
if (parts.isEmpty())
|
||||
{
|
||||
m_parts.clear();
|
||||
if (m_text_field) {
|
||||
disconnectConnections();
|
||||
}
|
||||
m_text_field = nullptr;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (PartDynamicTextField *part= static_cast<PartDynamicTextField *>(parts.first()))
|
||||
{
|
||||
if (m_text_field) {
|
||||
disconnectConnections();
|
||||
}
|
||||
|
||||
m_text_field = part;
|
||||
m_parts.clear();
|
||||
m_parts.append(part);
|
||||
for (int i=1; i < parts.length(); i++)
|
||||
m_parts.append(static_cast<PartDynamicTextField*>(parts[i]));
|
||||
|
||||
setUpConnections();
|
||||
|
||||
updateForm();
|
||||
return true;
|
||||
}
|
||||
return(false);
|
||||
if (parts.isEmpty())
|
||||
{
|
||||
m_parts.clear();
|
||||
if (m_text_field) {
|
||||
disconnectConnections();
|
||||
}
|
||||
m_text_field = nullptr;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (PartDynamicTextField *part= static_cast<PartDynamicTextField *>(parts.first()))
|
||||
{
|
||||
if (m_text_field) {
|
||||
disconnectConnections();
|
||||
}
|
||||
|
||||
m_text_field = part;
|
||||
m_parts.clear();
|
||||
m_parts.append(part);
|
||||
for (int i=1; i < parts.length(); i++)
|
||||
m_parts.append(static_cast<PartDynamicTextField*>(parts[i]));
|
||||
|
||||
setUpConnections();
|
||||
|
||||
updateForm();
|
||||
return true;
|
||||
}
|
||||
return(false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,11 +115,11 @@ CustomElementPart *DynamicTextFieldEditor::currentPart() const {
|
||||
}
|
||||
|
||||
QList<CustomElementPart*> DynamicTextFieldEditor::currentParts() const {
|
||||
QList<CustomElementPart*> parts;
|
||||
for (auto part: m_parts) {
|
||||
parts.append(static_cast<CustomElementPart*>(part));
|
||||
}
|
||||
return parts;
|
||||
QList<CustomElementPart*> parts;
|
||||
for (auto part: m_parts) {
|
||||
parts.append(static_cast<CustomElementPart*>(part));
|
||||
}
|
||||
return parts;
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::updateForm()
|
||||
@@ -156,26 +156,26 @@ void DynamicTextFieldEditor::updateForm()
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::setUpConnections() {
|
||||
assert(m_connection_list.isEmpty());
|
||||
//Setup the connection
|
||||
m_connection_list << connect(m_text_field.data(), &PartDynamicTextField::colorChanged, [this](){this->updateForm();});
|
||||
m_connection_list << connect(m_text_field.data(), &PartDynamicTextField::fontChanged, [this](){this->updateForm();});
|
||||
m_connection_list << connect(m_text_field.data(), &PartDynamicTextField::taggChanged, [this](){this->updateForm();});
|
||||
m_connection_list << connect(m_text_field.data(), &PartDynamicTextField::textFromChanged, [this](){this->updateForm();});
|
||||
m_connection_list << connect(m_text_field.data(), &PartDynamicTextField::textChanged, [this](){this->updateForm();});
|
||||
m_connection_list << connect(m_text_field.data(), &PartDynamicTextField::infoNameChanged, [this](){this->updateForm();});
|
||||
m_connection_list << connect(m_text_field.data(), &PartDynamicTextField::rotationChanged, [this](){this->updateForm();});
|
||||
m_connection_list << connect(m_text_field.data(), &PartDynamicTextField::frameChanged, [this](){this->updateForm();});
|
||||
m_connection_list << connect(m_text_field.data(), &PartDynamicTextField::textWidthChanged,[this]() {this->updateForm();});
|
||||
m_connection_list << connect(m_text_field.data(), &PartDynamicTextField::compositeTextChanged, [this]() {this->updateForm();});
|
||||
assert(m_connection_list.isEmpty());
|
||||
//Setup the connection
|
||||
m_connection_list << connect(m_text_field.data(), &PartDynamicTextField::colorChanged, [this](){this->updateForm();});
|
||||
m_connection_list << connect(m_text_field.data(), &PartDynamicTextField::fontChanged, [this](){this->updateForm();});
|
||||
m_connection_list << connect(m_text_field.data(), &PartDynamicTextField::taggChanged, [this](){this->updateForm();});
|
||||
m_connection_list << connect(m_text_field.data(), &PartDynamicTextField::textFromChanged, [this](){this->updateForm();});
|
||||
m_connection_list << connect(m_text_field.data(), &PartDynamicTextField::textChanged, [this](){this->updateForm();});
|
||||
m_connection_list << connect(m_text_field.data(), &PartDynamicTextField::infoNameChanged, [this](){this->updateForm();});
|
||||
m_connection_list << connect(m_text_field.data(), &PartDynamicTextField::rotationChanged, [this](){this->updateForm();});
|
||||
m_connection_list << connect(m_text_field.data(), &PartDynamicTextField::frameChanged, [this](){this->updateForm();});
|
||||
m_connection_list << connect(m_text_field.data(), &PartDynamicTextField::textWidthChanged,[this]() {this->updateForm();});
|
||||
m_connection_list << connect(m_text_field.data(), &PartDynamicTextField::compositeTextChanged, [this]() {this->updateForm();});
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::disconnectConnections() {
|
||||
//Remove previous connection
|
||||
if(!m_connection_list.isEmpty())
|
||||
for(const QMetaObject::Connection& con : m_connection_list)
|
||||
disconnect(con);
|
||||
m_connection_list.clear();
|
||||
//Remove previous connection
|
||||
if(!m_connection_list.isEmpty())
|
||||
for(const QMetaObject::Connection& con : m_connection_list)
|
||||
disconnect(con);
|
||||
m_connection_list.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -206,101 +206,101 @@ void DynamicTextFieldEditor::fillInfoComboBox()
|
||||
|
||||
void DynamicTextFieldEditor::on_m_x_sb_editingFinished()
|
||||
{
|
||||
double value = ui->m_x_sb->value();
|
||||
for (int i = 0; i < m_parts.length(); i++) {
|
||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "x", m_parts[i]->x(), value);
|
||||
undo->setText(tr("Déplacer un champ texte"));
|
||||
undo->enableAnimation(true);
|
||||
undoStack().push(undo);
|
||||
}
|
||||
double value = ui->m_x_sb->value();
|
||||
for (int i = 0; i < m_parts.length(); i++) {
|
||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "x", m_parts[i]->x(), value);
|
||||
undo->setText(tr("Déplacer un champ texte"));
|
||||
undo->enableAnimation(true);
|
||||
undoStack().push(undo);
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::on_m_y_sb_editingFinished()
|
||||
{
|
||||
double value = ui->m_y_sb->value();
|
||||
for (int i = 0; i < m_parts.length(); i++) {
|
||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "y", m_parts[i]->y(), value);
|
||||
undo->setText(tr("Déplacer un champ texte"));
|
||||
undo->enableAnimation(true);
|
||||
undoStack().push(undo);
|
||||
}
|
||||
double value = ui->m_y_sb->value();
|
||||
for (int i = 0; i < m_parts.length(); i++) {
|
||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "y", m_parts[i]->y(), value);
|
||||
undo->setText(tr("Déplacer un champ texte"));
|
||||
undo->enableAnimation(true);
|
||||
undoStack().push(undo);
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::on_m_rotation_sb_editingFinished()
|
||||
{
|
||||
int value = ui->m_rotation_sb->value();
|
||||
for (int i = 0; i < m_parts.length(); i++) {
|
||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "rotation", m_parts[i]->rotation(), value);
|
||||
undo->setText(tr("Pivoter un champ texte"));
|
||||
undo->enableAnimation(true);
|
||||
undoStack().push(undo);
|
||||
}
|
||||
int value = ui->m_rotation_sb->value();
|
||||
for (int i = 0; i < m_parts.length(); i++) {
|
||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "rotation", m_parts[i]->rotation(), value);
|
||||
undo->setText(tr("Pivoter un champ texte"));
|
||||
undo->enableAnimation(true);
|
||||
undoStack().push(undo);
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::on_m_user_text_le_editingFinished()
|
||||
{
|
||||
QString text = ui->m_user_text_le->text();
|
||||
for (int i = 0; i < m_parts.length(); i++) {
|
||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "text", m_parts[i]->text(), text);
|
||||
undo->setText(tr("Modifier le texte d'un champ texte"));
|
||||
undoStack().push(undo);
|
||||
}
|
||||
QString text = ui->m_user_text_le->text();
|
||||
for (int i = 0; i < m_parts.length(); i++) {
|
||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "text", m_parts[i]->text(), text);
|
||||
undo->setText(tr("Modifier le texte d'un champ texte"));
|
||||
undoStack().push(undo);
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::on_m_size_sb_editingFinished()
|
||||
{
|
||||
QFont font_ = m_text_field->font();
|
||||
font_.setPointSize(ui->m_size_sb->value());
|
||||
for (int i = 0; i < m_parts.length(); i++) {
|
||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "font", m_parts[i]->font(), font_);
|
||||
undo->setText(tr("Modifier la police d'un champ texte"));
|
||||
undoStack().push(undo);
|
||||
}
|
||||
for (int i = 0; i < m_parts.length(); i++) {
|
||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "font", m_parts[i]->font(), font_);
|
||||
undo->setText(tr("Modifier la police d'un champ texte"));
|
||||
undoStack().push(undo);
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::on_m_frame_cb_clicked()
|
||||
{
|
||||
bool frame = ui->m_frame_cb->isChecked();
|
||||
bool frame = ui->m_frame_cb->isChecked();
|
||||
|
||||
for (int i = 0; i < m_parts.length(); i++) {
|
||||
if(frame != m_parts[i]->frame())
|
||||
{
|
||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "frame", m_parts[i]->frame(), frame);
|
||||
undo->setText(tr("Modifier le cadre d'un champ texte"));
|
||||
undoStack().push(undo);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < m_parts.length(); i++) {
|
||||
if(frame != m_parts[i]->frame())
|
||||
{
|
||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "frame", m_parts[i]->frame(), frame);
|
||||
undo->setText(tr("Modifier le cadre d'un champ texte"));
|
||||
undoStack().push(undo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::on_m_width_sb_editingFinished()
|
||||
{
|
||||
qreal width = (qreal)ui->m_width_sb->value();
|
||||
qreal width = (qreal)ui->m_width_sb->value();
|
||||
|
||||
for (int i = 0; i < m_parts.length(); i++) {
|
||||
if(width != m_parts[i]->textWidth())
|
||||
{
|
||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "textWidth", m_parts[i]->textWidth(), width);
|
||||
undo->setText(tr("Modifier la largeur d'un texte"));
|
||||
undoStack().push(undo);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < m_parts.length(); i++) {
|
||||
if(width != m_parts[i]->textWidth())
|
||||
{
|
||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "textWidth", m_parts[i]->textWidth(), width);
|
||||
undo->setText(tr("Modifier la largeur d'un texte"));
|
||||
undoStack().push(undo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::on_m_elmt_info_cb_activated(const QString &arg1)
|
||||
{
|
||||
Q_UNUSED(arg1)
|
||||
Q_UNUSED(arg1)
|
||||
|
||||
QString info = ui->m_elmt_info_cb->currentData().toString();
|
||||
for (int i = 0; i < m_parts.length(); i++) {
|
||||
if(info != m_parts[i]->infoName())
|
||||
{
|
||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "infoName", m_parts[i]->infoName(), info);
|
||||
undo->setText(tr("Modifier l'information d'un texte"));
|
||||
undoStack().push(undo);
|
||||
|
||||
m_parts[i]->setPlainText(elementEditor()->elementScene()->elementInformation().value(m_parts[i]->infoName()).toString());
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < m_parts.length(); i++) {
|
||||
if(info != m_parts[i]->infoName())
|
||||
{
|
||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "infoName", m_parts[i]->infoName(), info);
|
||||
undo->setText(tr("Modifier l'information d'un texte"));
|
||||
undoStack().push(undo);
|
||||
|
||||
m_parts[i]->setPlainText(elementEditor()->elementScene()->elementInformation().value(m_parts[i]->infoName()).toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::on_m_text_from_cb_activated(int index)
|
||||
@@ -308,7 +308,7 @@ void DynamicTextFieldEditor::on_m_text_from_cb_activated(int index)
|
||||
ui->m_user_text_le->setDisabled(true);
|
||||
ui->m_elmt_info_cb->setDisabled(true);
|
||||
ui->m_composite_text_pb->setDisabled(true);
|
||||
|
||||
|
||||
if(index == 0)
|
||||
ui->m_user_text_le->setEnabled(true);
|
||||
else if (index == 1)
|
||||
@@ -321,14 +321,14 @@ void DynamicTextFieldEditor::on_m_text_from_cb_activated(int index)
|
||||
else if(index == 1) tf = DynamicElementTextItem::ElementInfo;
|
||||
else tf = DynamicElementTextItem::CompositeText;
|
||||
|
||||
for (int i = 0; i < m_parts.length(); i++) {
|
||||
if(tf != m_parts[i]->textFrom())
|
||||
{
|
||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "textFrom", m_parts[i]->textFrom(), tf);
|
||||
undo->setText(tr("Modifier la source de texte, d'un texte"));
|
||||
undoStack().push(undo);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < m_parts.length(); i++) {
|
||||
if(tf != m_parts[i]->textFrom())
|
||||
{
|
||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "textFrom", m_parts[i]->textFrom(), tf);
|
||||
undo->setText(tr("Modifier la source de texte, d'un texte"));
|
||||
undoStack().push(undo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::on_m_composite_text_pb_clicked()
|
||||
@@ -337,29 +337,29 @@ void DynamicTextFieldEditor::on_m_composite_text_pb_clicked()
|
||||
if(ctd.exec())
|
||||
{
|
||||
QString ct = ctd.plainText();
|
||||
for (int i = 0; i < m_parts.length(); i++) {
|
||||
if(ct != m_parts[i]->compositeText())
|
||||
{
|
||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "compositeText", m_parts[i]->compositeText(), ctd.plainText());
|
||||
undoStack().push(undo);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < m_parts.length(); i++) {
|
||||
if(ct != m_parts[i]->compositeText())
|
||||
{
|
||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "compositeText", m_parts[i]->compositeText(), ctd.plainText());
|
||||
undoStack().push(undo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::on_m_alignment_pb_clicked()
|
||||
{
|
||||
AlignmentTextDialog atd(m_text_field.data()->alignment(), this);
|
||||
AlignmentTextDialog atd(m_text_field.data()->alignment(), this);
|
||||
atd.exec();
|
||||
|
||||
for (int i = 0; i < m_parts.length(); i++) {
|
||||
if(atd.alignment() != m_parts[i]->alignment())
|
||||
{
|
||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "alignment", QVariant(m_parts[i]->alignment()), QVariant(atd.alignment()));
|
||||
undo->setText(tr("Modifier l'alignement d'un champ texte"));
|
||||
undoStack().push(undo);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < m_parts.length(); i++) {
|
||||
if(atd.alignment() != m_parts[i]->alignment())
|
||||
{
|
||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "alignment", QVariant(m_parts[i]->alignment()), QVariant(atd.alignment()));
|
||||
undo->setText(tr("Modifier l'alignement d'un champ texte"));
|
||||
undoStack().push(undo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::on_m_font_pb_clicked()
|
||||
@@ -370,26 +370,26 @@ void DynamicTextFieldEditor::on_m_font_pb_clicked()
|
||||
{
|
||||
ui->m_font_pb->setText(font_.family());
|
||||
ui->m_size_sb->setValue(font_.pointSize());
|
||||
|
||||
for (int i = 0; i < m_parts.length(); i++) {
|
||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "font", m_parts[i]->font(), font_);
|
||||
undo->setText(tr("Modifier la police d'un champ texte"));
|
||||
undoStack().push(undo);
|
||||
}
|
||||
|
||||
for (int i = 0; i < m_parts.length(); i++) {
|
||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "font", m_parts[i]->font(), font_);
|
||||
undo->setText(tr("Modifier la police d'un champ texte"));
|
||||
undoStack().push(undo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::on_m_color_kpb_changed(const QColor &newColor)
|
||||
{
|
||||
if (!newColor.isValid())
|
||||
return;
|
||||
|
||||
for (int i = 0; i < m_parts.length(); i++) {
|
||||
if(newColor != m_parts[i]->color())
|
||||
{
|
||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "color", m_parts[i]->color(), newColor);
|
||||
undo->setText(tr("Modifier la couleur d'un champ texte"));
|
||||
undoStack().push(undo);
|
||||
}
|
||||
}
|
||||
if (!newColor.isValid())
|
||||
return;
|
||||
|
||||
for (int i = 0; i < m_parts.length(); i++) {
|
||||
if(newColor != m_parts[i]->color())
|
||||
{
|
||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "color", m_parts[i]->color(), newColor);
|
||||
undo->setText(tr("Modifier la couleur d'un champ texte"));
|
||||
undoStack().push(undo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user