Removed some Q_UNUSED

This commit is contained in:
Simon De Backer
2020-09-04 23:00:32 +02:00
parent 1bc2536c06
commit 610a44c7cd
18 changed files with 67 additions and 101 deletions

View File

@@ -606,20 +606,13 @@ void BorderTitleBlock::draw(QPainter *painter)
/** /**
@brief BorderTitleBlock::drawDxf @brief BorderTitleBlock::drawDxf
@param width
@param height
@param keep_aspect_ratio
@param file_path @param file_path
@param color @param color
*/ */
void BorderTitleBlock::drawDxf( void BorderTitleBlock::drawDxf(
int width,
int height,
bool keep_aspect_ratio,
QString &file_path, QString &file_path,
int color) { int color)
Q_UNUSED (width); Q_UNUSED (height); Q_UNUSED (keep_aspect_ratio); {
// Transform to DXF scale. // Transform to DXF scale.
columns_header_height_ *= Createdxf::yScale; columns_header_height_ *= Createdxf::yScale;
rows_height_ *= Createdxf::yScale; rows_height_ *= Createdxf::yScale;
@@ -675,8 +668,7 @@ void BorderTitleBlock::drawDxf(
2, 2,
xCoord+recWidth/2, xCoord+recWidth/2,
1, 1,
color, color);
0);
} }
} }
@@ -710,8 +702,7 @@ void BorderTitleBlock::drawDxf(
2, 2,
xCoord+recWidth/2, xCoord+recWidth/2,
1, 1,
color, color);
0);
row_string = incrementLetters(row_string); row_string = incrementLetters(row_string);
} }
} }

View File

@@ -47,7 +47,7 @@ class BorderTitleBlock : public QObject
//METHODS //METHODS
public: public:
void draw(QPainter *painter); void draw(QPainter *painter);
void drawDxf(int, int, bool, QString &, int); void drawDxf(QString &, int);
//METHODS TO GET DIMENSION //METHODS TO GET DIMENSION
//COLUMNS //COLUMNS

View File

@@ -104,7 +104,7 @@ void SingleLineProperties::draw(QPainter *painter,
if (hasGround && i == 1) { if (hasGround && i == 1) {
drawGround(painter, direction, symbol_p2, symbol_width * 2.0); drawGround(painter, direction, symbol_p2, symbol_width * 2.0);
} else if (hasNeutral && ((i == 1 && !hasGround) || (i == 2 && hasGround))) { } 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 Dessine le cercle correspondant au symbole du neutre sur un conducteur unifilaire
@param painter QPainter a utiliser pour dessiner le segment @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 center centre du cercle
@param size diametre du cercle @param size diametre du cercle
*/ */
void SingleLineProperties::drawNeutral(QPainter *painter, void SingleLineProperties::drawNeutral(
QET::ConductorSegmentType direction, QPainter *painter,
QPointF center, QPointF center,
qreal size) { qreal size)
Q_UNUSED(direction); {
painter -> save(); painter -> save();
// prepare le QPainter // prepare le QPainter
@@ -199,7 +198,7 @@ void SingleLineProperties::drawPen(QPainter *painter,
// QSizeF(size * 1.5, size * 1.5) // 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); 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)); QPointF pos = center + (direction == QET::Horizontal ? QPointF(0.0, -offset - 0.5) : QPointF(offset + 0.5, 0.0));

View File

@@ -55,7 +55,7 @@ class SingleLineProperties {
private: private:
unsigned short int phases; unsigned short int phases;
void drawGround (QPainter *, QET::ConductorSegmentType, QPointF, qreal); 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); void drawPen(QPainter *, QET::ConductorSegmentType, QPointF, qreal);
}; };

View File

@@ -778,23 +778,20 @@ void Createdxf::drawText(const QString& fileName,
/* draw aligned text in DXF Format */ /* draw aligned text in DXF Format */
// leftAlign flag added. If the alignment requested is 'fit to width' and the text length is very small, // 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. // then the text is either centered or left-aligned, depnding on the value of leftAlign.
void Createdxf::drawTextAligned(const QString& fileName, void Createdxf::drawTextAligned(
const QString& text, const QString& fileName,
double x, const QString& text,
double y, double x,
double height, double y,
double rotation, double height,
double oblique, double rotation,
int hAlign, double oblique,
int vAlign, int hAlign,
double xAlign, int vAlign,
double xScale, double xAlign,
int colour, double xScale,
bool leftAlign, int colour)
float scale)
{ {
Q_UNUSED(scale);
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
QFile file(fileName); QFile file(fileName);
if (!file.open(QFile::Append)) { if (!file.open(QFile::Append)) {

View File

@@ -98,9 +98,7 @@ class Createdxf
int vAlign, int vAlign,
double xAlign, double xAlign,
double xScale, double xScale,
int colour, int colour);
bool leftAlign = false,
float scale = 0);
static int getcolorCode (const long red, static int getcolorCode (const long red,

View File

@@ -288,18 +288,16 @@ void ElementScene::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
\~French Dessine l'arriere-plan de l'editeur, cad l'indicateur de hotspot. \~French Dessine l'arriere-plan de l'editeur, cad l'indicateur de hotspot.
\~ @param p : The QPainter to use for drawing \~ @param p : The QPainter to use for drawing
\~French Le QPainter a utiliser pour dessiner \~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) { void ElementScene::drawForeground(QPainter *p, const QRectF &)
Q_UNUSED(rect); {
p -> save(); p -> save();
// desactive tout antialiasing, sauf pour le texte // desactive tout antialiasing, sauf pour le texte
p -> setRenderHint(QPainter::Antialiasing, false); p -> setRenderHint(QPainter::Antialiasing, false);
p -> setRenderHint(QPainter::TextAntialiasing, true); p -> setRenderHint(QPainter::TextAntialiasing, true);
p -> setRenderHint(QPainter::SmoothPixmapTransform, false); p -> setRenderHint(QPainter::SmoothPixmapTransform, false);
QPen pen(Qt::red); QPen pen(Qt::red);
pen.setCosmetic(true); pen.setCosmetic(true);
p -> setPen(pen); p -> setPen(pen);

View File

@@ -215,9 +215,8 @@ bool ElementsPanel::matchesFilter(const QTreeWidgetItem *item,
@param reload_collections : @param reload_collections :
true for read all collections since their sources (files, projects ...) true for read all collections since their sources (files, projects ...)
*/ */
void ElementsPanel::reload(bool reload_collections) { void ElementsPanel::reload()
Q_UNUSED(reload_collections); {
QIcon system_icon(":/ico/16x16/qet.png"); QIcon system_icon(":/ico/16x16/qet.png");
QIcon user_icon(":/ico/16x16/go-home.png"); QIcon user_icon(":/ico/16x16/go-home.png");

View File

@@ -57,7 +57,7 @@ class ElementsPanel : public GenericPanel {
public slots: public slots:
void slot_doubleClick(QTreeWidgetItem *, int); void slot_doubleClick(QTreeWidgetItem *, int);
void reload(bool = false); void reload();
void filter(const QString &, QET::Filtering = QET::RegularFilter); void filter(const QString &, QET::Filtering = QET::RegularFilter);
void projectWasOpened(QETProject *); void projectWasOpened(QETProject *);
void projectWasClosed(QETProject *); void projectWasClosed(QETProject *);

View File

@@ -159,7 +159,7 @@ void ElementsPanelWidget::copyPathForSelectedItem() {
*/ */
void ElementsPanelWidget::reloadAndFilter() { void ElementsPanelWidget::reloadAndFilter() {
// recharge tous les elements // recharge tous les elements
elements_panel -> reload(true); elements_panel -> reload();
// reapplique le filtre // reapplique le filtre
if (!filter_textfield -> text().isEmpty()) { if (!filter_textfield -> text().isEmpty()) {
elements_panel -> filter(filter_textfield -> text()); elements_panel -> filter(filter_textfield -> text());

View File

@@ -396,13 +396,11 @@ void ExportDialog::generateSvg(Diagram *diagram, int width, int height, bool kee
@param diagram Schema a exporter en DXF @param diagram Schema a exporter en DXF
@param width Largeur de l'export DXF @param width Largeur de l'export DXF
@param height Hauteur 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 @param file_path
*/ */
void ExportDialog::generateDxf(Diagram *diagram, void ExportDialog::generateDxf(Diagram *diagram,
int width, int width,
int height, int height,
bool keep_aspect_ratio,
QString &file_path) { QString &file_path) {
saveReloadDiagramParameters(diagram, true); saveReloadDiagramParameters(diagram, true);
@@ -426,10 +424,7 @@ void ExportDialog::generateDxf(Diagram *diagram,
double(height)*Createdxf::yScale, double(height)*Createdxf::yScale,
0); 0);
} }
diagram -> border_and_titleblock.drawDxf(width, diagram -> border_and_titleblock.drawDxf(file_path,
height,
keep_aspect_ratio,
file_path,
0); 0);
// Build the lists of elements. // Build the lists of elements.
@@ -800,7 +795,6 @@ void ExportDialog::exportDiagram(ExportDiagramLine *diagram_line) {
diagram_line -> diagram, diagram_line -> diagram,
diagram_line -> width -> value(), diagram_line -> width -> value(),
diagram_line -> height -> value(), diagram_line -> height -> value(),
diagram_line -> keep_ratio -> isChecked(),
diagram_path diagram_path
); );
} else { } else {

View File

@@ -89,7 +89,7 @@ class ExportDialog : public QDialog {
QWidget *initDiagramsListPart(); QWidget *initDiagramsListPart();
void saveReloadDiagramParameters(Diagram *, bool = true); void saveReloadDiagramParameters(Diagram *, bool = true);
void generateSvg(Diagram *, int, int, bool, QIODevice &); 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); QImage generateImage(Diagram *, int, int, bool);
void exportDiagram(ExportDiagramLine *); void exportDiagram(ExportDiagramLine *);
qreal diagramRatio(Diagram *); qreal diagramRatio(Diagram *);

View File

@@ -291,7 +291,7 @@ QTreeWidgetItem *GenericPanel::addDiagram(Diagram *diagram,
&creation_required); &creation_required);
updateDiagramItem(diagram_qtwi, diagram, options, creation_required); updateDiagramItem(diagram_qtwi, diagram, options, creation_required);
reparent(diagram_qtwi, parent_item); reparent(diagram_qtwi, parent_item);
fillDiagramItem(diagram_qtwi, diagram, options, creation_required); fillDiagramItem(diagram_qtwi, options, creation_required);
return(diagram_qtwi); return(diagram_qtwi);
} }
@@ -394,16 +394,15 @@ QTreeWidgetItem *GenericPanel::updateDiagramItem(QTreeWidgetItem *diagram_qtwi,
/** /**
@brief GenericPanel::fillDiagramItem @brief GenericPanel::fillDiagramItem
@param diagram_qtwi @param diagram_qtwi
@param diagram (unused)
@param options @param options
@param freshly_created @param freshly_created
@return fillItem(diagram_qtwi, options, freshly_created) @return fillItem(diagram_qtwi, options, freshly_created)
*/ */
QTreeWidgetItem *GenericPanel::fillDiagramItem(QTreeWidgetItem *diagram_qtwi, QTreeWidgetItem *GenericPanel::fillDiagramItem(
Diagram *diagram, QTreeWidgetItem *diagram_qtwi,
PanelOptions options, PanelOptions options,
bool freshly_created) { bool freshly_created)
Q_UNUSED(diagram) {
return(fillItem(diagram_qtwi, options, freshly_created)); return(fillItem(diagram_qtwi, options, freshly_created));
} }

View File

@@ -101,10 +101,10 @@ class GenericPanel : public QTreeWidget {
Diagram *, Diagram *,
PanelOptions = AddAllChild, PanelOptions = AddAllChild,
bool = false); bool = false);
virtual QTreeWidgetItem *fillDiagramItem (QTreeWidgetItem *, virtual QTreeWidgetItem *fillDiagramItem(
Diagram *, QTreeWidgetItem *,
PanelOptions = AddAllChild, PanelOptions = AddAllChild,
bool = false); bool = false);
// title block templates collections methods // title block templates collections methods
public: public:

View File

@@ -243,9 +243,10 @@ void ConductorTextItem::hoverEnterEvent(QGraphicsSceneHoverEvent *e) {
change m_mouse_hover to false(used in paint() function ) change m_mouse_hover to false(used in paint() function )
@param e QGraphicsSceneHoverEvent @param e QGraphicsSceneHoverEvent
*/ */
void ConductorTextItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *e) { void ConductorTextItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *e)
{
Q_UNUSED(e); Q_UNUSED(e);
//qDebug() << "Leave mouse over"; qDebug() << "Leave mouse over";
m_mouse_hover = false; m_mouse_hover = false;
update(); update();
} }
@@ -254,7 +255,7 @@ void ConductorTextItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *e) {
Do nothing default function . Do nothing default function .
@param e QGraphicsSceneHoverEvent @param e QGraphicsSceneHoverEvent
*/ */
void ConductorTextItem::hoverMoveEvent(QGraphicsSceneHoverEvent *e) { void ConductorTextItem::hoverMoveEvent(QGraphicsSceneHoverEvent *e)
Q_UNUSED(e); {
QGraphicsTextItem::hoverMoveEvent(e); QGraphicsTextItem::hoverMoveEvent(e);
} }

View File

@@ -295,9 +295,10 @@ QPainterPath QetShapeItem::shape() const
@param option @param option
@param widget @param widget
*/ */
void QetShapeItem::paint(QPainter *painter, void QetShapeItem::paint(
const QStyleOptionGraphicsItem *option, QPainter *painter,
QWidget *widget) const QStyleOptionGraphicsItem *option,
QWidget *widget)
{ {
Q_UNUSED(option) Q_UNUSED(option)
Q_UNUSED(widget) Q_UNUSED(widget)
@@ -425,17 +426,17 @@ bool QetShapeItem::sceneEventFilter(QGraphicsItem *watched, QEvent *event)
{ {
if(event->type() == QEvent::GraphicsSceneMousePress) //Click if(event->type() == QEvent::GraphicsSceneMousePress) //Click
{ {
handlerMousePressEvent(qghi, static_cast<QGraphicsSceneMouseEvent *>(event)); handlerMousePressEvent();
return true; return true;
} }
else if(event->type() == QEvent::GraphicsSceneMouseMove) //Move else if(event->type() == QEvent::GraphicsSceneMouseMove) //Move
{ {
handlerMouseMoveEvent(qghi, static_cast<QGraphicsSceneMouseEvent *>(event)); handlerMouseMoveEvent(static_cast<QGraphicsSceneMouseEvent *>(event));
return true; return true;
} }
else if (event->type() == QEvent::GraphicsSceneMouseRelease) //Release else if (event->type() == QEvent::GraphicsSceneMouseRelease) //Release
{ {
handlerMouseReleaseEvent(qghi, static_cast<QGraphicsSceneMouseEvent *>(event)); handlerMouseReleaseEvent();
return true; return true;
} }
} }
@@ -703,11 +704,8 @@ void QetShapeItem::removePoint()
@param qghi @param qghi
@param event @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_P1 = m_P1;
m_old_P2 = m_P2; m_old_P2 = m_P2;
m_old_polygon = m_polygon; m_old_polygon = m_polygon;
@@ -720,13 +718,10 @@ void QetShapeItem::handlerMousePressEvent(QetGraphicsHandlerItem *qghi, QGraphic
/** /**
@brief QetShapeItem::handlerMouseMoveEvent @brief QetShapeItem::handlerMouseMoveEvent
@param qghi
@param event @param event
*/ */
void QetShapeItem::handlerMouseMoveEvent(QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event) void QetShapeItem::handlerMouseMoveEvent(QGraphicsSceneMouseEvent *event)
{ {
Q_UNUSED(qghi)
QPointF new_pos = event->scenePos(); QPointF new_pos = event->scenePos();
if (event->modifiers() != Qt::ControlModifier) if (event->modifiers() != Qt::ControlModifier)
new_pos = Diagram::snapToGrid(event->scenePos()); new_pos = Diagram::snapToGrid(event->scenePos());
@@ -787,11 +782,8 @@ void QetShapeItem::handlerMouseMoveEvent(QetGraphicsHandlerItem *qghi, QGraphics
@param qghi @param qghi
@param event @param event
*/ */
void QetShapeItem::handlerMouseReleaseEvent(QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event) void QetShapeItem::handlerMouseReleaseEvent()
{ {
Q_UNUSED(qghi);
Q_UNUSED(event);
m_modifie_radius_equaly = false; m_modifie_radius_equaly = false;
if (diagram()) if (diagram())

View File

@@ -121,9 +121,9 @@ class QetShapeItem : public QetGraphicsItem
void insertPoint(); void insertPoint();
void removePoint(); void removePoint();
void handlerMousePressEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event); void handlerMousePressEvent();
void handlerMouseMoveEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event); void handlerMouseMoveEvent(QGraphicsSceneMouseEvent *event);
void handlerMouseReleaseEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event); void handlerMouseReleaseEvent();
///ATTRIBUTES ///ATTRIBUTES
private: private:

View File

@@ -1858,9 +1858,7 @@ void TitleBlockTemplate::renderTextCellDxf(QString &file_path,
vAlign, vAlign,
x2, x2,
ratio, ratio,
color, color);
cell.alignment & Qt::AlignLeft,
0);
} }
/** /**