Apply clang-tidy's modernize-use-auto

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5449 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
scorpio810
2018-07-19 16:27:20 +00:00
parent e4b1ba9797
commit b97b01d63c
98 changed files with 427 additions and 427 deletions

View File

@@ -696,7 +696,7 @@ bool Conductor::sceneEventFilter(QGraphicsItem *watched, QEvent *event)
//Watched must be an handler
if(watched->type() == QetGraphicsHandlerItem::Type)
{
QetGraphicsHandlerItem *qghi = qgraphicsitem_cast<QetGraphicsHandlerItem *>(watched);
auto *qghi = qgraphicsitem_cast<QetGraphicsHandlerItem *>(watched);
if(m_handler_vector.contains(qghi)) //Handler must be in m_vector_index, then we can start resize
{
@@ -1352,7 +1352,7 @@ void Conductor::saveProfile(bool undo) {
conductor_profiles[current_path_type].fromConductor(this);
Diagram *dia = diagram();
if (undo && dia) {
ChangeConductorCommand *undo_object = new ChangeConductorCommand(
auto *undo_object = new ChangeConductorCommand(
this,
old_profile,
conductor_profiles[current_path_type],

View File

@@ -205,7 +205,7 @@ void ConductorTextItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) {
if (!applied_movement.isNull()) {
//Create an undo object
MoveConductorsTextsCommand *undo_object = new MoveConductorsTextsCommand(diagram_ptr);
auto *undo_object = new MoveConductorsTextsCommand(diagram_ptr);
undo_object -> addTextMovement(this, before_mov_pos_, pos(), moved_by_user_);
moved_by_user_ = true;

View File

@@ -370,7 +370,7 @@ bool CustomElement::parseLine(QDomElement &e, QPainter &qp, bool addtolist) {
if (addtolist){
//Add line to the list
QLineF *newLine = new QLineF(line);
auto *newLine = new QLineF(line);
m_lines << newLine;
}
@@ -475,7 +475,7 @@ bool CustomElement::parseRect(QDomElement &e, QPainter &qp, bool addtolist)
if (addtolist){
//Add rectangle to the list
QRectF *rect = new QRectF(rect_x, rect_y, rect_w, rect_h);
auto *rect = new QRectF(rect_x, rect_y, rect_w, rect_h);
m_rectangles << rect;
}
@@ -516,7 +516,7 @@ bool CustomElement::parseCircle(QDomElement &e, QPainter &qp, bool addtolist) {
if (addtolist){
// Add circle to list
QRectF *circle = new QRectF(circle_bounding_rect);
auto *circle = new QRectF(circle_bounding_rect);
m_circles << circle;
}
@@ -549,7 +549,7 @@ bool CustomElement::parseEllipse(QDomElement &e, QPainter &qp, bool addtolist) {
setPainterStyle(e, qp);
if (addtolist){
QVector<qreal> *arc = new QVector<qreal>;
auto *arc = new QVector<qreal>;
arc -> push_back(ellipse_x);
arc -> push_back(ellipse_y);
arc -> push_back(ellipse_l);
@@ -592,7 +592,7 @@ bool CustomElement::parseArc(QDomElement &e, QPainter &qp, bool addtolist) {
setPainterStyle(e, qp);
if (addtolist){
QVector<qreal> *arc = new QVector<qreal>;
auto *arc = new QVector<qreal>;
arc -> push_back(arc_x);
arc -> push_back(arc_y);
arc -> push_back(arc_l);
@@ -647,7 +647,7 @@ bool CustomElement::parsePolygon(QDomElement &e, QPainter &qp, bool addtolist) {
}
if (addtolist){
// Add to list of polygons.
QVector<QPointF> *poly = new QVector<QPointF>(points);
auto *poly = new QVector<QPointF>(points);
m_polygons << poly;
}
@@ -743,7 +743,7 @@ bool CustomElement::parseInput(QDomElement &dom_element) {
) return(false);
else
{
DynamicElementTextItem *deti = new DynamicElementTextItem(this);
auto *deti = new DynamicElementTextItem(this);
deti->setText(dom_element.attribute("text", "_"));
deti->setFontSize(dom_element.attribute("size", QString::number(9)).toInt());
deti->setRotation(dom_element.attribute("rotation", QString::number(0)).toDouble());
@@ -782,7 +782,7 @@ bool CustomElement::parseInput(QDomElement &dom_element) {
*/
DynamicElementTextItem *CustomElement::parseDynamicText(QDomElement &dom_element)
{
DynamicElementTextItem *deti = new DynamicElementTextItem(this);
auto *deti = new DynamicElementTextItem(this);
//Because the xml description of a .elmt file is the same as how a dynamic text field is save to xml in a .qet file
//wa call fromXml, we just change the tagg name (.elmt = dynamic_text, .qet = dynamic_elmt_text)
//and the uuid (because the uuid, is the uuid of the descritpion and not the uuid of instantiated dynamic text field)
@@ -817,7 +817,7 @@ Terminal *CustomElement::parseTerminal(QDomElement &e) {
else if (e.attribute("orientation") == "e") terminalo = Qet::East;
else if (e.attribute("orientation") == "w") terminalo = Qet::West;
else return(nullptr);
Terminal *new_terminal = new Terminal(terminalx, terminaly, terminalo, this);
auto *new_terminal = new Terminal(terminalx, terminaly, terminalo, this);
m_terminals << new_terminal;
//Sort from top to bottom and left to rigth

View File

@@ -218,7 +218,7 @@ ElementTextItemGroup *DynamicElementTextItem::parentGroup() const
{
if(parentItem())
{
if(ElementTextItemGroup *grp = dynamic_cast<ElementTextItemGroup *>(parentItem()))
if(auto *grp = dynamic_cast<ElementTextItemGroup *>(parentItem()))
return grp;
}

View File

@@ -78,7 +78,7 @@ Element::Element(QGraphicsItem *parent) :
connect(this, &Element::rotationChanged, [this]() {
for(QGraphicsItem *qgi : childItems())
{
if (Terminal *t = qgraphicsitem_cast<Terminal *>(qgi))
if (auto *t = qgraphicsitem_cast<Terminal *>(qgi))
t->updateConductor();
}
});
@@ -96,7 +96,7 @@ void Element::editProperty()
{
if (diagram() && !diagram()->isReadOnly())
{
ElementPropertiesWidget *epw = new ElementPropertiesWidget(this);
auto *epw = new ElementPropertiesWidget(this);
PropertiesEditorDialog dialog(epw, QApplication::activeWindow());
connect(epw, &ElementPropertiesWidget::findEditClicked, &dialog, &QDialog::reject);
//Must be windowModal, else when user do a drag and drop
@@ -370,7 +370,7 @@ bool Element::fromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr, bool
QHash<int, Terminal *> priv_id_adr;
int terminals_non_trouvees = 0;
foreach(QGraphicsItem *qgi, childItems()) {
if (Terminal *p = qgraphicsitem_cast<Terminal *>(qgi)) {
if (auto *p = qgraphicsitem_cast<Terminal *>(qgi)) {
bool terminal_trouvee = false;
foreach(QDomElement qde, liste_terminals) {
if (p -> fromXml(qde)) {
@@ -454,7 +454,7 @@ bool Element::fromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr, bool
//************************//
for (const QDomElement& qde : QET::findInDomElement(e, "dynamic_texts", DynamicElementTextItem::xmlTaggName()))
{
DynamicElementTextItem *deti = new DynamicElementTextItem(this);
auto *deti = new DynamicElementTextItem(this);
addDynamicTextItem(deti);
deti->fromXml(qde);
}
@@ -856,7 +856,7 @@ void Element::addDynamicTextItem(DynamicElementTextItem *deti)
}
else
{
DynamicElementTextItem *text = new DynamicElementTextItem(this);
auto *text = new DynamicElementTextItem(this);
m_dynamic_text_list.append(text);
emit textAdded(text);
}
@@ -911,7 +911,7 @@ ElementTextItemGroup *Element::addTextGroup(const QString &name)
{
if(m_texts_group.isEmpty())
{
ElementTextItemGroup *group = new ElementTextItemGroup(name, this);
auto *group = new ElementTextItemGroup(name, this);
m_texts_group << group;
emit textsGroupAdded(group);
return group;
@@ -927,7 +927,7 @@ ElementTextItemGroup *Element::addTextGroup(const QString &name)
}
//Create the group
ElementTextItemGroup *group = new ElementTextItemGroup(rename, this);
auto *group = new ElementTextItemGroup(rename, this);
m_texts_group << group;
emit textsGroupAdded(group);
return group;
@@ -966,7 +966,7 @@ void Element::removeTextGroup(ElementTextItemGroup *group)
{
if(qgi->type() == DynamicElementTextItem::Type)
{
DynamicElementTextItem *deti = static_cast<DynamicElementTextItem *>(qgi);
auto *deti = static_cast<DynamicElementTextItem *>(qgi);
removeTextFromGroup(deti, group);
}
}

View File

@@ -66,7 +66,7 @@ void ElementTextItemGroup::addToGroup(QGraphicsItem *item)
QGraphicsItemGroup::addToGroup(item);
updateAlignment();
DynamicElementTextItem *deti = qgraphicsitem_cast<DynamicElementTextItem *>(item);
auto *deti = qgraphicsitem_cast<DynamicElementTextItem *>(item);
connect(deti, &DynamicElementTextItem::fontSizeChanged, this, &ElementTextItemGroup::updateAlignment);
connect(deti, &DynamicElementTextItem::textChanged, this, &ElementTextItemGroup::updateAlignment);
connect(deti, &DynamicElementTextItem::textFromChanged, this, &ElementTextItemGroup::updateAlignment);
@@ -96,7 +96,7 @@ void ElementTextItemGroup::removeFromGroup(QGraphicsItem *item)
item->setFlag(QGraphicsItem::ItemIsSelectable, true);
updateAlignment();
if(DynamicElementTextItem *deti = qgraphicsitem_cast<DynamicElementTextItem *>(item))
if(auto *deti = qgraphicsitem_cast<DynamicElementTextItem *>(item))
{
disconnect(deti, &DynamicElementTextItem::fontSizeChanged, this, &ElementTextItemGroup::updateAlignment);
disconnect(deti, &DynamicElementTextItem::textChanged, this, &ElementTextItemGroup::updateAlignment);
@@ -780,7 +780,7 @@ void ElementTextItemGroup::autoPos()
if(!diagram())
return;
MasterElement *master = static_cast<MasterElement *>(m_parent_element);
auto *master = static_cast<MasterElement *>(m_parent_element);
XRefProperties xrp = diagram()->project()->defaultXRefProperties(master->kindInformations()["type"].toString());
if(xrp.snapTo() == XRefProperties::Bottom)
{

View File

@@ -408,7 +408,7 @@ bool QetShapeItem::sceneEventFilter(QGraphicsItem *watched, QEvent *event)
//Watched must be an handler
if(watched->type() == QetGraphicsHandlerItem::Type)
{
QetGraphicsHandlerItem *qghi = qgraphicsitem_cast<QetGraphicsHandlerItem *>(watched);
auto *qghi = qgraphicsitem_cast<QetGraphicsHandlerItem *>(watched);
if(m_handler_vector.contains(qghi)) //Handler must be in m_vector_index, then we can start resize
{

View File

@@ -150,7 +150,7 @@ Terminal::~Terminal() {
@return L'orientation actuelle de la Terminal.
*/
Qet::Orientation Terminal::orientation() const {
if (Element *elt = qgraphicsitem_cast<Element *>(parentItem())) {
if (auto *elt = qgraphicsitem_cast<Element *>(parentItem())) {
// orientations actuelle et par defaut de l'element
int ori_cur = elt -> orientation();
if (ori_cur == 0) return(ori_);
@@ -431,7 +431,7 @@ Terminal* Terminal::alignedWithTerminal() const
QList <Terminal *> available_terminals;
foreach (QGraphicsItem *qgi, qgi_list)
{
if (Terminal *tt = qgraphicsitem_cast <Terminal *> (qgi))
if (auto *tt = qgraphicsitem_cast <Terminal *> (qgi))
{
//Call QET::lineContainsPoint to be sure the line intersect
//the dock point and not an other part of terminal
@@ -539,7 +539,7 @@ void Terminal::mouseMoveEvent(QGraphicsSceneMouseEvent *e) {
// sinon on prend le deuxieme element de la liste et on verifie s'il s'agit d'une borne
QGraphicsItem *qgi = qgis.at(1);
// si le qgi est une borne...
Terminal *other_terminal = qgraphicsitem_cast<Terminal *>(qgi);
auto *other_terminal = qgraphicsitem_cast<Terminal *>(qgi);
if (!other_terminal) return;
previous_terminal_ = other_terminal;
@@ -576,7 +576,7 @@ void Terminal::mouseReleaseEvent(QGraphicsSceneMouseEvent *e)
if (!qgi) return;
//Element must be a terminal
Terminal *other_terminal = qgraphicsitem_cast<Terminal *>(qgi);
auto *other_terminal = qgraphicsitem_cast<Terminal *>(qgi);
if (!other_terminal) return;
other_terminal -> hovered_color_ = neutralColor;
@@ -586,7 +586,7 @@ void Terminal::mouseReleaseEvent(QGraphicsSceneMouseEvent *e)
if (!canBeLinkedTo(other_terminal)) return;
//Create conductor
Conductor *new_conductor = new Conductor(this, other_terminal);
auto *new_conductor = new Conductor(this, other_terminal);
//Get all conductors at the same potential of new conductors
QSet <Conductor *> conductors_list = new_conductor->relatedPotentialConductors();
@@ -606,7 +606,7 @@ void Terminal::mouseReleaseEvent(QGraphicsSceneMouseEvent *e)
}
QUndoCommand *undo = new QUndoCommand();
auto *undo = new QUndoCommand();
QUndoCommand *aic = new AddItemCommand<Conductor *>(new_conductor, diagram(), QPointF(), undo);
undo->setText(aic->text());