diff --git a/sources/autoNum/numerotationcontext.cpp b/sources/autoNum/numerotationcontext.cpp index 99e980521..25c922b3d 100644 --- a/sources/autoNum/numerotationcontext.cpp +++ b/sources/autoNum/numerotationcontext.cpp @@ -49,13 +49,24 @@ void NumerotationContext::clear () { @param initialvalue @return true if value is append */ -bool NumerotationContext::addValue(const QString &type, const QVariant &value, const int increase, const int initialvalue) { - if (!keyIsAcceptable(type) && !value.canConvert(QVariant::String)) return false; - if (keyIsNumber(type) && !value.canConvert(QVariant::Int)) return false; +bool NumerotationContext::addValue(const QString &type, + const QVariant &value, + const int increase, + const int initialvalue) { + if (!keyIsAcceptable(type) && !value.canConvert(QVariant::String)) + return false; + if (keyIsNumber(type) && !value.canConvert(QVariant::Int)) + return false; QString valuestr = value.toString(); valuestr.remove("|"); - content_ << type + "|" + valuestr + "|" + QString::number(increase) + "|" + QString::number(initialvalue); + content_ << type + + "|" + + valuestr + + "|" + + QString::number(increase) + + "|" + + QString::number(initialvalue); return true; } diff --git a/sources/autoNum/numerotationcontext.h b/sources/autoNum/numerotationcontext.h index 5dc311c41..3fce0c54f 100644 --- a/sources/autoNum/numerotationcontext.h +++ b/sources/autoNum/numerotationcontext.h @@ -33,7 +33,10 @@ class NumerotationContext NumerotationContext (); NumerotationContext (QDomElement &); void clear(); - bool addValue(const QString &, const QVariant & = QVariant(1), const int = 1, const int = 0); + bool addValue(const QString &, + const QVariant & = QVariant(1), + const int = 1, + const int = 0); QString operator[] (const int &) const; void operator << (const NumerotationContext &); int size() const; diff --git a/sources/autoNum/ui/numparteditorw.cpp b/sources/autoNum/ui/numparteditorw.cpp index af144104e..e84ae206c 100644 --- a/sources/autoNum/ui/numparteditorw.cpp +++ b/sources/autoNum/ui/numparteditorw.cpp @@ -37,10 +37,18 @@ NumPartEditorW::NumPartEditorW(int type, QWidget *parent) : } /** + @brief NumPartEditorW::NumPartEditorW Constructor - Build with value of @context at position i + Build with value of context at position i + @param context + @param i + @param type + @param parent */ -NumPartEditorW::NumPartEditorW (NumerotationContext &context, int i, int type, QWidget *parent): +NumPartEditorW::NumPartEditorW (NumerotationContext &context, + int i, + int type, + QWidget *parent): QWidget(parent), ui(new Ui::NumPartEditorW), intValidator (new QIntValidator(0,99999,this)), @@ -86,21 +94,40 @@ void NumPartEditorW::setVisibleItems() QStringList items; if (m_edited_type == 2) { - items << tr("Chiffre 1") << tr("Chiffre 01") - << tr("Chiffre 001") - << tr("Texte"); + items << tr("Chiffre 1") + << tr("Chiffre 01") + << tr("Chiffre 001") + << tr("Texte"); } else if (m_edited_type == 1) { - items << tr("Chiffre 1") << tr("Chiffre 1 - Folio") << tr("Chiffre 01") - << tr("Chiffre 01 - Folio") << tr("Chiffre 001") << tr("Chiffre 001 - Folio") - << tr("Texte") << tr("N° folio") << tr("Folio") << tr("Installation") << tr("Locmach"); + items << tr("Chiffre 1") + << tr("Chiffre 1 - Folio") + << tr("Chiffre 01") + << tr("Chiffre 01 - Folio") + << tr("Chiffre 001") + << tr("Chiffre 001 - Folio") + << tr("Texte") + << tr("N° folio") + << tr("Folio") + << tr("Installation") + << tr("Locmach"); } else - items << tr("Chiffre 1") << tr("Chiffre 1 - Folio") << tr("Chiffre 01") - << tr("Chiffre 01 - Folio") << tr("Chiffre 001") << tr("Chiffre 001 - Folio") - << tr("Texte") << tr("N° folio") << tr("Folio") << tr("Installation") << tr("Locmach") - << tr("Element Line") << tr("Element Column") << tr("Element Prefix"); + items << tr("Chiffre 1") + << tr("Chiffre 1 - Folio") + << tr("Chiffre 01") + << tr("Chiffre 01 - Folio") + << tr("Chiffre 001") + << tr("Chiffre 001 - Folio") + << tr("Texte") + << tr("N° folio") + << tr("Folio") + << tr("Installation") + << tr("Locmach") + << tr("Element Line") + << tr("Element Column") + << tr("Element Prefix"); ui->type_cb->insertItems(0,items); } @@ -155,10 +182,17 @@ NumerotationContext NumPartEditorW::toNumContext() { type_str = "elementprefix"; break; } - if (type_str == "unitfolio" || type_str == "tenfolio" || type_str == "hundredfolio") - nc.addValue(type_str, ui -> value_field -> displayText(), ui -> increase_spinBox -> value(), ui->value_field->displayText().toInt()); + if (type_str == "unitfolio" + || type_str == "tenfolio" + || type_str == "hundredfolio") + nc.addValue(type_str, + ui -> value_field -> displayText(), + ui -> increase_spinBox -> value(), + ui->value_field->displayText().toInt()); else - nc.addValue(type_str, ui -> value_field -> displayText(), ui -> increase_spinBox -> value()); + nc.addValue(type_str, + ui -> value_field -> displayText(), + ui -> increase_spinBox -> value()); return nc; } @@ -167,8 +201,13 @@ NumerotationContext NumPartEditorW::toNumContext() { @return true if value field isn't empty or if type is folio */ bool NumPartEditorW::isValid() { - if (type_ == folio || type_ == idfolio || type_ == elementline || type_ == plant || type_ == locmach || - type_ == elementcolumn || type_ == elementprefix) {return true;} + if (type_ == folio + || type_ == idfolio + || type_ == elementline + || type_ == plant + || type_ == locmach + || type_ == elementcolumn + || type_ == elementprefix) {return true;} else if(ui -> value_field -> text().isEmpty()) {return false;} else return true; } diff --git a/sources/createdxf.cpp b/sources/createdxf.cpp index 8811f13eb..089ad5716 100644 --- a/sources/createdxf.cpp +++ b/sources/createdxf.cpp @@ -657,9 +657,11 @@ void Createdxf::drawRectangle (const QString &fileName, double x1, double y1, do Conveniance function for draw rectangle @param filepath @param rect - @param color + @param colorcode */ -void Createdxf::drawRectangle(const QString &filepath, const QRectF &rect, const int &colorcode) { +void Createdxf::drawRectangle(const QString &filepath, + const QRectF &rect, + const int &colorcode) { drawRectangle(filepath, rect.bottomLeft().x() * xScale, sheetHeight - (rect.bottomLeft().y() * yScale), rect.width() * xScale, @@ -667,8 +669,24 @@ void Createdxf::drawRectangle(const QString &filepath, const QRectF &rect, const colorcode); } -/* draw arc in dx format */ -void Createdxf::drawArc(const QString& fileName,double x,double y,double rad,double startAngle,double endAngle,int color) +/** + @brief Createdxf::drawArc + draw arc in dx format + @param fileName + @param x + @param y + @param rad + @param startAngle + @param endAngle + @param color +*/ +void Createdxf::drawArc(const QString& fileName, + double x, + double y, + double rad, + double startAngle, + double endAngle, + int color) { if (!fileName.isEmpty()) { QFile file(fileName); @@ -704,8 +722,24 @@ void Createdxf::drawArc(const QString& fileName,double x,double y,double rad,dou } } -/* draw simple text in dxf format without any alignment specified */ -void Createdxf::drawText(const QString& fileName, const QString& text,double x, double y, double height, double rotation, int colour) +/** + @brief Createdxf::drawText + draw simple text in dxf format without any alignment specified + @param fileName + @param text + @param x + @param y + @param height + @param rotation + @param colour +*/ +void Createdxf::drawText(const QString& fileName, + const QString& text, + double x, + double y, + double height, + double rotation, + int colour) { if (!fileName.isEmpty()) { QFile file(fileName); @@ -744,8 +778,20 @@ void Createdxf::drawText(const QString& fileName, const QString& text,double x, /* 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, + bool leftAlign, + float scale) { Q_UNUSED(scale); @@ -774,8 +820,8 @@ void Createdxf::drawTextAligned(const QString& fileName, const QString& text,dou To_Dxf << 0.0 << "\r\n"; // Z in UCS (User Coordinate System)coordinates To_Dxf << 40 << "\r\n"; To_Dxf << height << "\r\n"; // Text Height - To_Dxf << 41 << "\r\n"; - To_Dxf << xScale << "\r\n"; // X Scale + To_Dxf << 41 << "\r\n"; + To_Dxf << xScale << "\r\n"; // X Scale To_Dxf << 1 << "\r\n"; To_Dxf << text << "\r\n"; // Text Value To_Dxf << 50 << "\r\n"; diff --git a/sources/dataBase/projectdatabase.cpp b/sources/dataBase/projectdatabase.cpp index 3c8d16be9..cce9e8e35 100644 --- a/sources/dataBase/projectdatabase.cpp +++ b/sources/dataBase/projectdatabase.cpp @@ -534,7 +534,10 @@ QHash projectDataBase::elementInfoToString(Element *elmt) @param caption @param dir */ -void projectDataBase::exportDb(projectDataBase *db, QWidget *parent, const QString &caption, const QString &dir) +void projectDataBase::exportDb(projectDataBase *db, + QWidget *parent, + const QString &caption, + const QString &dir) { auto caption_ = caption; if (caption_.isEmpty()) { diff --git a/sources/dataBase/projectdatabase.h b/sources/dataBase/projectdatabase.h index 09f86e7fb..ec8d29c1a 100644 --- a/sources/dataBase/projectdatabase.h +++ b/sources/dataBase/projectdatabase.h @@ -42,7 +42,10 @@ class projectDataBase : public QObject public: projectDataBase(QETProject *project, QObject *parent = nullptr); private: - projectDataBase(QETProject *project, const QString &connection_name, const QString &path, QObject *parent = nullptr); + projectDataBase(QETProject *project, + const QString &connection_name, + const QString &path, + QObject *parent = nullptr); public: virtual ~projectDataBase() override; @@ -59,7 +62,8 @@ class projectDataBase : public QObject void dataBaseUpdated(); private: - bool createDataBase(const QString &connection_name= QString(), const QString &name = QString()); + bool createDataBase(const QString &connection_name= QString(), + const QString &name = QString()); void createElementNomenclatureView(); void createSummaryView(); void populateDiagramTable(); @@ -67,7 +71,8 @@ class projectDataBase : public QObject void populateElementInfoTable(); void populateDiagramInfoTable(); void prepareQuery(); - static QHash elementInfoToString(Element *elmt); + static QHash elementInfoToString( + Element *elmt); private: QPointer m_project; @@ -81,7 +86,10 @@ class projectDataBase : public QObject m_insert_diagram_info_query; public: - static void exportDb(projectDataBase *db, QWidget *parent = nullptr, const QString &caption = QString(), const QString &dir = QString()); + static void exportDb(projectDataBase *db, + QWidget *parent = nullptr, + const QString &caption = QString(), + const QString &dir = QString()); }; #endif // PROJECTDATABASE_H diff --git a/sources/diagram.h b/sources/diagram.h index bbe7325e5..5044c80e7 100644 --- a/sources/diagram.h +++ b/sources/diagram.h @@ -133,12 +133,14 @@ class Diagram : public QGraphicsScene protected: void drawBackground(QPainter *, const QRectF &) override; - void mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event) override; - void mousePressEvent (QGraphicsSceneMouseEvent *event) override; - void mouseMoveEvent (QGraphicsSceneMouseEvent *event) override; - void mouseReleaseEvent (QGraphicsSceneMouseEvent *event) override; - void wheelEvent (QGraphicsSceneWheelEvent *event) override; - void keyPressEvent (QKeyEvent *event) override; + void mouseDoubleClickEvent ( + QGraphicsSceneMouseEvent *event) override; + void mousePressEvent (QGraphicsSceneMouseEvent *event) override; + void mouseMoveEvent (QGraphicsSceneMouseEvent *event) override; + void mouseReleaseEvent ( + QGraphicsSceneMouseEvent *event) override; + void wheelEvent (QGraphicsSceneWheelEvent *event) override; + void keyPressEvent (QKeyEvent *event) override; void keyReleaseEvent (QKeyEvent *) override; public: @@ -167,18 +169,30 @@ class Diagram : public QGraphicsScene // methods related to XML import/export QDomDocument toXml(bool = true); - bool initFromXml(QDomElement &, QPointF = QPointF(), - bool = true, DiagramContent * = nullptr); - bool fromXml(QDomDocument &, QPointF = QPointF(), - bool = true, DiagramContent * = nullptr); - bool fromXml(QDomElement &, QPointF = QPointF(), - bool = true, DiagramContent * = nullptr); - void folioSequentialsToXml(QHash*, - QDomElement *, const QString&, - const QString&, QDomDocument *); - void folioSequentialsFromXml(const QDomElement&, QHash*, const QString&, - const QString&, const QString&, + bool initFromXml(QDomElement &, + QPointF = QPointF(), + bool = true, + DiagramContent * = nullptr); + bool fromXml(QDomDocument &, + QPointF = QPointF(), + bool = true, + DiagramContent * = nullptr); + bool fromXml(QDomElement &, + QPointF = QPointF(), + bool = true, + DiagramContent * = nullptr); + void folioSequentialsToXml(QHash*, + QDomElement *, + const QString&, + const QString&, + QDomDocument *); + void folioSequentialsFromXml(const QDomElement&, + QHash*, + const QString&, + const QString&, + const QString&, const QString&); void refreshContents(); diff --git a/sources/diagramcommands.h b/sources/diagramcommands.h index 9c9be5c95..822359be0 100644 --- a/sources/diagramcommands.h +++ b/sources/diagramcommands.h @@ -181,8 +181,10 @@ class MoveConductorsTextsCommand : public QUndoCommand { public: void undo() override; void redo() override; - virtual void addTextMovement(ConductorTextItem *, const QPointF &, - const QPointF &, bool = false); + virtual void addTextMovement(ConductorTextItem *, + const QPointF &, + const QPointF &, + bool = false); private: void regenerateTextLabel(); diff --git a/sources/diagramprintdialog.cpp b/sources/diagramprintdialog.cpp index 7d410bccb..0ab8612a4 100644 --- a/sources/diagramprintdialog.cpp +++ b/sources/diagramprintdialog.cpp @@ -88,7 +88,8 @@ QString DiagramPrintDialog::docName() const { @param options : @return the rectangle to be printed */ -QRect DiagramPrintDialog::diagramRect(Diagram *diagram, const ExportProperties &options) const { +QRect DiagramPrintDialog::diagramRect(Diagram *diagram, + const ExportProperties &options) const { if (!diagram) return(QRect()); QRectF diagram_rect = diagram -> border_and_titleblock.borderAndTitleBlockRect(); diff --git a/sources/diagramprintdialog.h b/sources/diagramprintdialog.h index e9b1dcee9..a996eca97 100644 --- a/sources/diagramprintdialog.h +++ b/sources/diagramprintdialog.h @@ -49,22 +49,34 @@ class DiagramPrintDialog : public QWidget void setDocName(const QString &); QString docName() const; QRect diagramRect(Diagram *, const ExportProperties &) const; - int pagesCount(Diagram *, const ExportProperties &, bool = false) const; - int horizontalPagesCount(Diagram *, const ExportProperties &, bool = false) const; - int verticalPagesCount(Diagram *, const ExportProperties &, bool = false) const; + int pagesCount(Diagram *, + const ExportProperties &, + bool = false) const; + int horizontalPagesCount(Diagram *, + const ExportProperties &, + bool = false) const; + int verticalPagesCount(Diagram *, + const ExportProperties &, + bool = false) const; void exec(); private: void buildPrintTypeDialog(); void buildDialog(); - void saveReloadDiagramParameters(Diagram *, const ExportProperties&, bool); + void saveReloadDiagramParameters(Diagram *, + const ExportProperties&, + bool); void savePageSetupForCurrentPrinter(); void loadPageSetupForCurrentPrinter(); QString settingsSectionName(const QPrinter *); private slots: void print(const QList &, bool, const ExportProperties&); - void printDiagram(Diagram *, bool, const ExportProperties &, QPainter *, QPrinter * = nullptr); + void printDiagram(Diagram *, + bool, + const ExportProperties &, + QPainter *, + QPrinter * = nullptr); void updatePrintTypeDialog(); void acceptPrintTypeDialog(); void browseFilePrintTypeDialog(); diff --git a/sources/editor/UndoCommand/pastepartscommand.cpp b/sources/editor/UndoCommand/pastepartscommand.cpp index fe9ae060e..73444af19 100644 --- a/sources/editor/UndoCommand/pastepartscommand.cpp +++ b/sources/editor/UndoCommand/pastepartscommand.cpp @@ -28,7 +28,10 @@ in the constructor of this class to avoid have several terminal of an element with the same uuid. */ -PastePartsCommand::PastePartsCommand(ElementView *view, const ElementContent &content_to_paste, QUndoCommand *parent) : +PastePartsCommand::PastePartsCommand( + ElementView *view, + const ElementContent &content_to_paste, + QUndoCommand *parent) : ElementEditionCommand(view ? view -> scene() : nullptr, view, parent) { for (auto qgi : content_to_paste) diff --git a/sources/editor/editorcommands.cpp b/sources/editor/editorcommands.cpp index ae5029be2..5597b10b7 100644 --- a/sources/editor/editorcommands.cpp +++ b/sources/editor/editorcommands.cpp @@ -25,7 +25,9 @@ @param view @param parent : Parent command */ -ElementEditionCommand::ElementEditionCommand(ElementScene *scene, ElementView *view, QUndoCommand *parent): +ElementEditionCommand::ElementEditionCommand(ElementScene *scene, + ElementView *view, + QUndoCommand *parent): QUndoCommand(parent), m_scene(scene), m_view(view) @@ -41,7 +43,10 @@ ElementEditionCommand::ElementEditionCommand(ElementScene *scene, ElementView *v @param view @param parent : Parent command */ -ElementEditionCommand::ElementEditionCommand(const QString &text, ElementScene *scene, ElementView *view, QUndoCommand *parent): +ElementEditionCommand::ElementEditionCommand(const QString &text, + ElementScene *scene, + ElementView *view, + QUndoCommand *parent): QUndoCommand(text, parent), m_scene(scene), m_view(view) @@ -543,7 +548,12 @@ void ScalePartsCommand::adjustText() { @param elmt_info : new info about type. @param parent : parent undo */ -ChangePropertiesCommand::ChangePropertiesCommand(ElementScene *scene, const QString& type, const DiagramContext& info, const DiagramContext& elmt_info, QUndoCommand *parent) : +ChangePropertiesCommand::ChangePropertiesCommand( + ElementScene *scene, + const QString& type, + const DiagramContext& info, + const DiagramContext& elmt_info, + QUndoCommand *parent) : ElementEditionCommand(scene, nullptr, parent) { m_type << scene->m_elmt_type << type; diff --git a/sources/editor/editorcommands.h b/sources/editor/editorcommands.h index 07ec7a4c2..b560a97d8 100644 --- a/sources/editor/editorcommands.h +++ b/sources/editor/editorcommands.h @@ -33,8 +33,13 @@ class ElementEditionCommand : public QUndoCommand { // constructors, destructor public: - ElementEditionCommand(ElementScene * = nullptr, ElementView * = nullptr, QUndoCommand * = nullptr); - ElementEditionCommand(const QString &, ElementScene * = nullptr, ElementView * = nullptr, QUndoCommand * = nullptr); + ElementEditionCommand(ElementScene * = nullptr, + ElementView * = nullptr, + QUndoCommand * = nullptr); + ElementEditionCommand(const QString &, + ElementScene * = nullptr, + ElementView * = nullptr, + QUndoCommand * = nullptr); ~ElementEditionCommand() override; private: ElementEditionCommand(const ElementEditionCommand &); @@ -259,7 +264,12 @@ class ScalePartsCommand : public ElementEditionCommand { class ChangePropertiesCommand : public ElementEditionCommand { public: - ChangePropertiesCommand (ElementScene *scene, const QString& type, const DiagramContext& info, const DiagramContext& elmt_info, QUndoCommand *parent=nullptr); + ChangePropertiesCommand ( + ElementScene *scene, + const QString& type, + const DiagramContext& info, + const DiagramContext& elmt_info, + QUndoCommand *parent=nullptr); ~ChangePropertiesCommand () override; void undo() override; diff --git a/sources/editor/elementprimitivedecorator.cpp b/sources/editor/elementprimitivedecorator.cpp index 768d1d769..e9c56b7d1 100644 --- a/sources/editor/elementprimitivedecorator.cpp +++ b/sources/editor/elementprimitivedecorator.cpp @@ -80,11 +80,14 @@ QRectF ElementPrimitiveDecorator::boundingRect() const @param option : The option parameter provides style options for the item, such as its state, exposed area and its level-of-detail hints. - @param The widget argument is optional. If provided, it points to the - widget that is being painted on; otherwise, it is 0. For cached painting, - widget is always 0. + @param widget : + The widget argument is optional. If provided, + it points to the widget that is being painted on; otherwise, it is 0. + For cached painting, widget is always 0. */ -void ElementPrimitiveDecorator::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) +void ElementPrimitiveDecorator::paint(QPainter *painter, + const QStyleOptionGraphicsItem *option, + QWidget *widget) { Q_UNUSED(option) Q_UNUSED(widget) diff --git a/sources/editor/elementprimitivedecorator.h b/sources/editor/elementprimitivedecorator.h index febfce40e..1ec82cc37 100644 --- a/sources/editor/elementprimitivedecorator.h +++ b/sources/editor/elementprimitivedecorator.h @@ -50,7 +50,9 @@ class ElementPrimitiveDecorator : public QGraphicsObject // methods QRectF internalBoundingRect() const; QRectF boundingRect () const override; - void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget * = nullptr) override; + void paint(QPainter *, + const QStyleOptionGraphicsItem *, + QWidget * = nullptr) override; int type() const override { return Type; } void setItems(const QList &); void setItems(const QList &); diff --git a/sources/editor/graphicspart/customelementgraphicpart.cpp b/sources/editor/graphicspart/customelementgraphicpart.cpp index 4c656bf1a..73494aa5a 100644 --- a/sources/editor/graphicspart/customelementgraphicpart.cpp +++ b/sources/editor/graphicspart/customelementgraphicpart.cpp @@ -27,7 +27,8 @@ @param editor QETElement editor that belong this. @param parent */ -CustomElementGraphicPart::CustomElementGraphicPart(QETElementEditor *editor, QGraphicsItem *parent) : +CustomElementGraphicPart::CustomElementGraphicPart(QETElementEditor *editor, + QGraphicsItem *parent) : QGraphicsObject (parent), CustomElementPart(editor), m_hovered (false), @@ -37,7 +38,9 @@ CustomElementGraphicPart::CustomElementGraphicPart(QETElementEditor *editor, QGr _color(BlackColor), _antialiased(false) { - setFlags(QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemSendsGeometryChanges); + setFlags(QGraphicsItem::ItemIsSelectable + | QGraphicsItem::ItemIsMovable + | QGraphicsItem::ItemSendsGeometryChanges); setAcceptHoverEvents(true); } @@ -54,13 +57,24 @@ CustomElementGraphicPart::~CustomElementGraphicPart() {} @param painter : painter to use for draw cross, the painter state is restored at end of this method. */ -void CustomElementGraphicPart::drawCross(const QPointF ¢er, QPainter *painter) +void CustomElementGraphicPart::drawCross(const QPointF ¢er, + QPainter *painter) { painter -> save(); painter -> setRenderHint(QPainter::Antialiasing, false); - painter -> setPen((painter -> brush().color() == QColor(Qt::black) && painter -> brush().isOpaque()) ? Qt::yellow : Qt::blue); - painter -> drawLine(QLineF(center.x() - 2.0, center.y(), center.x() + 2.0, center.y())); - painter -> drawLine(QLineF(center.x(), center.y() - 2.0, center.x(), center.y() + 2.0)); + painter -> setPen((painter -> brush().color() + == QColor(Qt::black) + && painter -> brush().isOpaque()) + ? Qt::yellow + : Qt::blue); + painter -> drawLine(QLineF(center.x() - 2.0, + center.y(), + center.x() + 2.0, + center.y())); + painter -> drawLine(QLineF(center.x(), + center.y() - 2.0, + center.x(), + center.y() + 2.0)); painter -> restore(); } @@ -94,7 +108,7 @@ void CustomElementGraphicPart::setLineWeight(const LineWeight lw) */ qreal CustomElementGraphicPart::penWeight() const { - if (_lineweight == NoneWeight || _lineweight == ThinWeight) return 0; + if (_lineweight == NoneWeight || _lineweight == ThinWeight) return 0; else if (_lineweight == NormalWeight) return 1; else if (_lineweight == UltraWeight) return 2; else if (_lineweight == BigWeight) return 5; diff --git a/sources/editor/graphicspart/customelementgraphicpart.h b/sources/editor/graphicspart/customelementgraphicpart.h index 3d683504b..4131c86a1 100644 --- a/sources/editor/graphicspart/customelementgraphicpart.h +++ b/sources/editor/graphicspart/customelementgraphicpart.h @@ -46,28 +46,230 @@ class CustomElementGraphicPart : public QGraphicsObject, public CustomElementPar public: //Line style - enum LineStyle {NormalStyle, DashedStyle, DottedStyle, DashdottedStyle}; + enum LineStyle {NormalStyle, + DashedStyle, + DottedStyle, + DashdottedStyle}; Q_ENUM (LineStyle) //Line weight : invisible, 0px, 1px, 2px, 5px - enum LineWeight {NoneWeight, ThinWeight, NormalWeight, UltraWeight, BigWeight}; + enum LineWeight {NoneWeight, + ThinWeight, + NormalWeight, + UltraWeight, + BigWeight}; Q_ENUM (LineWeight) - //Filling color of the part : NoneFilling -> No filling (i.e. transparent) - enum Filling { NoneFilling, BlackFilling, WhiteFilling, GreenFilling, RedFilling, BlueFilling, GrayFilling, BrunFilling, YellowFilling, CyanFilling, MagentaFilling, LightgrayFilling, OrangeFilling, PurpleFilling, HTMLPinkPinkFilling, HTMLPinkLightPinkFilling, HTMLPinkHotPinkFilling, HTMLPinkDeepPinkFilling, HTMLPinkPaleVioletRedFilling, HTMLPinkMediumVioletRedFilling, HTMLRedLightSalmonFilling, HTMLRedSalmonFilling, HTMLRedDarkSalmonFilling, HTMLRedLightCoralFilling, HTMLRedIndianRedFilling, HTMLRedCrimsonFilling, HTMLRedFirebrickFilling, HTMLRedDarkRedFilling, HTMLRedRedFilling, HTMLOrangeOrangeRedFilling, HTMLOrangeTomatoFilling, HTMLOrangeCoralFilling, HTMLOrangeDarkOrangeFilling, HTMLOrangeOrangeFilling, HTMLYellowYellowFilling, HTMLYellowLightYellowFilling, HTMLYellowLemonChiffonFilling, HTMLYellowLightGoldenrodYellowFilling, HTMLYellowPapayaWhipFilling, HTMLYellowMoccasinFilling, HTMLYellowPeachPuffFilling, HTMLYellowPaleGoldenrodFilling, HTMLYellowKhakiFilling, HTMLYellowDarkKhakiFilling, HTMLYellowGoldFilling, HTMLBrownCornsilkFilling, HTMLBrownBlanchedAlmondFilling, HTMLBrownBisqueFilling, HTMLBrownNavajoWhiteFilling, HTMLBrownWheatFilling, HTMLBrownBurlywoodFilling, HTMLBrownTanFilling, HTMLBrownRosyBrownFilling, HTMLBrownSandyBrownFilling, HTMLBrownGoldenrodFilling, HTMLBrownDarkGoldenrodFilling, HTMLBrownPeruFilling, HTMLBrownChocolateFilling, HTMLBrownSaddleBrownFilling, HTMLBrownSiennaFilling, HTMLBrownBrownFilling, HTMLBrownMaroonFilling, HTMLGreenDarkOliveGreenFilling, HTMLGreenOliveFilling, HTMLGreenOliveDrabFilling, HTMLGreenYellowGreenFilling, HTMLGreenLimeGreenFilling, HTMLGreenLimeFilling, HTMLGreenLawnGreenFilling, HTMLGreenChartreuseFilling, HTMLGreenGreenYellowFilling, HTMLGreenSpringGreenFilling, HTMLGreenMediumSpringGreenFilling, HTMLGreenLightGreenFilling, HTMLGreenPaleGreenFilling, HTMLGreenDarkSeaGreenFilling, HTMLGreenMediumAquamarineFilling, HTMLGreenMediumSeaGreenFilling, HTMLGreenSeaGreenFilling, HTMLGreenForestGreenFilling, HTMLGreenGreenFilling, HTMLGreenDarkGreenFilling, HTMLCyanAquaFilling, HTMLCyanCyanFilling, HTMLCyanLightCyanFilling, HTMLCyanPaleTurquoiseFilling, HTMLCyanAquamarineFilling, HTMLCyanTurquoiseFilling, HTMLCyanMediumTurquoiseFilling, HTMLCyanDarkTurquoiseFilling, HTMLCyanLightSeaGreenFilling, HTMLCyanCadetBlueFilling, HTMLCyanDarkCyanFilling, HTMLCyanTealFilling, HTMLBlueLightSteelBlueFilling, HTMLBluePowderBlueFilling, HTMLBlueLightBlueFilling, HTMLBlueSkyBlueFilling, HTMLBlueLightSkyBlueFilling, HTMLBlueDeepSkyBlueFilling, HTMLBlueDodgerBlueFilling, HTMLBlueCornflowerBlueFilling, HTMLBlueSteelBlueFilling, HTMLBlueRoyalBlueFilling, HTMLBlueBlueFilling, HTMLBlueMediumBlueFilling, HTMLBlueDarkBlueFilling, HTMLBlueNavyFilling, HTMLBlueMidnightBlueFilling, HTMLPurpleLavenderFilling, HTMLPurpleThistleFilling, HTMLPurplePlumFilling, HTMLPurpleVioletFilling, HTMLPurpleOrchidFilling, HTMLPurpleFuchsiaFilling, HTMLPurpleMagentaFilling, HTMLPurpleMediumOrchidFilling, HTMLPurpleMediumPurpleFilling, HTMLPurpleBlueVioletFilling, HTMLPurpleDarkVioletFilling, HTMLPurpleDarkOrchidFilling, HTMLPurpleDarkMagentaFilling, HTMLPurplePurpleFilling, HTMLPurpleIndigoFilling, HTMLPurpleDarkSlateBlueFilling, HTMLPurpleSlateBlueFilling, HTMLPurpleMediumSlateBlueFilling, HTMLWhiteWhiteFilling, HTMLWhiteSnowFilling, HTMLWhiteHoneydewFilling, HTMLWhiteMintCreamFilling, HTMLWhiteAzureFilling, HTMLWhiteAliceBlueFilling, HTMLWhiteGhostWhiteFilling, HTMLWhiteWhiteSmokeFilling, HTMLWhiteSeashellFilling, HTMLWhiteBeigeFilling, HTMLWhiteOldLaceFilling, HTMLWhiteFloralWhiteFilling, HTMLWhiteIvoryFilling, HTMLWhiteAntiqueWhiteFilling, HTMLWhiteLinenFilling, HTMLWhiteLavenderBlushFilling, HTMLWhiteMistyRoseFilling, HTMLGrayGainsboroFilling, HTMLGrayLightGrayFilling, HTMLGraySilverFilling, HTMLGrayDarkGrayFilling, HTMLGrayGrayFilling, HTMLGrayDimGrayFilling, HTMLGrayLightSlateGrayFilling, HTMLGraySlateGrayFilling, HTMLGrayDarkSlateGrayFilling, HTMLGrayBlackFilling, HorFilling, VerFilling, BdiagFilling, FdiagFilling}; + //Filling color of the part : NoneFilling -> No filling (i.e. transparent) + enum Filling { NoneFilling, BlackFilling, WhiteFilling, + GreenFilling, RedFilling, BlueFilling, + GrayFilling, BrunFilling, YellowFilling, + CyanFilling, MagentaFilling, LightgrayFilling, + OrangeFilling, PurpleFilling, + HTMLPinkPinkFilling, HTMLPinkLightPinkFilling, + HTMLPinkHotPinkFilling, HTMLPinkDeepPinkFilling, + HTMLPinkPaleVioletRedFilling, + HTMLPinkMediumVioletRedFilling, + HTMLRedLightSalmonFilling, HTMLRedSalmonFilling, + HTMLRedDarkSalmonFilling, + HTMLRedLightCoralFilling, + HTMLRedIndianRedFilling, HTMLRedCrimsonFilling, + HTMLRedFirebrickFilling, HTMLRedDarkRedFilling, + HTMLRedRedFilling, HTMLOrangeOrangeRedFilling, + HTMLOrangeTomatoFilling, HTMLOrangeCoralFilling, + HTMLOrangeDarkOrangeFilling, + HTMLOrangeOrangeFilling, HTMLYellowYellowFilling, + HTMLYellowLightYellowFilling, + HTMLYellowLemonChiffonFilling, + HTMLYellowLightGoldenrodYellowFilling, + HTMLYellowPapayaWhipFilling, + HTMLYellowMoccasinFilling, + HTMLYellowPeachPuffFilling, + HTMLYellowPaleGoldenrodFilling, + HTMLYellowKhakiFilling, + HTMLYellowDarkKhakiFilling, + HTMLYellowGoldFilling, HTMLBrownCornsilkFilling, + HTMLBrownBlanchedAlmondFilling, + HTMLBrownBisqueFilling, + HTMLBrownNavajoWhiteFilling, + HTMLBrownWheatFilling, HTMLBrownBurlywoodFilling, + HTMLBrownTanFilling, HTMLBrownRosyBrownFilling, + HTMLBrownSandyBrownFilling, + HTMLBrownGoldenrodFilling, + HTMLBrownDarkGoldenrodFilling, + HTMLBrownPeruFilling, HTMLBrownChocolateFilling, + HTMLBrownSaddleBrownFilling, + HTMLBrownSiennaFilling, HTMLBrownBrownFilling, + HTMLBrownMaroonFilling, + HTMLGreenDarkOliveGreenFilling, + HTMLGreenOliveFilling, HTMLGreenOliveDrabFilling, + HTMLGreenYellowGreenFilling, + HTMLGreenLimeGreenFilling, HTMLGreenLimeFilling, + HTMLGreenLawnGreenFilling, + HTMLGreenChartreuseFilling, + HTMLGreenGreenYellowFilling, + HTMLGreenSpringGreenFilling, + HTMLGreenMediumSpringGreenFilling, + HTMLGreenLightGreenFilling, + HTMLGreenPaleGreenFilling, + HTMLGreenDarkSeaGreenFilling, + HTMLGreenMediumAquamarineFilling, + HTMLGreenMediumSeaGreenFilling, + HTMLGreenSeaGreenFilling, + HTMLGreenForestGreenFilling, + HTMLGreenGreenFilling, HTMLGreenDarkGreenFilling, + HTMLCyanAquaFilling, HTMLCyanCyanFilling, + HTMLCyanLightCyanFilling, + HTMLCyanPaleTurquoiseFilling, + HTMLCyanAquamarineFilling, + HTMLCyanTurquoiseFilling, + HTMLCyanMediumTurquoiseFilling, + HTMLCyanDarkTurquoiseFilling, + HTMLCyanLightSeaGreenFilling, + HTMLCyanCadetBlueFilling, + HTMLCyanDarkCyanFilling, HTMLCyanTealFilling, + HTMLBlueLightSteelBlueFilling, + HTMLBluePowderBlueFilling, + HTMLBlueLightBlueFilling, HTMLBlueSkyBlueFilling, + HTMLBlueLightSkyBlueFilling, + HTMLBlueDeepSkyBlueFilling, + HTMLBlueDodgerBlueFilling, + HTMLBlueCornflowerBlueFilling, + HTMLBlueSteelBlueFilling, + HTMLBlueRoyalBlueFilling, HTMLBlueBlueFilling, + HTMLBlueMediumBlueFilling, + HTMLBlueDarkBlueFilling, HTMLBlueNavyFilling, + HTMLBlueMidnightBlueFilling, + HTMLPurpleLavenderFilling, + HTMLPurpleThistleFilling, HTMLPurplePlumFilling, + HTMLPurpleVioletFilling, HTMLPurpleOrchidFilling, + HTMLPurpleFuchsiaFilling, + HTMLPurpleMagentaFilling, + HTMLPurpleMediumOrchidFilling, + HTMLPurpleMediumPurpleFilling, + HTMLPurpleBlueVioletFilling, + HTMLPurpleDarkVioletFilling, + HTMLPurpleDarkOrchidFilling, + HTMLPurpleDarkMagentaFilling, + HTMLPurplePurpleFilling, HTMLPurpleIndigoFilling, + HTMLPurpleDarkSlateBlueFilling, + HTMLPurpleSlateBlueFilling, + HTMLPurpleMediumSlateBlueFilling, + HTMLWhiteWhiteFilling, HTMLWhiteSnowFilling, + HTMLWhiteHoneydewFilling, + HTMLWhiteMintCreamFilling, HTMLWhiteAzureFilling, + HTMLWhiteAliceBlueFilling, + HTMLWhiteGhostWhiteFilling, + HTMLWhiteWhiteSmokeFilling, + HTMLWhiteSeashellFilling, HTMLWhiteBeigeFilling, + HTMLWhiteOldLaceFilling, + HTMLWhiteFloralWhiteFilling, + HTMLWhiteIvoryFilling, + HTMLWhiteAntiqueWhiteFilling, + HTMLWhiteLinenFilling, + HTMLWhiteLavenderBlushFilling, + HTMLWhiteMistyRoseFilling, + HTMLGrayGainsboroFilling, + HTMLGrayLightGrayFilling, HTMLGraySilverFilling, + HTMLGrayDarkGrayFilling, HTMLGrayGrayFilling, + HTMLGrayDimGrayFilling, + HTMLGrayLightSlateGrayFilling, + HTMLGraySlateGrayFilling, + HTMLGrayDarkSlateGrayFilling, + HTMLGrayBlackFilling, HorFilling, VerFilling, + BdiagFilling, FdiagFilling}; Q_ENUM (Filling) //Line color - enum Color {BlackColor, WhiteColor, GreenColor, RedColor, BlueColor, GrayColor, BrunColor, YellowColor, CyanColor, MagentaColor, LightgrayColor, OrangeColor, PurpleColor, HTMLPinkPinkColor, HTMLPinkLightPinkColor, HTMLPinkHotPinkColor, HTMLPinkDeepPinkColor, HTMLPinkPaleVioletRedColor, HTMLPinkMediumVioletRedColor, HTMLRedLightSalmonColor, HTMLRedSalmonColor, HTMLRedDarkSalmonColor, HTMLRedLightCoralColor, HTMLRedIndianRedColor, HTMLRedCrimsonColor, HTMLRedFirebrickColor, HTMLRedDarkRedColor, HTMLRedRedColor, HTMLOrangeOrangeRedColor, HTMLOrangeTomatoColor, HTMLOrangeCoralColor, HTMLOrangeDarkOrangeColor, HTMLOrangeOrangeColor, HTMLYellowYellowColor, HTMLYellowLightYellowColor, HTMLYellowLemonChiffonColor, HTMLYellowLightGoldenrodYellowColor, HTMLYellowPapayaWhipColor, HTMLYellowMoccasinColor, HTMLYellowPeachPuffColor, HTMLYellowPaleGoldenrodColor, HTMLYellowKhakiColor, HTMLYellowDarkKhakiColor, HTMLYellowGoldColor, HTMLBrownCornsilkColor, HTMLBrownBlanchedAlmondColor, HTMLBrownBisqueColor, HTMLBrownNavajoWhiteColor, HTMLBrownWheatColor, HTMLBrownBurlywoodColor, HTMLBrownTanColor, HTMLBrownRosyBrownColor, HTMLBrownSandyBrownColor, HTMLBrownGoldenrodColor, HTMLBrownDarkGoldenrodColor, HTMLBrownPeruColor, HTMLBrownChocolateColor, HTMLBrownSaddleBrownColor, HTMLBrownSiennaColor, HTMLBrownBrownColor, HTMLBrownMaroonColor, HTMLGreenDarkOliveGreenColor, HTMLGreenOliveColor, HTMLGreenOliveDrabColor, HTMLGreenYellowGreenColor, HTMLGreenLimeGreenColor, HTMLGreenLimeColor, HTMLGreenLawnGreenColor, HTMLGreenChartreuseColor, HTMLGreenGreenYellowColor, HTMLGreenSpringGreenColor, HTMLGreenMediumSpringGreenColor, HTMLGreenLightGreenColor, HTMLGreenPaleGreenColor, HTMLGreenDarkSeaGreenColor, HTMLGreenMediumAquamarineColor, HTMLGreenMediumSeaGreenColor, HTMLGreenSeaGreenColor, HTMLGreenForestGreenColor, HTMLGreenGreenColor, HTMLGreenDarkGreenColor, HTMLCyanAquaColor, HTMLCyanCyanColor, HTMLCyanLightCyanColor, HTMLCyanPaleTurquoiseColor, HTMLCyanAquamarineColor, HTMLCyanTurquoiseColor, HTMLCyanMediumTurquoiseColor, HTMLCyanDarkTurquoiseColor, HTMLCyanLightSeaGreenColor, HTMLCyanCadetBlueColor, HTMLCyanDarkCyanColor, HTMLCyanTealColor, HTMLBlueLightSteelBlueColor, HTMLBluePowderBlueColor, HTMLBlueLightBlueColor, HTMLBlueSkyBlueColor, HTMLBlueLightSkyBlueColor, HTMLBlueDeepSkyBlueColor, HTMLBlueDodgerBlueColor, HTMLBlueCornflowerBlueColor, HTMLBlueSteelBlueColor, HTMLBlueRoyalBlueColor, HTMLBlueBlueColor, HTMLBlueMediumBlueColor, HTMLBlueDarkBlueColor, HTMLBlueNavyColor, HTMLBlueMidnightBlueColor, HTMLPurpleLavenderColor, HTMLPurpleThistleColor, HTMLPurplePlumColor, HTMLPurpleVioletColor, HTMLPurpleOrchidColor, HTMLPurpleFuchsiaColor, HTMLPurpleMagentaColor, HTMLPurpleMediumOrchidColor, HTMLPurpleMediumPurpleColor, HTMLPurpleBlueVioletColor, HTMLPurpleDarkVioletColor, HTMLPurpleDarkOrchidColor, HTMLPurpleDarkMagentaColor, HTMLPurplePurpleColor, HTMLPurpleIndigoColor, HTMLPurpleDarkSlateBlueColor, HTMLPurpleSlateBlueColor, HTMLPurpleMediumSlateBlueColor, HTMLWhiteWhiteColor, HTMLWhiteSnowColor, HTMLWhiteHoneydewColor, HTMLWhiteMintCreamColor, HTMLWhiteAzureColor, HTMLWhiteAliceBlueColor, HTMLWhiteGhostWhiteColor, HTMLWhiteWhiteSmokeColor, HTMLWhiteSeashellColor, HTMLWhiteBeigeColor, HTMLWhiteOldLaceColor, HTMLWhiteFloralWhiteColor, HTMLWhiteIvoryColor, HTMLWhiteAntiqueWhiteColor, HTMLWhiteLinenColor, HTMLWhiteLavenderBlushColor, HTMLWhiteMistyRoseColor, HTMLGrayGainsboroColor, HTMLGrayLightGrayColor, HTMLGraySilverColor, HTMLGrayDarkGrayColor, HTMLGrayGrayColor, HTMLGrayDimGrayColor, HTMLGrayLightSlateGrayColor, HTMLGraySlateGrayColor, HTMLGrayDarkSlateGrayColor, HTMLGrayBlackColor, NoneColor}; + enum Color { + BlackColor, WhiteColor, GreenColor, RedColor, BlueColor, + GrayColor, BrunColor, YellowColor, CyanColor, + MagentaColor, LightgrayColor, OrangeColor, PurpleColor, + HTMLPinkPinkColor, HTMLPinkLightPinkColor, + HTMLPinkHotPinkColor, HTMLPinkDeepPinkColor, + HTMLPinkPaleVioletRedColor, + HTMLPinkMediumVioletRedColor, HTMLRedLightSalmonColor, + HTMLRedSalmonColor, HTMLRedDarkSalmonColor, + HTMLRedLightCoralColor, HTMLRedIndianRedColor, + HTMLRedCrimsonColor, HTMLRedFirebrickColor, + HTMLRedDarkRedColor, HTMLRedRedColor, + HTMLOrangeOrangeRedColor, HTMLOrangeTomatoColor, + HTMLOrangeCoralColor, HTMLOrangeDarkOrangeColor, + HTMLOrangeOrangeColor, HTMLYellowYellowColor, + HTMLYellowLightYellowColor, HTMLYellowLemonChiffonColor, + HTMLYellowLightGoldenrodYellowColor, + HTMLYellowPapayaWhipColor, HTMLYellowMoccasinColor, + HTMLYellowPeachPuffColor, HTMLYellowPaleGoldenrodColor, + HTMLYellowKhakiColor, HTMLYellowDarkKhakiColor, + HTMLYellowGoldColor, HTMLBrownCornsilkColor, + HTMLBrownBlanchedAlmondColor, HTMLBrownBisqueColor, + HTMLBrownNavajoWhiteColor, HTMLBrownWheatColor, + HTMLBrownBurlywoodColor, HTMLBrownTanColor, + HTMLBrownRosyBrownColor, HTMLBrownSandyBrownColor, + HTMLBrownGoldenrodColor, HTMLBrownDarkGoldenrodColor, + HTMLBrownPeruColor, HTMLBrownChocolateColor, + HTMLBrownSaddleBrownColor, HTMLBrownSiennaColor, + HTMLBrownBrownColor, HTMLBrownMaroonColor, + HTMLGreenDarkOliveGreenColor, HTMLGreenOliveColor, + HTMLGreenOliveDrabColor, HTMLGreenYellowGreenColor, + HTMLGreenLimeGreenColor, HTMLGreenLimeColor, + HTMLGreenLawnGreenColor, HTMLGreenChartreuseColor, + HTMLGreenGreenYellowColor, HTMLGreenSpringGreenColor, + HTMLGreenMediumSpringGreenColor, + HTMLGreenLightGreenColor, HTMLGreenPaleGreenColor, + HTMLGreenDarkSeaGreenColor, + HTMLGreenMediumAquamarineColor, + HTMLGreenMediumSeaGreenColor, HTMLGreenSeaGreenColor, + HTMLGreenForestGreenColor, HTMLGreenGreenColor, + HTMLGreenDarkGreenColor, HTMLCyanAquaColor, + HTMLCyanCyanColor, HTMLCyanLightCyanColor, + HTMLCyanPaleTurquoiseColor, HTMLCyanAquamarineColor, + HTMLCyanTurquoiseColor, HTMLCyanMediumTurquoiseColor, + HTMLCyanDarkTurquoiseColor, HTMLCyanLightSeaGreenColor, + HTMLCyanCadetBlueColor, HTMLCyanDarkCyanColor, + HTMLCyanTealColor, HTMLBlueLightSteelBlueColor, + HTMLBluePowderBlueColor, HTMLBlueLightBlueColor, + HTMLBlueSkyBlueColor, HTMLBlueLightSkyBlueColor, + HTMLBlueDeepSkyBlueColor, HTMLBlueDodgerBlueColor, + HTMLBlueCornflowerBlueColor, HTMLBlueSteelBlueColor, + HTMLBlueRoyalBlueColor, HTMLBlueBlueColor, + HTMLBlueMediumBlueColor, HTMLBlueDarkBlueColor, + HTMLBlueNavyColor, HTMLBlueMidnightBlueColor, + HTMLPurpleLavenderColor, HTMLPurpleThistleColor, + HTMLPurplePlumColor, HTMLPurpleVioletColor, + HTMLPurpleOrchidColor, HTMLPurpleFuchsiaColor, + HTMLPurpleMagentaColor, HTMLPurpleMediumOrchidColor, + HTMLPurpleMediumPurpleColor, HTMLPurpleBlueVioletColor, + HTMLPurpleDarkVioletColor, HTMLPurpleDarkOrchidColor, + HTMLPurpleDarkMagentaColor, HTMLPurplePurpleColor, + HTMLPurpleIndigoColor, HTMLPurpleDarkSlateBlueColor, + HTMLPurpleSlateBlueColor, + HTMLPurpleMediumSlateBlueColor, + HTMLWhiteWhiteColor, HTMLWhiteSnowColor, + HTMLWhiteHoneydewColor, HTMLWhiteMintCreamColor, + HTMLWhiteAzureColor, HTMLWhiteAliceBlueColor, + HTMLWhiteGhostWhiteColor, HTMLWhiteWhiteSmokeColor, + HTMLWhiteSeashellColor, HTMLWhiteBeigeColor, + HTMLWhiteOldLaceColor, HTMLWhiteFloralWhiteColor, + HTMLWhiteIvoryColor, HTMLWhiteAntiqueWhiteColor, + HTMLWhiteLinenColor, HTMLWhiteLavenderBlushColor, + HTMLWhiteMistyRoseColor, HTMLGrayGainsboroColor, + HTMLGrayLightGrayColor, HTMLGraySilverColor, + HTMLGrayDarkGrayColor, HTMLGrayGrayColor, + HTMLGrayDimGrayColor, HTMLGrayLightSlateGrayColor, + HTMLGraySlateGrayColor, HTMLGrayDarkSlateGrayColor, + HTMLGrayBlackColor, NoneColor}; Q_ENUM (Color) // constructors, destructor public: - CustomElementGraphicPart(QETElementEditor *editor, QGraphicsItem *parent = nullptr); + CustomElementGraphicPart(QETElementEditor *editor, + QGraphicsItem *parent = nullptr); ~CustomElementGraphicPart() override; - static void drawCross (const QPointF ¢er, QPainter *painter); + static void drawCross (const QPointF ¢er, + QPainter *painter); //Getter and setter LineStyle lineStyle () const {return _linestyle;} @@ -89,11 +291,15 @@ class CustomElementGraphicPart : public QGraphicsObject, public CustomElementPar //Rediriged to QObject Q_PROPERTY system - void setProperty (const char *name, const QVariant &value) override {QObject::setProperty(name, value);} - QVariant property (const char *name) const override {return QObject::property(name);} + void setProperty (const char *name, + const QVariant &value) override { + QObject::setProperty(name, value);} + QVariant property (const char *name) const override { + return QObject::property(name);} virtual QPainterPath shadowShape ()const = 0; - virtual void setHandlerColor(QPointF /*pos*/, const QColor &/*color*/) {} + virtual void setHandlerColor(QPointF /*pos*/, + const QColor &/*color*/) {} virtual void resetAllHandlerColor() {} protected: @@ -103,13 +309,15 @@ class CustomElementGraphicPart : public QGraphicsObject, public CustomElementPar void applyStylesToQPainter(QPainter &) const; void drawShadowShape (QPainter *painter); - QVariant itemChange(GraphicsItemChange change, const QVariant &value) override; + QVariant itemChange(GraphicsItemChange change, + const QVariant &value) override; void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override; void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override; void mousePressEvent(QGraphicsSceneMouseEvent *event) override; void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override; - void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override; + void mouseReleaseEvent( + QGraphicsSceneMouseEvent *event) override; // attributes bool m_hovered; diff --git a/sources/editor/graphicspart/parttext.cpp b/sources/editor/graphicspart/parttext.cpp index bd1725168..bae1ab802 100644 --- a/sources/editor/graphicspart/parttext.cpp +++ b/sources/editor/graphicspart/parttext.cpp @@ -36,15 +36,25 @@ PartText::PartText(QETElementEditor *editor, QGraphicsItem *parent) : setDefaultTextColor(Qt::black); setFont(QETApp::diagramTextsFont()); real_font_size_ = font().pointSize(); - setFlags(QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemSendsGeometryChanges | QGraphicsItem::ItemIsMovable); + setFlags(QGraphicsItem::ItemIsSelectable + | QGraphicsItem::ItemSendsGeometryChanges + | QGraphicsItem::ItemIsMovable); setAcceptHoverEvents(true); setDefaultTextColor(Qt::black); - setPlainText(QObject::tr("T", "default text when adding a text in the element editor")); + setPlainText(QObject::tr( + "T", + "default text when adding a text in the element editor")); adjustItemPosition(1); // adjust textfield position after line additions/deletions - connect(document(), SIGNAL(blockCountChanged(int)), this, SLOT(adjustItemPosition(int))); - connect(document(), SIGNAL(contentsChanged()), this, SLOT(adjustItemPosition())); + connect(document(), + SIGNAL(blockCountChanged(int)), + this, + SLOT(adjustItemPosition(int))); + connect(document(), + SIGNAL(contentsChanged()), + this, + SLOT(adjustItemPosition())); } /// Destructeur diff --git a/sources/elementprovider.cpp b/sources/elementprovider.cpp index 7928a2b8a..005fc2890 100644 --- a/sources/elementprovider.cpp +++ b/sources/elementprovider.cpp @@ -117,14 +117,19 @@ QList ElementProvider::find(const int filter) const { and not already in all the chain of next/previous table of table (if set) If table and model are nullptr, return every tables */ -QVector ElementProvider::table(QetGraphicsTableItem *table, QAbstractItemModel *model) +QVector ElementProvider::table( + QetGraphicsTableItem *table, + QAbstractItemModel *model) { QVector v_; QVector linked_vector; if (table) { - auto linked_table = table->previousTable() ? table->previousTable() : table->nextTable(); //table can be inside a chain, at the head of a chain or alone + //table can be inside a chain, at the head of a chain or alone + auto linked_table = table->previousTable() + ? table->previousTable() + : table->nextTable(); while (linked_table) { //Go to the first table if (linked_table->previousTable()) linked_table = linked_table->previousTable(); diff --git a/sources/elementscollectioncache.cpp b/sources/elementscollectioncache.cpp index f94686b11..4bc5bfe47 100644 --- a/sources/elementscollectioncache.cpp +++ b/sources/elementscollectioncache.cpp @@ -212,7 +212,10 @@ bool ElementsCollectionCache::fetchData(const ElementsLocation &location) { int state; Element *custom_elmt = ElementFactory::Instance() -> createElement(location, nullptr, &state); if (state) { - qDebug() << "ElementsCollectionCache::fetchData() : Le chargement du composant" << qPrintable(location.toString()) << "a echoue avec le code d'erreur" << state; + qDebug() << "ElementsCollectionCache::fetchData() : Le chargement du composant" + << qPrintable(location.toString()) + << "a echoue avec le code d'erreur" + << state; } else { current_name_ = custom_elmt -> name(); current_pixmap_ = custom_elmt -> pixmap(); @@ -229,7 +232,8 @@ bool ElementsCollectionCache::fetchData(const ElementsLocation &location) { @param uuid : Element uuid @return True if the retrieval succeeded, false otherwise. */ -bool ElementsCollectionCache::fetchNameFromCache(const QString &path, const QUuid &uuid) +bool ElementsCollectionCache::fetchNameFromCache(const QString &path, + const QUuid &uuid) { select_name_ -> bindValue(":path", path); select_name_ -> bindValue(":locale", locale_); @@ -257,7 +261,8 @@ bool ElementsCollectionCache::fetchNameFromCache(const QString &path, const QUui @param uuid : Element uuid @return True if the retrieval succeeded, false otherwise. */ -bool ElementsCollectionCache::fetchPixmapFromCache(const QString &path, const QUuid &uuid) +bool ElementsCollectionCache::fetchPixmapFromCache(const QString &path, + const QUuid &uuid) { select_pixmap_ -> bindValue(":path", path); select_pixmap_ -> bindValue(":uuid", uuid.toString()); @@ -287,7 +292,8 @@ bool ElementsCollectionCache::fetchPixmapFromCache(const QString &path, const QU @return True if the caching succeeded, false otherwise. @see name() */ -bool ElementsCollectionCache::cacheName(const QString &path, const QUuid &uuid) +bool ElementsCollectionCache::cacheName(const QString &path, + const QUuid &uuid) { insert_name_ -> bindValue(":path", path); insert_name_ -> bindValue(":locale", locale_); @@ -309,7 +315,8 @@ bool ElementsCollectionCache::cacheName(const QString &path, const QUuid &uuid) @return True if the caching succeeded, false otherwise. @see pixmap() */ -bool ElementsCollectionCache::cachePixmap(const QString &path, const QUuid &uuid) +bool ElementsCollectionCache::cachePixmap(const QString &path, + const QUuid &uuid) { QByteArray ba; QBuffer buffer(&ba); diff --git a/sources/elementscollectioncache.h b/sources/elementscollectioncache.h index 8bae6059a..3044f3e2e 100644 --- a/sources/elementscollectioncache.h +++ b/sources/elementscollectioncache.h @@ -31,7 +31,8 @@ class ElementsCollectionCache : public QObject { public: // constructor, destructor - ElementsCollectionCache(const QString &database_path, QObject * = nullptr); + ElementsCollectionCache(const QString &database_path, + QObject * = nullptr); ~ElementsCollectionCache() override; // methods @@ -46,8 +47,10 @@ class ElementsCollectionCache : public QObject bool fetchData(const ElementsLocation &); bool fetchNameFromCache(const QString &path, const QUuid &uuid); bool fetchPixmapFromCache(const QString &path, const QUuid &uuid); - bool cacheName(const QString &path, const QUuid &uuid = QUuid::createUuid()); - bool cachePixmap(const QString &path, const QUuid &uuid = QUuid::createUuid()); + bool cacheName(const QString &path, + const QUuid &uuid = QUuid::createUuid()); + bool cachePixmap(const QString &path, + const QUuid &uuid = QUuid::createUuid()); // attributes private: diff --git a/sources/elementspanel.cpp b/sources/elementspanel.cpp index 9256d5f84..b487e504d 100644 --- a/sources/elementspanel.cpp +++ b/sources/elementspanel.cpp @@ -128,7 +128,9 @@ void ElementsPanel::panelContentChange() { @return Le QTreeWidgetItem insere le plus haut */ -QTreeWidgetItem *ElementsPanel::addProject(QETProject *project, QTreeWidgetItem *parent_item, PanelOptions options) +QTreeWidgetItem *ElementsPanel::addProject(QETProject *project, + QTreeWidgetItem *parent_item, + PanelOptions options) { Q_UNUSED(parent_item) Q_UNUSED(options) @@ -155,8 +157,16 @@ QTreeWidgetItem *ElementsPanel::addProject(QETProject *project, QTreeWidgetItem return(qtwi_project); } -QTreeWidgetItem *ElementsPanel::updateTemplatesCollectionItem(QTreeWidgetItem *tbt_collection_qtwi, TitleBlockTemplatesCollection *tbt_collection, PanelOptions options, bool freshly_created) { - QTreeWidgetItem *tbtc_qtwi = GenericPanel::updateTemplatesCollectionItem(tbt_collection_qtwi, tbt_collection, options, freshly_created); +QTreeWidgetItem *ElementsPanel::updateTemplatesCollectionItem( + QTreeWidgetItem *tbt_collection_qtwi, + TitleBlockTemplatesCollection *tbt_collection, + PanelOptions options, + bool freshly_created) { + QTreeWidgetItem *tbtc_qtwi = GenericPanel:: + updateTemplatesCollectionItem(tbt_collection_qtwi, + tbt_collection, + options, + freshly_created); if (tbt_collection && tbt_collection -> parentProject()) { tbtc_qtwi -> setText(0, tr("Cartouches embarqués")); tbtc_qtwi -> setStatusTip(0, tr("Double-cliquez pour réduire ou développer cette collection de cartouches embarquée", "Status tip")); @@ -164,13 +174,20 @@ QTreeWidgetItem *ElementsPanel::updateTemplatesCollectionItem(QTreeWidgetItem *t return(tbtc_qtwi); } -QTreeWidgetItem *ElementsPanel::updateTemplateItem(QTreeWidgetItem *tb_template_qtwi, const TitleBlockTemplateLocation &tb_template, PanelOptions options, bool freshly_created) { - QTreeWidgetItem *item = GenericPanel::updateTemplateItem(tb_template_qtwi, tb_template, options, freshly_created); +QTreeWidgetItem *ElementsPanel::updateTemplateItem( + QTreeWidgetItem *tb_template_qtwi, + const TitleBlockTemplateLocation &tb_template, + PanelOptions options, + bool freshly_created) { + QTreeWidgetItem *item = GenericPanel::updateTemplateItem( + tb_template_qtwi, + tb_template, + options, + freshly_created); item -> setStatusTip( 0, - tr( - "Glissez-déposez ce modèle de cartouche sur un folio pour l'y appliquer.", - "Status tip displayed when selecting a title block template" + tr("Glissez-déposez ce modèle de cartouche sur un folio pour l'y appliquer.", + "Status tip displayed when selecting a title block template" ) ); return(item); @@ -179,13 +196,15 @@ QTreeWidgetItem *ElementsPanel::updateTemplateItem(QTreeWidgetItem *tb_template_ /** @return true if \a item matches the filter, false otherwise */ -bool ElementsPanel::matchesFilter(const QTreeWidgetItem *item, const QString& filter) const { +bool ElementsPanel::matchesFilter(const QTreeWidgetItem *item, + const QString& filter) const { if (!item) return(false); // no filter => we consider the item matches if (filter.isEmpty()) return(true); - bool item_matches = item -> text(0).contains(filter, Qt::CaseInsensitive); + bool item_matches = item -> text(0).contains(filter, + Qt::CaseInsensitive); return(item_matches); } diff --git a/sources/elementtextpattern.cpp b/sources/elementtextpattern.cpp index 02330ce14..6e35ce502 100644 --- a/sources/elementtextpattern.cpp +++ b/sources/elementtextpattern.cpp @@ -140,9 +140,10 @@ ImportElementTextPattern::ImportElementTextPattern(Element *elmt): if(!exist) { - QMessageBox::information(parentWidget(), - QObject::tr("Configuration de textes"), - QObject::tr("Aucune configuration de textes existante.")); + QMessageBox::information( + parentWidget(), + QObject::tr("Configuration de textes"), + QObject::tr("Aucune configuration de textes existante.")); return; } @@ -166,14 +167,17 @@ ImportElementTextPattern::ImportElementTextPattern(Element *elmt): @param erase @return */ -QString ImportElementTextPattern::getName(const QStringList& list, bool *ok, bool *erase) const +QString ImportElementTextPattern::getName(const QStringList& list, + bool *ok, + bool *erase) const { - return ImportElementTextPatternDialog::getItem(parentWidget(), - QObject::tr("Sélectionner une configuration de textes"), - QObject::tr("Sélectionner la configuration de textes à ajouter à l'élément"), - list, - ok, - erase); + return ImportElementTextPatternDialog::getItem( + parentWidget(), + QObject::tr("Sélectionner une configuration de textes"), + QObject::tr("Sélectionner la configuration de textes à ajouter à l'élément"), + list, + ok, + erase); } QWidget *ImportElementTextPattern::parentWidget() const diff --git a/sources/elementtextpattern.h b/sources/elementtextpattern.h index cf2f79048..34a67616a 100644 --- a/sources/elementtextpattern.h +++ b/sources/elementtextpattern.h @@ -45,7 +45,9 @@ class ImportElementTextPattern ImportElementTextPattern(Element *elmt); private: - QString getName(const QStringList& list, bool *ok, bool *erase) const; + QString getName(const QStringList& list, + bool *ok, + bool *erase) const; QWidget *parentWidget() const; void apply(QString name, bool erase = false) const; diff --git a/sources/exportdialog.cpp b/sources/exportdialog.cpp index 9939cd543..d38a5ddbd 100644 --- a/sources/exportdialog.cpp +++ b/sources/exportdialog.cpp @@ -404,7 +404,7 @@ void ExportDialog::generateDxf(Diagram *diagram, int height, bool keep_aspect_ratio, QString &file_path) { - saveReloadDiagramParameters(diagram, true); + saveReloadDiagramParameters(diagram, true); width -= 2*Diagram::margin; height -= 2*Diagram::margin; @@ -415,12 +415,22 @@ void ExportDialog::generateDxf(Diagram *diagram, Createdxf::dxfBegin(file_path); //Add project elements (lines, rectangles, circles, texts) to dxf file - if (epw -> exportProperties().draw_border) { - double bx0 = Diagram::margin * Createdxf::xScale; - double by0 = Diagram::margin * Createdxf::yScale; - Createdxf::drawRectangle(file_path, bx0, -by0, double(width)*Createdxf::xScale, double(height)*Createdxf::yScale, 0); - } - diagram -> border_and_titleblock.drawDxf(width, height, keep_aspect_ratio, file_path, 0); + if (epw -> exportProperties().draw_border) { + double bx0 = Diagram::margin * Createdxf::xScale; + double by0 = Diagram::margin * Createdxf::yScale; + Createdxf::drawRectangle( + file_path, + bx0, + -by0, + double(width)*Createdxf::xScale, + double(height)*Createdxf::yScale, + 0); + } + diagram -> border_and_titleblock.drawDxf(width, + height, + keep_aspect_ratio, + file_path, + 0); // Build the lists of elements. QList list_elements; diff --git a/sources/factory/elementpicturefactory.cpp b/sources/factory/elementpicturefactory.cpp index b63774d90..34021c030 100644 --- a/sources/factory/elementpicturefactory.cpp +++ b/sources/factory/elementpicturefactory.cpp @@ -117,7 +117,8 @@ QPixmap ElementPictureFactory::pixmap(const ElementsLocation &location) @param location @return The primtive used to draw the element at location */ -ElementPictureFactory::primitives ElementPictureFactory::getPrimitives(const ElementsLocation &location) +ElementPictureFactory::primitives ElementPictureFactory::getPrimitives( + const ElementsLocation &location) { if(!m_primitives_H.contains(location.uuid())) build(location); @@ -143,7 +144,9 @@ ElementPictureFactory::~ElementPictureFactory() { draw on it and store it in m_pictures_H and m_low_pictures_H @return */ -bool ElementPictureFactory::build(const ElementsLocation &location, QPicture *picture, QPicture *low_picture) +bool ElementPictureFactory::build(const ElementsLocation &location, + QPicture *picture, + QPicture *low_picture) { QDomElement dom = location.xml(); diff --git a/sources/projectconfigpages.cpp b/sources/projectconfigpages.cpp index 7b7bcbb3a..92505d649 100644 --- a/sources/projectconfigpages.cpp +++ b/sources/projectconfigpages.cpp @@ -65,7 +65,8 @@ QETProject *ProjectConfigPage::project() const { @param read_values @return the former project */ -QETProject *ProjectConfigPage::setProject(QETProject *new_project, bool read_values) { +QETProject *ProjectConfigPage::setProject(QETProject *new_project, + bool read_values) { if (new_project == m_project) return(m_project); QETProject *former_project = m_project; @@ -222,7 +223,8 @@ void ProjectMainConfigPage::adjustReadOnly() { @param project : project to edit @param parent : parent widget */ -ProjectAutoNumConfigPage::ProjectAutoNumConfigPage (QETProject *project, QWidget *parent) : +ProjectAutoNumConfigPage::ProjectAutoNumConfigPage (QETProject *project, + QWidget *parent) : ProjectConfigPage(project, parent) { initWidgets(); @@ -626,5 +628,5 @@ void ProjectAutoNumConfigPage::removeContextFolio() { */ void ProjectAutoNumConfigPage::changeToTab(int i) { - Q_UNUSED(i); + qDebug()<<"Q_UNUSED"<border_and_titleblock.folio(); autonum::sequentialNumbers seq; - title = autonum::AssignVariables::formulaToLabel(formula, seq, diagram); + title = autonum::AssignVariables::formulaToLabel( + formula, + seq, + diagram); } else title = QString::number(diagram->folioIndex() + 1); diff --git a/sources/qetgraphicsitem/ViewItem/projectdbmodel.cpp b/sources/qetgraphicsitem/ViewItem/projectdbmodel.cpp index 64505a623..620006624 100644 --- a/sources/qetgraphicsitem/ViewItem/projectdbmodel.cpp +++ b/sources/qetgraphicsitem/ViewItem/projectdbmodel.cpp @@ -190,13 +190,19 @@ void ProjectDBModel::setQuery(const QString &query) if (m_project) { if (rm_) { - disconnect(m_project->dataBase(), &projectDataBase::dataBaseUpdated, this, &ProjectDBModel::dataBaseUpdated); + disconnect(m_project->dataBase(), + &projectDataBase::dataBaseUpdated, + this, + &ProjectDBModel::dataBaseUpdated); } m_project->dataBase()->updateDB(); if (rm_) { setHeaderString(); fillValue(); - connect(m_project->dataBase(), &projectDataBase::dataBaseUpdated, this, &ProjectDBModel::dataBaseUpdated); + connect(m_project->dataBase(), + &projectDataBase::dataBaseUpdated, + this, + &ProjectDBModel::dataBaseUpdated); } } diff --git a/sources/qetgraphicsitem/conductor.cpp b/sources/qetgraphicsitem/conductor.cpp index 5cbe69267..804b6e651 100644 --- a/sources/qetgraphicsitem/conductor.cpp +++ b/sources/qetgraphicsitem/conductor.cpp @@ -1504,7 +1504,8 @@ QPainterPath Conductor::path() const to other conductor in the same potential, the other values of property stay unmodified */ -void Conductor::setPropertyToPotential(const ConductorProperties &property, bool only_text) +void Conductor::setPropertyToPotential(const ConductorProperties &property, + bool only_text) { setProperties(property); QSet potential_list = relatedPotentialConductors(); diff --git a/sources/qetgraphicsitem/elementtextitemgroup.cpp b/sources/qetgraphicsitem/elementtextitemgroup.cpp index dbd59c9e9..0fe1dee87 100644 --- a/sources/qetgraphicsitem/elementtextitemgroup.cpp +++ b/sources/qetgraphicsitem/elementtextitemgroup.cpp @@ -46,13 +46,18 @@ bool sorting(QGraphicsItem *qgia, QGraphicsItem *qgib) @param name : @param parent : */ -ElementTextItemGroup::ElementTextItemGroup(const QString &name, Element *parent) : +ElementTextItemGroup::ElementTextItemGroup(const QString &name, + Element *parent) : QGraphicsItemGroup(parent), m_name(name), m_parent_element(parent) { - setFlags(QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsMovable); - connect(parent, &Element::linkedElementChanged, this, &ElementTextItemGroup::updateXref); + setFlags(QGraphicsItem::ItemIsSelectable + | QGraphicsItem::ItemIsMovable); + connect(parent, + &Element::linkedElementChanged, + this, + &ElementTextItemGroup::updateXref); } ElementTextItemGroup::~ElementTextItemGroup() diff --git a/sources/qetgraphicsitem/elementtextitemgroup.h b/sources/qetgraphicsitem/elementtextitemgroup.h index 09dbc9d73..373ab7161 100644 --- a/sources/qetgraphicsitem/elementtextitemgroup.h +++ b/sources/qetgraphicsitem/elementtextitemgroup.h @@ -81,7 +81,9 @@ class ElementTextItemGroup : public QObject, public QGraphicsItemGroup void fromXml(QDomElement &dom_element); static QString xmlTaggName() {return QString("texts_group");} - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; + void paint(QPainter *painter, + const QStyleOptionGraphicsItem *option, + QWidget *widget) override; QRectF boundingRect() const override; void setRotation(qreal angle); void setPos(const QPointF &pos); @@ -90,8 +92,10 @@ class ElementTextItemGroup : public QObject, public QGraphicsItemGroup protected: void mousePressEvent(QGraphicsSceneMouseEvent *event) override; void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override; - void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override; - void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override; + void mouseReleaseEvent( + QGraphicsSceneMouseEvent *event) override; + void mouseDoubleClickEvent( + QGraphicsSceneMouseEvent *event) override; void keyPressEvent(QKeyEvent *event) override; void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override; void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override; @@ -105,9 +109,9 @@ class ElementTextItemGroup : public QObject, public QGraphicsItemGroup Qt::Alignment m_alignment = Qt::AlignJustify; QString m_name; bool m_first_move = true, - m_hold_to_bottom_of_page = false, - m_block_alignment_update = false, - m_frame = false; + m_hold_to_bottom_of_page = false, + m_block_alignment_update = false, + m_frame = false; QPointF m_initial_position; int m_vertical_adjustment = 0; CrossRefItem *m_Xref_item = nullptr; @@ -115,7 +119,7 @@ class ElementTextItemGroup : public QObject, public QGraphicsItemGroup QList m_update_slave_Xref_connection; QGraphicsTextItem *m_slave_Xref_item = nullptr; QMetaObject::Connection m_XrefChanged_timer, - m_linked_changed_timer; + m_linked_changed_timer; }; #endif // ELEMENTTEXTITEMGROUP_H diff --git a/sources/qetgraphicsitem/masterelement.cpp b/sources/qetgraphicsitem/masterelement.cpp index 76285c44f..edb0b3872 100644 --- a/sources/qetgraphicsitem/masterelement.cpp +++ b/sources/qetgraphicsitem/masterelement.cpp @@ -28,7 +28,9 @@ @param qgi : parent QGraphicItem @param state : int used to know if the creation of element have error */ -MasterElement::MasterElement(const ElementsLocation &location, QGraphicsItem *qgi, int *state) : +MasterElement::MasterElement(const ElementsLocation &location, + QGraphicsItem *qgi, + int *state) : Element(location, qgi, state, Element::Master) {} diff --git a/sources/ui/conductorpropertiesdialog.cpp b/sources/ui/conductorpropertiesdialog.cpp index fadc57d95..cbc7e0ac2 100644 --- a/sources/ui/conductorpropertiesdialog.cpp +++ b/sources/ui/conductorpropertiesdialog.cpp @@ -29,7 +29,8 @@ @param conductor : conductor to edit propertie @param parent : parent widget */ -ConductorPropertiesDialog::ConductorPropertiesDialog(Conductor *conductor, QWidget *parent) : +ConductorPropertiesDialog::ConductorPropertiesDialog(Conductor *conductor, + QWidget *parent) : QDialog(parent), ui(new Ui::ConductorPropertiesDialog) { @@ -58,11 +59,13 @@ ConductorPropertiesDialog::~ConductorPropertiesDialog() @param conductor : conductor to edit propertie @param parent : parent widget */ -void ConductorPropertiesDialog::PropertiesDialog(Conductor *conductor, QWidget *parent) +void ConductorPropertiesDialog::PropertiesDialog(Conductor *conductor, + QWidget *parent) { ConductorPropertiesDialog cpd (conductor, parent); - if (cpd.exec() == QDialog::Rejected || cpd.properties() == conductor->properties()) return; + if (cpd.exec() == QDialog::Rejected + || cpd.properties() == conductor->properties()) return; QVariant old_value, new_value; old_value.setValue(conductor->properties()); diff --git a/sources/ui/conductorpropertiesdialog.h b/sources/ui/conductorpropertiesdialog.h index 8dd5e95e5..c046e37a7 100644 --- a/sources/ui/conductorpropertiesdialog.h +++ b/sources/ui/conductorpropertiesdialog.h @@ -34,8 +34,10 @@ class ConductorPropertiesDialog : public QDialog Q_OBJECT public: - explicit ConductorPropertiesDialog (Conductor *conductor, QWidget *parent = nullptr); - static void PropertiesDialog (Conductor *conductor, QWidget *parent = nullptr); + explicit ConductorPropertiesDialog (Conductor *conductor, + QWidget *parent = nullptr); + static void PropertiesDialog (Conductor *conductor, + QWidget *parent = nullptr); ~ConductorPropertiesDialog() override; ConductorProperties properties() const; diff --git a/sources/ui/conductorpropertieswidget.cpp b/sources/ui/conductorpropertieswidget.cpp index dcaf212e3..1851ec632 100644 --- a/sources/ui/conductorpropertieswidget.cpp +++ b/sources/ui/conductorpropertieswidget.cpp @@ -43,7 +43,9 @@ ConductorPropertiesWidget::ConductorPropertiesWidget(QWidget *parent) : @param properties : properties to edit @param parent : parent widget */ -ConductorPropertiesWidget::ConductorPropertiesWidget(const ConductorProperties &properties, QWidget *parent) : +ConductorPropertiesWidget::ConductorPropertiesWidget( + const ConductorProperties &properties, + QWidget *parent) : QWidget(parent), ui(new Ui::ConductorPropertiesWidget) { @@ -66,7 +68,8 @@ ConductorPropertiesWidget::~ConductorPropertiesWidget() Set the properties @param properties */ -void ConductorPropertiesWidget::setProperties(const ConductorProperties &properties) +void ConductorPropertiesWidget::setProperties( + const ConductorProperties &properties) { if (m_properties == properties) return; diff --git a/sources/ui/conductorpropertieswidget.h b/sources/ui/conductorpropertieswidget.h index ab30a012d..37cc9d68b 100644 --- a/sources/ui/conductorpropertieswidget.h +++ b/sources/ui/conductorpropertieswidget.h @@ -34,7 +34,9 @@ class ConductorPropertiesWidget : public QWidget public: explicit ConductorPropertiesWidget(QWidget *parent = nullptr); - explicit ConductorPropertiesWidget(const ConductorProperties &properties, QWidget *parent = nullptr); + explicit ConductorPropertiesWidget( + const ConductorProperties &properties, + QWidget *parent = nullptr); ~ConductorPropertiesWidget() override; //METHODS diff --git a/sources/ui/diagrampropertieseditordockwidget.h b/sources/ui/diagrampropertieseditordockwidget.h index 2bf2f53f8..fc30148fd 100644 --- a/sources/ui/diagrampropertieseditordockwidget.h +++ b/sources/ui/diagrampropertieseditordockwidget.h @@ -32,8 +32,10 @@ class DiagramPropertiesEditorDockWidget : public PropertiesEditorDockWidget void setDiagram(Diagram *diagram); private: //Make this method private because only this class manage the editor widget. - bool addEditor(PropertiesEditorWidget *editor, int index = 0) { return PropertiesEditorDockWidget::addEditor(editor, index); } - bool removeEditor(PropertiesEditorWidget *editor) { return PropertiesEditorDockWidget::removeEditor(editor); } + bool addEditor(PropertiesEditorWidget *editor,int index = 0) + {return PropertiesEditorDockWidget::addEditor(editor,index); } + bool removeEditor(PropertiesEditorWidget *editor) + { return PropertiesEditorDockWidget::removeEditor(editor); } private slots: void selectionChanged(); diff --git a/sources/ui/dynamicelementtextmodel.h b/sources/ui/dynamicelementtextmodel.h index 82836db37..4bccc5723 100644 --- a/sources/ui/dynamicelementtextmodel.h +++ b/sources/ui/dynamicelementtextmodel.h @@ -66,8 +66,12 @@ class DynamicElementTextModel : public QStandardItemModel DynamicElementTextItem *textFromIndex(const QModelIndex &index) const; DynamicElementTextItem *textFromItem(QStandardItem *item) const; QModelIndex indexFromText(DynamicElementTextItem *text) const; - QUndoCommand *undoForEditedText(DynamicElementTextItem *deti, QUndoCommand *parent_undo = nullptr) const; - QUndoCommand *undoForEditedGroup(ElementTextItemGroup *group, QUndoCommand *parent_undo = nullptr) const; + QUndoCommand *undoForEditedText( + DynamicElementTextItem *deti, + QUndoCommand *parent_undo = nullptr) const; + QUndoCommand *undoForEditedGroup( + ElementTextItemGroup *group, + QUndoCommand *parent_undo = nullptr) const; ElementTextItemGroup *groupFromIndex(const QModelIndex &index) const; ElementTextItemGroup *groupFromItem(QStandardItem *item) const; @@ -75,8 +79,16 @@ class DynamicElementTextModel : public QStandardItemModel bool indexIsText(const QModelIndex &index) const; bool indexIsGroup(const QModelIndex &index) const; - bool canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const override; - bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override; + bool canDropMimeData(const QMimeData *data, + Qt::DropAction action, + int row, + int column, + const QModelIndex &parent) const override; + bool dropMimeData(const QMimeData *data, + Qt::DropAction action, + int row, + int column, + const QModelIndex &parent) override; QMimeData *mimeData(const QModelIndexList &indexes) const override; QStringList mimeTypes() const override; @@ -89,22 +101,29 @@ class DynamicElementTextModel : public QStandardItemModel void removeText(DynamicElementTextItem *deti); void addGroup(ElementTextItemGroup *group); void removeGroup(ElementTextItemGroup *group); - void addTextToGroup(DynamicElementTextItem *deti, ElementTextItemGroup *group); - void removeTextFromGroup(DynamicElementTextItem *deti, ElementTextItemGroup *group); - void enableSourceText(DynamicElementTextItem *deti, DynamicElementTextItem::TextFrom tf ); + void addTextToGroup(DynamicElementTextItem *deti, + ElementTextItemGroup *group); + void removeTextFromGroup(DynamicElementTextItem *deti, + ElementTextItemGroup *group); + void enableSourceText(DynamicElementTextItem *deti, + DynamicElementTextItem::TextFrom tf ); void enableGroupRotationAndPos(ElementTextItemGroup *group); void itemDataChanged(QStandardItem *qsi); void setConnection(DynamicElementTextItem *deti, bool set); void setConnection(ElementTextItemGroup *group, bool set); - void updateDataFromText(DynamicElementTextItem *deti, DynamicElementTextModel::ValueType type); - void updateDataFromGroup(ElementTextItemGroup *group, DynamicElementTextModel::ValueType type); + void updateDataFromText(DynamicElementTextItem *deti, + DynamicElementTextModel::ValueType type); + void updateDataFromGroup(ElementTextItemGroup *group, + DynamicElementTextModel::ValueType type); private: QPointer m_element; QHash m_texts_list; QHash m_groups_list; - QHash > m_hash_text_connect; - QHash > m_hash_group_connect; + QHash > m_hash_text_connect; + QHash > m_hash_group_connect; bool m_block_dataChanged = false; }; @@ -115,8 +134,12 @@ class DynamicTextItemDelegate : public QStyledItemDelegate public: DynamicTextItemDelegate(QObject *parent = Q_NULLPTR); - QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override; - void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override; + QWidget *createEditor(QWidget *parent, + const QStyleOptionViewItem &option, + const QModelIndex &index) const override; + void setModelData(QWidget *editor, + QAbstractItemModel *model, + const QModelIndex &index) const override; protected: bool eventFilter(QObject *object, QEvent *event) override; diff --git a/sources/ui/potentialselectordialog.cpp b/sources/ui/potentialselectordialog.cpp index 4ee05a4fa..daa49b227 100644 --- a/sources/ui/potentialselectordialog.cpp +++ b/sources/ui/potentialselectordialog.cpp @@ -41,15 +41,25 @@ class NewConductorPotentialSelector : public AbstractPotentialSelector { Terminal *terminal_1 = conductor->terminal1; Terminal *terminal_2 = conductor->terminal2; - //We temporarily remove the conductor of his two terminals, to get the two existing potential + //We temporarily remove the conductor of his two terminals, + //to get the two existing potential terminal_1->removeConductor(conductor); terminal_2->removeConductor(conductor); - getPotential(terminal_1, m_seq_num_1, m_conductor_number_1, m_properties_list_1, m_conductors_list_1); - getPotential(terminal_2, m_seq_num_2, m_conductor_number_2, m_properties_list_2, m_conductors_list_2); + getPotential(terminal_1, + m_seq_num_1, + m_conductor_number_1, + m_properties_list_1, + m_conductors_list_1); + getPotential(terminal_2, + m_seq_num_2, + m_conductor_number_2, + m_properties_list_2, + m_conductors_list_2); //There isn't a potential at terminal 1 or 2. - if (m_conductor_number_1 == 0 && m_conductor_number_2 == 0) return; + if (m_conductor_number_1 == 0 + && m_conductor_number_2 == 0) return; //Re-add conductor to his terminals. terminal_1->addConductor(conductor); @@ -69,7 +79,11 @@ class NewConductorPotentialSelector : public AbstractPotentialSelector @param properties_list @param c_list */ - void getPotential(Terminal *terminal, autonum::sequentialNumbers &seq_num , int &number, QList &properties_list, QList &c_list) + void getPotential( + Terminal *terminal, + autonum::sequentialNumbers &seq_num , + int &number, QList &properties_list, + QList &c_list) { Conductor *conductor_in_potential = nullptr; @@ -105,7 +119,8 @@ class NewConductorPotentialSelector : public AbstractPotentialSelector if (!conductor_in_potential) return; seq_num = conductor_in_potential->sequenceNum(); - number = conductor_in_potential->relatedPotentialConductors().size()+1; //We add +1 because conductor_in_potential isn't count by relatedPotentialConductors + //We add +1 because conductor_in_potential isn't count by relatedPotentialConductors + number = conductor_in_potential->relatedPotentialConductors().size()+1; c_list = conductor_in_potential->relatedPotentialConductors().values(); c_list.append(conductor_in_potential); @@ -131,7 +146,7 @@ class LinkReportPotentialSelector : public AbstractPotentialSelector { if ((report->linkType() & Element::AllReport) && !report->isFree()) { - //We temporarily unlink report to get the two existing potential + //We temporarily unlink report to get the two existing potential Element *other_report = report->linkedElements().first(); report->unlinkAllElements();