TEST a Merge branch 'XMLProperties'

it gets built let's test it for bugs

 Conflicts:
	sources/ElementsCollection/fileelementcollectionitem.cpp
	sources/QetGraphicsItemModeler/qetgraphicshandleritem.h
	sources/borderproperties.cpp
	sources/conductorproperties.cpp
	sources/conductorproperties.h
	sources/diagram.cpp
	sources/diagram.h
	sources/diagramprintdialog.cpp
	sources/diagramprintdialog.h
	sources/editor/graphicspart/customelementgraphicpart.cpp
	sources/editor/graphicspart/partarc.cpp
	sources/editor/graphicspart/partdynamictextfield.cpp
	sources/editor/graphicspart/partdynamictextfield.h
	sources/editor/graphicspart/partellipse.cpp
	sources/editor/graphicspart/partline.cpp
	sources/editor/graphicspart/partpolygon.cpp
	sources/editor/graphicspart/partrectangle.cpp
	sources/editor/graphicspart/partterminal.cpp
	sources/editor/graphicspart/partterminal.h
	sources/editor/graphicspart/parttext.cpp
	sources/properties/propertiesinterface.cpp
	sources/properties/propertiesinterface.h
	sources/properties/terminaldata.cpp
	sources/properties/terminaldata.h
	sources/properties/xrefproperties.cpp
	sources/properties/xrefproperties.h
	sources/qetgraphicsitem/conductor.cpp
	sources/qetgraphicsitem/conductor.h
	sources/qetgraphicsitem/conductortextitem.h
	sources/qetgraphicsitem/dynamicelementtextitem.h
	sources/qetgraphicsitem/element.cpp
	sources/qetgraphicsitem/element.h
	sources/qetgraphicsitem/elementtextitemgroup.h
	sources/qetgraphicsitem/slaveelement.cpp
	sources/qetgraphicsitem/slaveelement.h
	sources/qetgraphicsitem/terminal.cpp
	sources/qetgraphicsitem/terminal.h
	sources/qetproject.cpp
	sources/titleblockproperties.cpp
This commit is contained in:
Simon De Backer
2020-10-13 21:51:34 +02:00
67 changed files with 2095 additions and 1486 deletions

View File

@@ -1,17 +1,17 @@
/*
Copyright 2006-2020 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -19,6 +19,7 @@
#define CONDUCTOR_H
#include "conductorproperties.h"
#include "propertiesinterface.h"
#include <QGraphicsPathItem>
#include "assignvariables.h"
@@ -39,7 +40,7 @@ typedef QHash<Qt::Corner, ConductorProfile> ConductorProfilesGroup;
This class represents a conductor, i.e. a wire between two element
terminals.
*/
class Conductor : public QGraphicsObject
class Conductor : public QGraphicsObject, public PropertiesInterface
{
Q_OBJECT
@@ -50,13 +51,13 @@ class Conductor : public QGraphicsObject
signals:
void propertiesChange();
public:
Conductor(Terminal *, Terminal *);
~Conductor() override;
bool isValid() const;
private:
Conductor(const Conductor &);
@@ -66,7 +67,7 @@ class Conductor : public QGraphicsObject
Terminal *terminal1;
Terminal *terminal2;
public:
/**
@brief type
@@ -100,11 +101,9 @@ class Conductor : public QGraphicsObject
public:
static bool valideXml (QDomElement &);
bool fromXml (QDomElement &);
QDomElement toXml (
QDomDocument &,
QHash<Terminal *,
int> &) const;
bool fromXml (const QDomElement &) override;
//QDomElement toXml (QDomDocument &, QHash<Terminal *, int> &) const;
QDomElement toXml (QDomDocument &doc) const override;
private:
bool pathFromXml(const QDomElement &);
@@ -137,7 +136,7 @@ class Conductor : public QGraphicsObject
{return m_autoNum_seq;}
void setSequenceNum(const autonum::sequentialNumbers& sn);
QList<QPointF> junctions() const;
QList<QPointF> junctions() const;
private:
void setUpConnectionForFormula(
@@ -146,10 +145,10 @@ class Conductor : public QGraphicsObject
public:
void setFreezeLabel(bool freeze);
public slots:
void displayedTextChanged();
protected:
void mouseDoubleClickEvent(
QGraphicsSceneMouseEvent *event) override;
@@ -165,7 +164,7 @@ class Conductor : public QGraphicsObject
private:
void adjusteHandlerPos();
void handlerMousePressEvent(
QetGraphicsHandlerItem *qghi,
QGraphicsSceneMouseEvent *event);
@@ -177,32 +176,32 @@ class Conductor : public QGraphicsObject
QGraphicsSceneMouseEvent *event);
void addHandler();
void removeHandler();
QVector<QetGraphicsHandlerItem *> m_handler_vector;
int m_vector_index = -1;
bool m_mouse_over;
bool m_mouse_over{false};
/// Functional properties
ConductorProperties m_properties;
/// Text input for non simple, non-singleline conductors
ConductorTextItem *m_text_item;
ConductorTextItem *m_text_item{nullptr};
/// Segments composing the conductor
ConductorSegment *segments;
ConductorSegment *segments{nullptr};
/// Attributs related to mouse interaction
bool m_moving_segment;
bool m_moving_segment{false};
int moved_point;
qreal m_previous_z_value;
ConductorSegment *m_moved_segment;
QPointF before_mov_text_pos_;
/// Whether the conductor was manually modified by users
bool modified_path;
bool modified_path{false};
/// Whether the current profile should be saved as soon as possible
bool has_to_save_profile;
bool has_to_save_profile{false};
/// conductor profile: "photography" of what the conductor is supposed to look
/// like - there is one profile per kind of traject
ConductorProfilesGroup conductor_profiles;
/// Define whether and how the conductor should be highlighted
Highlight must_highlight_;
Highlight must_highlight_{Conductor::None};
bool m_valid;
bool m_freeze_label = false;
@@ -211,7 +210,7 @@ class Conductor : public QGraphicsObject
static QBrush conductor_brush;
static bool pen_and_brush_initialized;
QPainterPath m_path;
private:
void segmentsToPath();
void saveProfile(bool = true);