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

@@ -96,7 +96,7 @@ bool EllipseEditor::setPart(CustomElementPart *new_part)
if (!new_part)
{
if (part)
disconnectChangeConnections();
disconnectChangeConnections();
part = nullptr;
style_ -> setPart(nullptr);
return(true);
@@ -105,11 +105,11 @@ bool EllipseEditor::setPart(CustomElementPart *new_part)
{
if (part == part_ellipse) return true;
if (part)
disconnectChangeConnections();
disconnectChangeConnections();
part = part_ellipse;
style_ -> setPart(part);
updateForm();
setUpChangeConnections();
setUpChangeConnections();
return(true);
}
return(false);
@@ -117,12 +117,12 @@ bool EllipseEditor::setPart(CustomElementPart *new_part)
bool EllipseEditor::setParts(QList <CustomElementPart *> parts)
{
if (parts.isEmpty())
return false;
if (parts.isEmpty())
return false;
if (!setPart(parts.first()))
return false;
return style_->setParts(parts);
if (!setPart(parts.first()))
return false;
return style_->setParts(parts);
}
/**
@@ -138,98 +138,98 @@ QList<CustomElementPart*> EllipseEditor::currentParts() const {
void EllipseEditor::editingFinishedX()
{
if (m_locked) return;
m_locked = true;
if (m_locked) return;
m_locked = true;
for (auto part: style_->currentParts()) {
for (auto part: style_->currentParts()) {
PartEllipse* ell = static_cast<PartEllipse*>(part);
QRectF rect = ell->property("rect").toRectF();
QPointF point = ell->mapFromScene(x->value() - h->value()/2, y->value() - v->value()/2); // does not matter which value y is, because only the x value is used
rect.setX(point.x()); // change only the x value
PartEllipse* ell = static_cast<PartEllipse*>(part);
QRectF rect = ell->property("rect").toRectF();
QPointF point = ell->mapFromScene(x->value() - h->value()/2, y->value() - v->value()/2); // does not matter which value y is, because only the x value is used
rect.setX(point.x()); // change only the x value
if (rect != part->property("rect"))
{
QPropertyUndoCommand *undo= new QPropertyUndoCommand(ell, "rect", ell->property("rect"), rect);
undo->setText("Modifier un arc");
undo->enableAnimation();
elementScene()->undoStack().push(undo);
}
}
if (rect != part->property("rect"))
{
QPropertyUndoCommand *undo= new QPropertyUndoCommand(ell, "rect", ell->property("rect"), rect);
undo->setText("Modifier un arc");
undo->enableAnimation();
elementScene()->undoStack().push(undo);
}
}
m_locked = false;
m_locked = false;
}
void EllipseEditor::editingFinishedY()
{
if (m_locked) return;
m_locked = true;
if (m_locked) return;
m_locked = true;
for (auto part: style_->currentParts()) {
for (auto part: style_->currentParts()) {
PartEllipse* ell = static_cast<PartEllipse*>(part);
QRectF rect = ell->property("rect").toRectF();
PartEllipse* ell = static_cast<PartEllipse*>(part);
QRectF rect = ell->property("rect").toRectF();
QPointF point = ell->mapFromScene(x->value() - h->value()/2, y->value() - v->value()/2);
rect.setY(point.y());
QPointF point = ell->mapFromScene(x->value() - h->value()/2, y->value() - v->value()/2);
rect.setY(point.y());
if (rect != ell->property("rect"))
{
QPropertyUndoCommand *undo= new QPropertyUndoCommand(ell, "rect", ell->property("rect"), rect);
undo->setText("Modifier un arc");
undo->enableAnimation();
elementScene()->undoStack().push(undo);
}
if (rect != ell->property("rect"))
{
QPropertyUndoCommand *undo= new QPropertyUndoCommand(ell, "rect", ell->property("rect"), rect);
undo->setText("Modifier un arc");
undo->enableAnimation();
elementScene()->undoStack().push(undo);
}
}
m_locked = false;
}
m_locked = false;
}
void EllipseEditor::editingFinishedH()
{
if (m_locked) return;
m_locked = true;
if (m_locked) return;
m_locked = true;
for (auto part: style_->currentParts()) {
for (auto part: style_->currentParts()) {
PartEllipse* ell = static_cast<PartEllipse*>(part);
QRectF rect = ell->property("rect").toRectF();
PartEllipse* ell = static_cast<PartEllipse*>(part);
QRectF rect = ell->property("rect").toRectF();
if (rect.width() != h->value())
{
rect.setWidth(h->value());
QPropertyUndoCommand *undo= new QPropertyUndoCommand(ell, "rect", ell->property("rect"), rect);
undo->setText("Modifier un arc");
undo->enableAnimation();
elementScene()->undoStack().push(undo);
}
}
if (rect.width() != h->value())
{
rect.setWidth(h->value());
QPropertyUndoCommand *undo= new QPropertyUndoCommand(ell, "rect", ell->property("rect"), rect);
undo->setText("Modifier un arc");
undo->enableAnimation();
elementScene()->undoStack().push(undo);
}
}
m_locked = false;
m_locked = false;
}
void EllipseEditor::editingFinishedV()
{
if (m_locked) return;
m_locked = true;
if (m_locked) return;
m_locked = true;
for (auto part: style_->currentParts()) {
PartEllipse* ell = static_cast<PartEllipse*>(part);
QRectF rect = ell->property("rect").toRectF();
if (rect.height() != v->value())
{
rect.setHeight(v->value());
QPropertyUndoCommand *undo= new QPropertyUndoCommand(ell, "rect", ell->property("rect"), rect);
undo->setText("Modifier un arc");
undo->enableAnimation();
elementScene()->undoStack().push(undo);
}
}
for (auto part: style_->currentParts()) {
PartEllipse* ell = static_cast<PartEllipse*>(part);
QRectF rect = ell->property("rect").toRectF();
if (rect.height() != v->value())
{
rect.setHeight(v->value());
QPropertyUndoCommand *undo= new QPropertyUndoCommand(ell, "rect", ell->property("rect"), rect);
undo->setText("Modifier un arc");
undo->enableAnimation();
elementScene()->undoStack().push(undo);
}
}
m_locked = false;
m_locked = false;
}
/**
@@ -255,16 +255,16 @@ void EllipseEditor::activeConnections(bool active)
{
if (active)
{
connect(x, SIGNAL(editingFinished()), this, SLOT(editingFinishedX()));
connect(y, SIGNAL(editingFinished()), this, SLOT(editingFinishedY()));
connect(h, SIGNAL(editingFinished()), this, SLOT(editingFinishedH()));
connect(v, SIGNAL(editingFinished()), this, SLOT(editingFinishedV()));
connect(x, SIGNAL(editingFinished()), this, SLOT(editingFinishedX()));
connect(y, SIGNAL(editingFinished()), this, SLOT(editingFinishedY()));
connect(h, SIGNAL(editingFinished()), this, SLOT(editingFinishedH()));
connect(v, SIGNAL(editingFinished()), this, SLOT(editingFinishedV()));
}
else
{
disconnect(x, SIGNAL(editingFinished()), this, SLOT(editingFinishedX()));
disconnect(y, SIGNAL(editingFinished()), this, SLOT(editingFinishedY()));
disconnect(h, SIGNAL(editingFinished()), this, SLOT(editingFinishedH()));
disconnect(v, SIGNAL(editingFinished()), this, SLOT(editingFinishedV()));
disconnect(x, SIGNAL(editingFinished()), this, SLOT(editingFinishedX()));
disconnect(y, SIGNAL(editingFinished()), this, SLOT(editingFinishedY()));
disconnect(h, SIGNAL(editingFinished()), this, SLOT(editingFinishedH()));
disconnect(v, SIGNAL(editingFinished()), this, SLOT(editingFinishedV()));
}
}