Fix indentation code

This commit is contained in:
Laurent Trinques
2020-07-15 20:20:07 +02:00
parent 6313319f80
commit 68e78a0de9
38 changed files with 2625 additions and 2625 deletions

View File

@@ -107,19 +107,19 @@ bool TextEditor::setPart(CustomElementPart *part)
if (!part)
{
m_text = nullptr;
disconnectChangeConnection();
disconnectChangeConnection();
return true;
}
if (PartText *part_text = static_cast<PartText *>(part))
if (PartText *part_text = static_cast<PartText *>(part))
{
if (part_text == m_text) {
return true;
}
m_text = part_text;
setUpChangeConnection(m_text);
setUpChangeConnection(m_text);
updateForm();
return true;
}
@@ -127,34 +127,34 @@ bool TextEditor::setPart(CustomElementPart *part)
}
bool TextEditor::setParts(QList <CustomElementPart *> parts) {
if (parts.isEmpty())
{
m_parts.clear();
if (m_text) {
disconnectChangeConnection();
}
m_text = nullptr;
return true;
}
if (PartText *part= static_cast<PartText *>(parts.first()))
{
if (m_text) {
disconnectChangeConnection();
}
m_text = part;
m_parts.clear();
m_parts.append(part);
for (int i=1; i < parts.length(); i++)
m_parts.append(static_cast<PartText*>(parts[i]));
setUpChangeConnection(m_text);
updateForm();
return true;
}
return(false);
if (parts.isEmpty())
{
m_parts.clear();
if (m_text) {
disconnectChangeConnection();
}
m_text = nullptr;
return true;
}
if (PartText *part= static_cast<PartText *>(parts.first()))
{
if (m_text) {
disconnectChangeConnection();
}
m_text = part;
m_parts.clear();
m_parts.append(part);
for (int i=1; i < parts.length(); i++)
m_parts.append(static_cast<PartText*>(parts[i]));
setUpChangeConnection(m_text);
updateForm();
return true;
}
return(false);
}
/**
@@ -166,11 +166,11 @@ CustomElementPart *TextEditor::currentPart() const {
}
QList<CustomElementPart*> TextEditor::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;
}
/**
@@ -180,77 +180,77 @@ QList<CustomElementPart*> TextEditor::currentParts() const {
*/
void TextEditor::setUpEditConnection()
{
disconnectEditConnection();
disconnectEditConnection();
m_edit_connection << connect(ui->m_line_edit, &QLineEdit::textEdited, [this]()
{
QString text_ = ui->m_line_edit->text();
for (int i=0; i < m_parts.length(); i++) {
PartText* partText = m_parts[i];
if (text_ != partText->toPlainText())
{
QPropertyUndoCommand *undo = new QPropertyUndoCommand(partText, "text", partText->toPlainText(), text_);
undo->setText(tr("Modifier le contenu d'un champ texte"));
undoStack().push(undo);
}
}
for (int i=0; i < m_parts.length(); i++) {
PartText* partText = m_parts[i];
if (text_ != partText->toPlainText())
{
QPropertyUndoCommand *undo = new QPropertyUndoCommand(partText, "text", partText->toPlainText(), text_);
undo->setText(tr("Modifier le contenu d'un champ texte"));
undoStack().push(undo);
}
}
});
m_edit_connection << connect(ui->m_x_sb, QOverload<int>::of(&QSpinBox::valueChanged), [this]()
{
QPointF pos(ui->m_x_sb->value(), 0);
for (int i=0; i < m_parts.length(); i++) {
PartText* partText = m_parts[i];
pos.setY(partText->pos().y());
if (pos != partText->pos())
{
QPropertyUndoCommand *undo = new QPropertyUndoCommand(partText, "pos", partText->pos(), pos);
undo->setText(tr("Déplacer un champ texte"));
undo->setAnimated(true, false);
undoStack().push(undo);
}
}
QPointF pos(ui->m_x_sb->value(), 0);
for (int i=0; i < m_parts.length(); i++) {
PartText* partText = m_parts[i];
pos.setY(partText->pos().y());
if (pos != partText->pos())
{
QPropertyUndoCommand *undo = new QPropertyUndoCommand(partText, "pos", partText->pos(), pos);
undo->setText(tr("Déplacer un champ texte"));
undo->setAnimated(true, false);
undoStack().push(undo);
}
}
});
m_edit_connection << connect(ui->m_y_sb, QOverload<int>::of(&QSpinBox::valueChanged), [this]()
{
QPointF pos(0, ui->m_y_sb->value());
for (int i=0; i < m_parts.length(); i++) {
PartText* partText = m_parts[i];
pos.setX(partText->pos().x());
if (pos != partText->pos())
{
QPropertyUndoCommand *undo = new QPropertyUndoCommand(partText, "pos", partText->pos(), pos);
undo->setText(tr("Déplacer un champ texte"));
undo->setAnimated(true, false);
undoStack().push(undo);
}
}
QPointF pos(0, ui->m_y_sb->value());
for (int i=0; i < m_parts.length(); i++) {
PartText* partText = m_parts[i];
pos.setX(partText->pos().x());
if (pos != partText->pos())
{
QPropertyUndoCommand *undo = new QPropertyUndoCommand(partText, "pos", partText->pos(), pos);
undo->setText(tr("Déplacer un champ texte"));
undo->setAnimated(true, false);
undoStack().push(undo);
}
}
});
m_edit_connection << connect(ui->m_rotation_sb, QOverload<int>::of(&QSpinBox::valueChanged), [this]()
{
for (int i=0; i < m_parts.length(); i++) {
PartText* partText = m_parts[i];
if (ui->m_rotation_sb->value() != partText->rotation())
{
QPropertyUndoCommand *undo = new QPropertyUndoCommand(partText, "rotation", partText->rotation(), ui->m_rotation_sb->value());
undo->setText(tr("Pivoter un champ texte"));
undo->setAnimated(true, false);
undoStack().push(undo);
}
}
for (int i=0; i < m_parts.length(); i++) {
PartText* partText = m_parts[i];
if (ui->m_rotation_sb->value() != partText->rotation())
{
QPropertyUndoCommand *undo = new QPropertyUndoCommand(partText, "rotation", partText->rotation(), ui->m_rotation_sb->value());
undo->setText(tr("Pivoter un champ texte"));
undo->setAnimated(true, false);
undoStack().push(undo);
}
}
});
m_edit_connection << connect(ui->m_size_sb, QOverload<int>::of(&QSpinBox::valueChanged), [this]()
{
for (int i=0; i < m_parts.length(); i++) {
PartText* partText = m_parts[i];
if (partText->font().pointSize() != ui->m_size_sb->value())
{
QFont font_ = partText->font();
font_.setPointSize(ui->m_size_sb->value());
QPropertyUndoCommand *undo = new QPropertyUndoCommand(partText, "font", partText->font(), font_);
undo->setText(tr("Modifier la police d'un texte"));
undoStack().push(undo);
}
}
for (int i=0; i < m_parts.length(); i++) {
PartText* partText = m_parts[i];
if (partText->font().pointSize() != ui->m_size_sb->value())
{
QFont font_ = partText->font();
font_.setPointSize(ui->m_size_sb->value());
QPropertyUndoCommand *undo = new QPropertyUndoCommand(partText, "font", partText->font(), font_);
undo->setText(tr("Modifier la police d'un texte"));
undoStack().push(undo);
}
}
});
}
@@ -261,24 +261,24 @@ void TextEditor::on_m_font_pb_clicked()
{
bool ok;
QFont font_ = QFontDialog::getFont(&ok, m_text->font(), this);
if (ok && font_ != m_text->font()) {
ui->m_size_sb->blockSignals(true);
ui->m_size_sb->setValue(font_.pointSize());
ui->m_size_sb->blockSignals(false);
ui->m_font_pb->setText(font_.family());
}
for (int i=0; i < m_parts.length(); i++) {
PartText* partText = m_parts[i];
if (ok && font_ != partText->font())
{
QPropertyUndoCommand *undo = new QPropertyUndoCommand(partText, "font", partText->font(), font_);
undo->setText(tr("Modifier la police d'un texte"));
undoStack().push(undo);
}
}
if (ok && font_ != m_text->font()) {
ui->m_size_sb->blockSignals(true);
ui->m_size_sb->setValue(font_.pointSize());
ui->m_size_sb->blockSignals(false);
ui->m_font_pb->setText(font_.family());
}
for (int i=0; i < m_parts.length(); i++) {
PartText* partText = m_parts[i];
if (ok && font_ != partText->font())
{
QPropertyUndoCommand *undo = new QPropertyUndoCommand(partText, "font", partText->font(), font_);
undo->setText(tr("Modifier la police d'un texte"));
undoStack().push(undo);
}
}
}
/**
@@ -287,13 +287,13 @@ void TextEditor::on_m_font_pb_clicked()
*/
void TextEditor::on_m_color_pb_changed(const QColor &newColor)
{
for (int i=0; i < m_parts.length(); i++) {
PartText* partText = m_parts[i];
if (newColor != partText->defaultTextColor())
{
QPropertyUndoCommand *undo = new QPropertyUndoCommand(partText, "color", partText->defaultTextColor(), newColor);
undo->setText(tr("Modifier la couleur d'un texte"));
undoStack().push(undo);
}
}
for (int i=0; i < m_parts.length(); i++) {
PartText* partText = m_parts[i];
if (newColor != partText->defaultTextColor())
{
QPropertyUndoCommand *undo = new QPropertyUndoCommand(partText, "color", partText->defaultTextColor(), newColor);
undo->setText(tr("Modifier la couleur d'un texte"));
undoStack().push(undo);
}
}
}