Implemented QET coding style (replaced 4 space with tab)

This commit is contained in:
Adrien Allain
2021-09-13 21:00:44 +02:00
committed by Laurent Trinques
parent c640d96bca
commit ccfb46b354
10 changed files with 83 additions and 83 deletions

View File

@@ -613,63 +613,63 @@ void changeElementDataCommand::redo() {
RotateElementsCommand::RotateElementsCommand(ElementScene *scene, QUndoCommand *parent) :
ElementEditionCommand(QObject::tr("Pivoter la selection", "undo caption"), scene, nullptr, parent)
{
m_items = scene->selectedItems();
m_items = scene->selectedItems();
}
/**
@brief RotateElementsCommand::undo
@brief RotateElementsCommand::undo
*/
void RotateElementsCommand::undo()
{
for (QGraphicsItem *item : m_items)
{
if (item->type() == PartTerminal::Type) {
PartTerminal* term = qgraphicsitem_cast<PartTerminal*>(item);
term->setRotation(term->rotation()-90);
}
else if (item->type() == PartRectangle::Type) {
PartRectangle* rect = qgraphicsitem_cast<PartRectangle*>(item);
rect->setRotation(rect->rotation()-90);
}
else if (item->type() == PartLine::Type) {
PartLine* line = qgraphicsitem_cast<PartLine*>(item);
line->setRotation(line->rotation()-90);
}
else if (item->type() == PartPolygon::Type) {
PartPolygon* poly = qgraphicsitem_cast<PartPolygon*>(item);
poly->setRotation(poly->rotation()-90);
}
else {
item->setRotation(item->rotation()-90);
}
}
for (QGraphicsItem *item : m_items)
{
if (item->type() == PartTerminal::Type) {
PartTerminal* term = qgraphicsitem_cast<PartTerminal*>(item);
term->setRotation(term->rotation()-90);
}
else if (item->type() == PartRectangle::Type) {
PartRectangle* rect = qgraphicsitem_cast<PartRectangle*>(item);
rect->setRotation(rect->rotation()-90);
}
else if (item->type() == PartLine::Type) {
PartLine* line = qgraphicsitem_cast<PartLine*>(item);
line->setRotation(line->rotation()-90);
}
else if (item->type() == PartPolygon::Type) {
PartPolygon* poly = qgraphicsitem_cast<PartPolygon*>(item);
poly->setRotation(poly->rotation()-90);
}
else {
item->setRotation(item->rotation()-90);
}
}
}
/**
@brief RotateElementsCommand::redo
@brief RotateElementsCommand::redo
*/
void RotateElementsCommand::redo()
{
for (QGraphicsItem *item : m_items)
{
if (item->type() == PartTerminal::Type) {
PartTerminal* term = qgraphicsitem_cast<PartTerminal*>(item);
term->setRotation(term->rotation()+90);
}
else if (item->type() == PartRectangle::Type) {
PartRectangle* rect = qgraphicsitem_cast<PartRectangle*>(item);
rect->setRotation(rect->rotation()+90);
}
else if (item->type() == PartLine::Type) {
PartLine* line = qgraphicsitem_cast<PartLine*>(item);
line->setRotation(line->rotation()+90);
}
else if (item->type() == PartPolygon::Type) {
PartPolygon* poly = qgraphicsitem_cast<PartPolygon*>(item);
poly->setRotation(poly->rotation()+90);
}
else {
item->setRotation(item->rotation()+90);
}
}
for (QGraphicsItem *item : m_items)
{
if (item->type() == PartTerminal::Type) {
PartTerminal* term = qgraphicsitem_cast<PartTerminal*>(item);
term->setRotation(term->rotation()+90);
}
else if (item->type() == PartRectangle::Type) {
PartRectangle* rect = qgraphicsitem_cast<PartRectangle*>(item);
rect->setRotation(rect->rotation()+90);
}
else if (item->type() == PartLine::Type) {
PartLine* line = qgraphicsitem_cast<PartLine*>(item);
line->setRotation(line->rotation()+90);
}
else if (item->type() == PartPolygon::Type) {
PartPolygon* poly = qgraphicsitem_cast<PartPolygon*>(item);
poly->setRotation(poly->rotation()+90);
}
else {
item->setRotation(item->rotation()+90);
}
}
}

View File

@@ -605,14 +605,14 @@ void PartLine::setSecondEndLength(const qreal &l)
void PartLine::setRotation(qreal angle) {
QTransform rotation = QTransform().translate(m_line.p1().x(),m_line.p1().y()).rotate(angle-m_rot).translate(-m_line.p1().x(),-m_line.p1().y());
m_rot=angle;
QTransform rotation = QTransform().translate(m_line.p1().x(),m_line.p1().y()).rotate(angle-m_rot).translate(-m_line.p1().x(),-m_line.p1().y());
m_rot=angle;
setLine(rotation.map(m_line));
setLine(rotation.map(m_line));
}
qreal PartLine::rotation() const {
return m_rot;
return m_rot;
}

View File

@@ -94,8 +94,8 @@ class PartLine : public CustomElementGraphicPart
void setFirstEndLength(const qreal &l);
qreal secondEndLength() const {return second_length;}
void setSecondEndLength(const qreal &l);
void setRotation(qreal angle);
qreal rotation() const;
void setRotation(qreal angle);
qreal rotation() const;
protected:
QVariant itemChange(GraphicsItemChange change, const QVariant &value) override;

View File

@@ -296,14 +296,14 @@ void PartPolygon::resetAllHandlerColor()
void PartPolygon::setRotation(qreal angle) {
QTransform rotation = QTransform().translate(m_polygon.first().x(),m_polygon.first().y()).rotate(angle-m_rot).translate(-m_polygon.first().x(),-m_polygon.first().y());
m_rot=angle;
QTransform rotation = QTransform().translate(m_polygon.first().x(),m_polygon.first().y()).rotate(angle-m_rot).translate(-m_polygon.first().x(),-m_polygon.first().y());
m_rot=angle;
setPolygon(rotation.map(m_polygon));
setPolygon(rotation.map(m_polygon));
}
qreal PartPolygon::rotation() const {
return m_rot;
return m_rot;
}

View File

@@ -87,8 +87,8 @@ class PartPolygon : public CustomElementGraphicPart
void setHandlerColor(QPointF pos, const QColor &color) final;
void resetAllHandlerColor() final;
void setRotation (qreal angle);
qreal rotation () const;
void setRotation (qreal angle);
qreal rotation () const;
protected:
QVariant itemChange(GraphicsItemChange change, const QVariant &value) override;

View File

@@ -173,14 +173,14 @@ void PartRectangle::setYRadius(qreal Y)
void PartRectangle::setRotation(qreal angle) {
QTransform rotation = QTransform().rotate(angle-m_rot);
m_rot=angle;
QTransform rotation = QTransform().rotate(angle-m_rot);
m_rot=angle;
setRect(rotation.mapRect(m_rect));
setRect(rotation.mapRect(m_rect));
}
qreal PartRectangle::rotation() const {
return m_rot;
return m_rot;
}
/**

View File

@@ -71,8 +71,8 @@ class PartRectangle : public CustomElementGraphicPart
void setXRadius(qreal X);
qreal YRadius() const {return m_yRadius;}
void setYRadius(qreal Y);
void setRotation(qreal angle);
qreal rotation() const;
void setRotation(qreal angle);
qreal rotation() const;
QRectF sceneGeometricRect() const override;
virtual QPointF sceneTopLeft() const;

View File

@@ -154,28 +154,28 @@ void PartTerminal::setOrientation(Qet::Orientation ori) {
}
/**
Redéfinit la fonction de rotation pour la traduire en orientation de la borne
@param angle
Redefines setRotation to call setOrientation
@param angle
*/
void PartTerminal::setRotation(qreal angle) {
qreal angle_mod = std::fmod(angle,360);
Qet::Orientation new_ori = Qet::North;
qreal angle_mod = std::fmod(angle,360);
Qet::Orientation new_ori = Qet::North;
if (0 <= angle_mod && angle_mod < 90 ) new_ori = Qet::North;
else if (90 <= angle_mod && angle_mod < 180) new_ori = Qet::East;
else if (180 <= angle_mod && angle_mod < 270) new_ori = Qet::South;
else new_ori = Qet::West;
if (0 <= angle_mod && angle_mod < 90 ) new_ori = Qet::North;
else if (90 <= angle_mod && angle_mod < 180) new_ori = Qet::East;
else if (180 <= angle_mod && angle_mod < 270) new_ori = Qet::South;
else new_ori = Qet::West;
setOrientation(new_ori);
setOrientation(new_ori);
}
qreal PartTerminal::rotation() const {
switch (d->m_orientation) {
case Qet::North : return 0;
case Qet::East : return 90;
case Qet::South : return 180;
case Qet::West : return 270;
}
switch (d->m_orientation) {
case Qet::North : return 0;
case Qet::East : return 90;
case Qet::South : return 180;
case Qet::West : return 270;
}
}
/**

View File

@@ -74,8 +74,8 @@ class PartTerminal : public CustomElementGraphicPart
Qet::Orientation orientation() const {return d -> m_orientation;}
void setOrientation(Qet::Orientation ori);
qreal rotation() const;
void setRotation(qreal angle);
qreal rotation() const;
void setRotation(qreal angle);
QString name() const override { return d -> m_name; }

View File

@@ -1020,7 +1020,7 @@ void QETElementEditor::setupActions()
addToolBar(Qt::TopToolBarArea, depth_toolbar);
//Rotate action
connect(ui->m_rotate_action, &QAction::triggered, [this]() {this -> elementScene() -> undoStack().push(new RotateElementsCommand(this->elementScene()));});
connect(ui->m_rotate_action, &QAction::triggered, [this]() {this -> elementScene() -> undoStack().push(new RotateElementsCommand(this->elementScene()));});
//Zoom action
ui->m_zoom_in_action -> setShortcut(QKeySequence::ZoomIn);