From 610a44c7cd6446f9a1127b59b0ea3dc4a97881fc Mon Sep 17 00:00:00 2001 From: Simon De Backer Date: Fri, 4 Sep 2020 23:00:32 +0200 Subject: [PATCH] Removed some Q_UNUSED --- sources/bordertitleblock.cpp | 17 +++-------- sources/bordertitleblock.h | 2 +- sources/conductorproperties.cpp | 15 +++++----- sources/conductorproperties.h | 2 +- sources/createdxf.cpp | 29 +++++++++---------- sources/createdxf.h | 4 +-- sources/editor/elementscene.cpp | 10 +++---- sources/elementspanel.cpp | 5 ++-- sources/elementspanel.h | 2 +- sources/elementspanelwidget.cpp | 2 +- sources/exportdialog.cpp | 8 +---- sources/exportdialog.h | 2 +- sources/genericpanel.cpp | 13 ++++----- sources/genericpanel.h | 8 ++--- sources/qetgraphicsitem/conductortextitem.cpp | 11 +++---- sources/qetgraphicsitem/qetshapeitem.cpp | 28 +++++++----------- sources/qetgraphicsitem/qetshapeitem.h | 6 ++-- sources/titleblocktemplate.cpp | 4 +-- 18 files changed, 67 insertions(+), 101 deletions(-) diff --git a/sources/bordertitleblock.cpp b/sources/bordertitleblock.cpp index db6893f4d..073adbac5 100644 --- a/sources/bordertitleblock.cpp +++ b/sources/bordertitleblock.cpp @@ -606,20 +606,13 @@ void BorderTitleBlock::draw(QPainter *painter) /** @brief BorderTitleBlock::drawDxf - @param width - @param height - @param keep_aspect_ratio @param file_path @param color */ void BorderTitleBlock::drawDxf( - int width, - int height, - bool keep_aspect_ratio, QString &file_path, - int color) { - Q_UNUSED (width); Q_UNUSED (height); Q_UNUSED (keep_aspect_ratio); - + int color) +{ // Transform to DXF scale. columns_header_height_ *= Createdxf::yScale; rows_height_ *= Createdxf::yScale; @@ -675,8 +668,7 @@ void BorderTitleBlock::drawDxf( 2, xCoord+recWidth/2, 1, - color, - 0); + color); } } @@ -710,8 +702,7 @@ void BorderTitleBlock::drawDxf( 2, xCoord+recWidth/2, 1, - color, - 0); + color); row_string = incrementLetters(row_string); } } diff --git a/sources/bordertitleblock.h b/sources/bordertitleblock.h index 29b274c70..27c6f6b4f 100644 --- a/sources/bordertitleblock.h +++ b/sources/bordertitleblock.h @@ -47,7 +47,7 @@ class BorderTitleBlock : public QObject //METHODS public: void draw(QPainter *painter); - void drawDxf(int, int, bool, QString &, int); + void drawDxf(QString &, int); //METHODS TO GET DIMENSION //COLUMNS diff --git a/sources/conductorproperties.cpp b/sources/conductorproperties.cpp index 88f5d72ea..231228c00 100644 --- a/sources/conductorproperties.cpp +++ b/sources/conductorproperties.cpp @@ -104,7 +104,7 @@ void SingleLineProperties::draw(QPainter *painter, if (hasGround && i == 1) { drawGround(painter, direction, symbol_p2, symbol_width * 2.0); } else if (hasNeutral && ((i == 1 && !hasGround) || (i == 2 && hasGround))) { - drawNeutral(painter, direction, symbol_p2, symbol_width * 1.5); + drawNeutral(painter, symbol_p2, symbol_width * 1.5); } } } @@ -149,15 +149,14 @@ void SingleLineProperties::drawGround(QPainter *painter, /** Dessine le cercle correspondant au symbole du neutre sur un conducteur unifilaire @param painter QPainter a utiliser pour dessiner le segment - @param direction direction du segment sur lequel le symbole apparaitra @param center centre du cercle @param size diametre du cercle */ -void SingleLineProperties::drawNeutral(QPainter *painter, - QET::ConductorSegmentType direction, - QPointF center, - qreal size) { - Q_UNUSED(direction); +void SingleLineProperties::drawNeutral( + QPainter *painter, + QPointF center, + qreal size) +{ painter -> save(); // prepare le QPainter @@ -199,7 +198,7 @@ void SingleLineProperties::drawPen(QPainter *painter, // QSizeF(size * 1.5, size * 1.5) // ) //); - drawNeutral(painter, direction, center, size * 1.5); + drawNeutral(painter, center, size * 1.5); int offset = (size * 1.5 / 2.0); QPointF pos = center + (direction == QET::Horizontal ? QPointF(0.0, -offset - 0.5) : QPointF(offset + 0.5, 0.0)); diff --git a/sources/conductorproperties.h b/sources/conductorproperties.h index 51322e5de..dcf1044ab 100644 --- a/sources/conductorproperties.h +++ b/sources/conductorproperties.h @@ -55,7 +55,7 @@ class SingleLineProperties { private: unsigned short int phases; void drawGround (QPainter *, QET::ConductorSegmentType, QPointF, qreal); - void drawNeutral(QPainter *, QET::ConductorSegmentType, QPointF, qreal); + void drawNeutral(QPainter *, QPointF, qreal); void drawPen(QPainter *, QET::ConductorSegmentType, QPointF, qreal); }; diff --git a/sources/createdxf.cpp b/sources/createdxf.cpp index 8f5ea7523..d081068e8 100644 --- a/sources/createdxf.cpp +++ b/sources/createdxf.cpp @@ -778,23 +778,20 @@ void Createdxf::drawText(const QString& fileName, /* draw aligned text in DXF Format */ // leftAlign flag added. If the alignment requested is 'fit to width' and the text length is very small, // then the text is either centered or left-aligned, depnding on the value of leftAlign. -void Createdxf::drawTextAligned(const QString& fileName, - const QString& text, - double x, - double y, - double height, - double rotation, - double oblique, - int hAlign, - int vAlign, - double xAlign, - double xScale, - int colour, - bool leftAlign, - float scale) +void Createdxf::drawTextAligned( + const QString& fileName, + const QString& text, + double x, + double y, + double height, + double rotation, + double oblique, + int hAlign, + int vAlign, + double xAlign, + double xScale, + int colour) { - Q_UNUSED(scale); - if (!fileName.isEmpty()) { QFile file(fileName); if (!file.open(QFile::Append)) { diff --git a/sources/createdxf.h b/sources/createdxf.h index 29554733a..6cfe008bb 100644 --- a/sources/createdxf.h +++ b/sources/createdxf.h @@ -98,9 +98,7 @@ class Createdxf int vAlign, double xAlign, double xScale, - int colour, - bool leftAlign = false, - float scale = 0); + int colour); static int getcolorCode (const long red, diff --git a/sources/editor/elementscene.cpp b/sources/editor/elementscene.cpp index 646ce165e..3b9f3b442 100644 --- a/sources/editor/elementscene.cpp +++ b/sources/editor/elementscene.cpp @@ -288,18 +288,16 @@ void ElementScene::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) \~French Dessine l'arriere-plan de l'editeur, cad l'indicateur de hotspot. \~ @param p : The QPainter to use for drawing \~French Le QPainter a utiliser pour dessiner - \~ @param rect : The rectangle of the area to be drawn - \~French Le rectangle de la zone a dessiner */ -void ElementScene::drawForeground(QPainter *p, const QRectF &rect) { - Q_UNUSED(rect); +void ElementScene::drawForeground(QPainter *p, const QRectF &) +{ p -> save(); - + // desactive tout antialiasing, sauf pour le texte p -> setRenderHint(QPainter::Antialiasing, false); p -> setRenderHint(QPainter::TextAntialiasing, true); p -> setRenderHint(QPainter::SmoothPixmapTransform, false); - + QPen pen(Qt::red); pen.setCosmetic(true); p -> setPen(pen); diff --git a/sources/elementspanel.cpp b/sources/elementspanel.cpp index b487e504d..253e0f214 100644 --- a/sources/elementspanel.cpp +++ b/sources/elementspanel.cpp @@ -215,9 +215,8 @@ bool ElementsPanel::matchesFilter(const QTreeWidgetItem *item, @param reload_collections : true for read all collections since their sources (files, projects ...) */ -void ElementsPanel::reload(bool reload_collections) { - Q_UNUSED(reload_collections); - +void ElementsPanel::reload() +{ QIcon system_icon(":/ico/16x16/qet.png"); QIcon user_icon(":/ico/16x16/go-home.png"); diff --git a/sources/elementspanel.h b/sources/elementspanel.h index fd6aaa472..61202256d 100644 --- a/sources/elementspanel.h +++ b/sources/elementspanel.h @@ -57,7 +57,7 @@ class ElementsPanel : public GenericPanel { public slots: void slot_doubleClick(QTreeWidgetItem *, int); - void reload(bool = false); + void reload(); void filter(const QString &, QET::Filtering = QET::RegularFilter); void projectWasOpened(QETProject *); void projectWasClosed(QETProject *); diff --git a/sources/elementspanelwidget.cpp b/sources/elementspanelwidget.cpp index 32ee39d39..3ac356a84 100644 --- a/sources/elementspanelwidget.cpp +++ b/sources/elementspanelwidget.cpp @@ -159,7 +159,7 @@ void ElementsPanelWidget::copyPathForSelectedItem() { */ void ElementsPanelWidget::reloadAndFilter() { // recharge tous les elements - elements_panel -> reload(true); + elements_panel -> reload(); // reapplique le filtre if (!filter_textfield -> text().isEmpty()) { elements_panel -> filter(filter_textfield -> text()); diff --git a/sources/exportdialog.cpp b/sources/exportdialog.cpp index d38a5ddbd..d6d8eabd4 100644 --- a/sources/exportdialog.cpp +++ b/sources/exportdialog.cpp @@ -396,13 +396,11 @@ void ExportDialog::generateSvg(Diagram *diagram, int width, int height, bool kee @param diagram Schema a exporter en DXF @param width Largeur de l'export DXF @param height Hauteur de l'export DXF - @param keep_aspect_ratio True pour conserver le ratio, false sinon @param file_path */ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, - bool keep_aspect_ratio, QString &file_path) { saveReloadDiagramParameters(diagram, true); @@ -426,10 +424,7 @@ void ExportDialog::generateDxf(Diagram *diagram, double(height)*Createdxf::yScale, 0); } - diagram -> border_and_titleblock.drawDxf(width, - height, - keep_aspect_ratio, - file_path, + diagram -> border_and_titleblock.drawDxf(file_path, 0); // Build the lists of elements. @@ -800,7 +795,6 @@ void ExportDialog::exportDiagram(ExportDiagramLine *diagram_line) { diagram_line -> diagram, diagram_line -> width -> value(), diagram_line -> height -> value(), - diagram_line -> keep_ratio -> isChecked(), diagram_path ); } else { diff --git a/sources/exportdialog.h b/sources/exportdialog.h index 81ae6ad11..15782c299 100644 --- a/sources/exportdialog.h +++ b/sources/exportdialog.h @@ -89,7 +89,7 @@ class ExportDialog : public QDialog { QWidget *initDiagramsListPart(); void saveReloadDiagramParameters(Diagram *, bool = true); void generateSvg(Diagram *, int, int, bool, QIODevice &); - void generateDxf(Diagram *, int, int, bool, QString &); + void generateDxf(Diagram *, int, int, QString &); QImage generateImage(Diagram *, int, int, bool); void exportDiagram(ExportDiagramLine *); qreal diagramRatio(Diagram *); diff --git a/sources/genericpanel.cpp b/sources/genericpanel.cpp index d48d63b79..d054fb309 100644 --- a/sources/genericpanel.cpp +++ b/sources/genericpanel.cpp @@ -291,7 +291,7 @@ QTreeWidgetItem *GenericPanel::addDiagram(Diagram *diagram, &creation_required); updateDiagramItem(diagram_qtwi, diagram, options, creation_required); reparent(diagram_qtwi, parent_item); - fillDiagramItem(diagram_qtwi, diagram, options, creation_required); + fillDiagramItem(diagram_qtwi, options, creation_required); return(diagram_qtwi); } @@ -394,16 +394,15 @@ QTreeWidgetItem *GenericPanel::updateDiagramItem(QTreeWidgetItem *diagram_qtwi, /** @brief GenericPanel::fillDiagramItem @param diagram_qtwi - @param diagram (unused) @param options @param freshly_created @return fillItem(diagram_qtwi, options, freshly_created) */ -QTreeWidgetItem *GenericPanel::fillDiagramItem(QTreeWidgetItem *diagram_qtwi, - Diagram *diagram, - PanelOptions options, - bool freshly_created) { - Q_UNUSED(diagram) +QTreeWidgetItem *GenericPanel::fillDiagramItem( + QTreeWidgetItem *diagram_qtwi, + PanelOptions options, + bool freshly_created) +{ return(fillItem(diagram_qtwi, options, freshly_created)); } diff --git a/sources/genericpanel.h b/sources/genericpanel.h index 3b9ebe747..862a83c4c 100644 --- a/sources/genericpanel.h +++ b/sources/genericpanel.h @@ -101,10 +101,10 @@ class GenericPanel : public QTreeWidget { Diagram *, PanelOptions = AddAllChild, bool = false); - virtual QTreeWidgetItem *fillDiagramItem (QTreeWidgetItem *, - Diagram *, - PanelOptions = AddAllChild, - bool = false); + virtual QTreeWidgetItem *fillDiagramItem( + QTreeWidgetItem *, + PanelOptions = AddAllChild, + bool = false); // title block templates collections methods public: diff --git a/sources/qetgraphicsitem/conductortextitem.cpp b/sources/qetgraphicsitem/conductortextitem.cpp index 6212888cb..339d6cc8a 100644 --- a/sources/qetgraphicsitem/conductortextitem.cpp +++ b/sources/qetgraphicsitem/conductortextitem.cpp @@ -243,9 +243,10 @@ void ConductorTextItem::hoverEnterEvent(QGraphicsSceneHoverEvent *e) { change m_mouse_hover to false(used in paint() function ) @param e QGraphicsSceneHoverEvent */ -void ConductorTextItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *e) { +void ConductorTextItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *e) +{ Q_UNUSED(e); - //qDebug() << "Leave mouse over"; + qDebug() << "Leave mouse over"; m_mouse_hover = false; update(); } @@ -254,7 +255,7 @@ void ConductorTextItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *e) { Do nothing default function . @param e QGraphicsSceneHoverEvent */ -void ConductorTextItem::hoverMoveEvent(QGraphicsSceneHoverEvent *e) { - Q_UNUSED(e); - QGraphicsTextItem::hoverMoveEvent(e); +void ConductorTextItem::hoverMoveEvent(QGraphicsSceneHoverEvent *e) +{ + QGraphicsTextItem::hoverMoveEvent(e); } diff --git a/sources/qetgraphicsitem/qetshapeitem.cpp b/sources/qetgraphicsitem/qetshapeitem.cpp index 7d77fc2dd..896e87d7f 100644 --- a/sources/qetgraphicsitem/qetshapeitem.cpp +++ b/sources/qetgraphicsitem/qetshapeitem.cpp @@ -295,9 +295,10 @@ QPainterPath QetShapeItem::shape() const @param option @param widget */ -void QetShapeItem::paint(QPainter *painter, - const QStyleOptionGraphicsItem *option, - QWidget *widget) +void QetShapeItem::paint( + QPainter *painter, + const QStyleOptionGraphicsItem *option, + QWidget *widget) { Q_UNUSED(option) Q_UNUSED(widget) @@ -425,17 +426,17 @@ bool QetShapeItem::sceneEventFilter(QGraphicsItem *watched, QEvent *event) { if(event->type() == QEvent::GraphicsSceneMousePress) //Click { - handlerMousePressEvent(qghi, static_cast(event)); + handlerMousePressEvent(); return true; } else if(event->type() == QEvent::GraphicsSceneMouseMove) //Move { - handlerMouseMoveEvent(qghi, static_cast(event)); + handlerMouseMoveEvent(static_cast(event)); return true; } else if (event->type() == QEvent::GraphicsSceneMouseRelease) //Release { - handlerMouseReleaseEvent(qghi, static_cast(event)); + handlerMouseReleaseEvent(); return true; } } @@ -703,11 +704,8 @@ void QetShapeItem::removePoint() @param qghi @param event */ -void QetShapeItem::handlerMousePressEvent(QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event) +void QetShapeItem::handlerMousePressEvent() { - Q_UNUSED(qghi) - Q_UNUSED(event) - m_old_P1 = m_P1; m_old_P2 = m_P2; m_old_polygon = m_polygon; @@ -720,13 +718,10 @@ void QetShapeItem::handlerMousePressEvent(QetGraphicsHandlerItem *qghi, QGraphic /** @brief QetShapeItem::handlerMouseMoveEvent - @param qghi @param event */ -void QetShapeItem::handlerMouseMoveEvent(QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event) +void QetShapeItem::handlerMouseMoveEvent(QGraphicsSceneMouseEvent *event) { - Q_UNUSED(qghi) - QPointF new_pos = event->scenePos(); if (event->modifiers() != Qt::ControlModifier) new_pos = Diagram::snapToGrid(event->scenePos()); @@ -787,11 +782,8 @@ void QetShapeItem::handlerMouseMoveEvent(QetGraphicsHandlerItem *qghi, QGraphics @param qghi @param event */ -void QetShapeItem::handlerMouseReleaseEvent(QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event) +void QetShapeItem::handlerMouseReleaseEvent() { - Q_UNUSED(qghi); - Q_UNUSED(event); - m_modifie_radius_equaly = false; if (diagram()) diff --git a/sources/qetgraphicsitem/qetshapeitem.h b/sources/qetgraphicsitem/qetshapeitem.h index 157c8a73a..699c37737 100644 --- a/sources/qetgraphicsitem/qetshapeitem.h +++ b/sources/qetgraphicsitem/qetshapeitem.h @@ -121,9 +121,9 @@ class QetShapeItem : public QetGraphicsItem void insertPoint(); void removePoint(); - void handlerMousePressEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event); - void handlerMouseMoveEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event); - void handlerMouseReleaseEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event); + void handlerMousePressEvent(); + void handlerMouseMoveEvent(QGraphicsSceneMouseEvent *event); + void handlerMouseReleaseEvent(); ///ATTRIBUTES private: diff --git a/sources/titleblocktemplate.cpp b/sources/titleblocktemplate.cpp index 5b93c858d..5323af7a9 100644 --- a/sources/titleblocktemplate.cpp +++ b/sources/titleblocktemplate.cpp @@ -1858,9 +1858,7 @@ void TitleBlockTemplate::renderTextCellDxf(QString &file_path, vAlign, x2, ratio, - color, - cell.alignment & Qt::AlignLeft, - 0); + color); } /**