mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 05:00:33 +01:00
Improve code style, Wrap code for better readability
This commit is contained in:
@@ -169,7 +169,10 @@ void FolioAutonumberingW::on_buttonBox_clicked(QAbstractButton *button) {
|
|||||||
switch (answer) {
|
switch (answer) {
|
||||||
//help dialog - not implemented yet -
|
//help dialog - not implemented yet -
|
||||||
case QDialogButtonBox::HelpRole:
|
case QDialogButtonBox::HelpRole:
|
||||||
QMessageBox::information (this, tr("Folio Autonumbering", "title window"),
|
QMessageBox::information (
|
||||||
|
this,
|
||||||
|
tr("Folio Autonumbering",
|
||||||
|
"title window"),
|
||||||
tr("C'est ici que vous pouvez définir la manière dont seront numérotés les nouveaux folios.\n"
|
tr("C'est ici que vous pouvez définir la manière dont seront numérotés les nouveaux folios.\n"
|
||||||
"-Une numérotation est composée d'une variable minimum.\n"
|
"-Une numérotation est composée d'une variable minimum.\n"
|
||||||
"-Vous pouvez ajouter ou supprimer une variable de numérotation par le biais des boutons - et +.\n"
|
"-Vous pouvez ajouter ou supprimer une variable de numérotation par le biais des boutons - et +.\n"
|
||||||
|
|||||||
@@ -1007,7 +1007,9 @@ bool Conductor::fromXml(QDomElement &dom_element)
|
|||||||
bornes dans le document XML et leur adresse en memoire
|
bornes dans le document XML et leur adresse en memoire
|
||||||
@return Un element XML representant le conducteur
|
@return Un element XML representant le conducteur
|
||||||
*/
|
*/
|
||||||
QDomElement Conductor::toXml(QDomDocument &dom_document, QHash<Terminal *, int> &table_adr_id) const
|
QDomElement Conductor::toXml(QDomDocument &dom_document,
|
||||||
|
QHash<Terminal *,
|
||||||
|
int> &table_adr_id) const
|
||||||
{
|
{
|
||||||
QDomElement dom_element = dom_document.createElement("conductor");
|
QDomElement dom_element = dom_document.createElement("conductor");
|
||||||
|
|
||||||
|
|||||||
@@ -84,7 +84,9 @@ class Conductor : public QGraphicsObject
|
|||||||
void updatePathAnimate(const int = 1) {updatePath();}
|
void updatePathAnimate(const int = 1) {updatePath();}
|
||||||
int fakePath() {return 1;}
|
int fakePath() {return 1;}
|
||||||
|
|
||||||
void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) override;
|
void paint(QPainter *,
|
||||||
|
const QStyleOptionGraphicsItem *,
|
||||||
|
QWidget *) override;
|
||||||
QRectF boundingRect() const override;
|
QRectF boundingRect() const override;
|
||||||
QPainterPath shape() const override;
|
QPainterPath shape() const override;
|
||||||
virtual QPainterPath nearShape() const;
|
virtual QPainterPath nearShape() const;
|
||||||
@@ -98,7 +100,9 @@ class Conductor : public QGraphicsObject
|
|||||||
public:
|
public:
|
||||||
static bool valideXml (QDomElement &);
|
static bool valideXml (QDomElement &);
|
||||||
bool fromXml (QDomElement &);
|
bool fromXml (QDomElement &);
|
||||||
QDomElement toXml (QDomDocument &, QHash<Terminal *, int> &) const;
|
QDomElement toXml (QDomDocument &,
|
||||||
|
QHash<Terminal *,
|
||||||
|
int> &) const;
|
||||||
private:
|
private:
|
||||||
bool pathFromXml(const QDomElement &);
|
bool pathFromXml(const QDomElement &);
|
||||||
|
|
||||||
@@ -106,7 +110,8 @@ class Conductor : public QGraphicsObject
|
|||||||
QVector <QPointF> handlerPoints() const;
|
QVector <QPointF> handlerPoints() const;
|
||||||
const QList<ConductorSegment *> segmentsList() const;
|
const QList<ConductorSegment *> segmentsList() const;
|
||||||
|
|
||||||
void setPropertyToPotential(const ConductorProperties &property, bool only_text = false);
|
void setPropertyToPotential(const ConductorProperties &property,
|
||||||
|
bool only_text = false);
|
||||||
void setProperties(const ConductorProperties &property);
|
void setProperties(const ConductorProperties &property);
|
||||||
ConductorProperties properties() const;
|
ConductorProperties properties() const;
|
||||||
|
|
||||||
@@ -117,7 +122,9 @@ class Conductor : public QGraphicsObject
|
|||||||
void calculateTextItemPosition();
|
void calculateTextItemPosition();
|
||||||
virtual Highlight highlight() const;
|
virtual Highlight highlight() const;
|
||||||
virtual void setHighlighted(Highlight);
|
virtual void setHighlighted(Highlight);
|
||||||
QSet<Conductor *> relatedPotentialConductors(const bool all_diagram = true, QList <Terminal *> *t_list=nullptr);
|
QSet<Conductor *> relatedPotentialConductors(
|
||||||
|
const bool all_diagram = true,
|
||||||
|
QList <Terminal *> *t_list=nullptr);
|
||||||
QETDiagramEditor* diagramEditor() const;
|
QETDiagramEditor* diagramEditor() const;
|
||||||
void editProperty ();
|
void editProperty ();
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,9 @@ const qreal Terminal::Z = 1000;
|
|||||||
@param name of terminal
|
@param name of terminal
|
||||||
@param hiddenName
|
@param hiddenName
|
||||||
*/
|
*/
|
||||||
void Terminal::init(QString number, QString name, bool hiddenName) {
|
void Terminal::init(QString number,
|
||||||
|
QString name,
|
||||||
|
bool hiddenName) {
|
||||||
|
|
||||||
hovered_color_ = Terminal::neutralColor;
|
hovered_color_ = Terminal::neutralColor;
|
||||||
|
|
||||||
@@ -129,9 +131,13 @@ Terminal::Terminal(qreal pf_x, qreal pf_y, Qet::Orientation o, Element *e) :
|
|||||||
@param name of terminal
|
@param name of terminal
|
||||||
@param hiddenName hide or show the name
|
@param hiddenName hide or show the name
|
||||||
@param e Element auquel cette borne appartient
|
@param e Element auquel cette borne appartient
|
||||||
@param s Scene sur laquelle figure cette borne
|
|
||||||
*/
|
*/
|
||||||
Terminal::Terminal(QPointF pf, Qet::Orientation o, QString num, QString name, bool hiddenName, Element *e) :
|
Terminal::Terminal(QPointF pf,
|
||||||
|
Qet::Orientation o,
|
||||||
|
QString num,
|
||||||
|
QString name,
|
||||||
|
bool hiddenName,
|
||||||
|
Element *e) :
|
||||||
QGraphicsObject (e),
|
QGraphicsObject (e),
|
||||||
d(new TerminalData(this)),
|
d(new TerminalData(this)),
|
||||||
parent_element_ (e)
|
parent_element_ (e)
|
||||||
@@ -242,9 +248,10 @@ void Terminal::removeConductor(Conductor *conductor)
|
|||||||
Fonction de dessin des bornes
|
Fonction de dessin des bornes
|
||||||
@param p Le QPainter a utiliser
|
@param p Le QPainter a utiliser
|
||||||
@param options Les options de dessin
|
@param options Les options de dessin
|
||||||
@param widget Le widget sur lequel on dessine
|
|
||||||
*/
|
*/
|
||||||
void Terminal::paint(QPainter *p, const QStyleOptionGraphicsItem *options, QWidget *) {
|
void Terminal::paint(QPainter *p,
|
||||||
|
const QStyleOptionGraphicsItem *options,
|
||||||
|
QWidget *) {
|
||||||
// en dessous d'un certain zoom, les bornes ne sont plus dessinees
|
// en dessous d'un certain zoom, les bornes ne sont plus dessinees
|
||||||
if (options && options -> levelOfDetail < 0.5) return;
|
if (options && options -> levelOfDetail < 0.5) return;
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,8 @@
|
|||||||
@param elmt
|
@param elmt
|
||||||
@param parent
|
@param parent
|
||||||
*/
|
*/
|
||||||
ElementPropertiesWidget::ElementPropertiesWidget(Element *elmt, QWidget *parent) :
|
ElementPropertiesWidget::ElementPropertiesWidget(Element *elmt,
|
||||||
|
QWidget *parent) :
|
||||||
AbstractElementPropertiesEditorWidget (parent),
|
AbstractElementPropertiesEditorWidget (parent),
|
||||||
m_diagram (elmt->diagram()),
|
m_diagram (elmt->diagram()),
|
||||||
m_tab (nullptr),
|
m_tab (nullptr),
|
||||||
@@ -57,7 +58,8 @@ ElementPropertiesWidget::ElementPropertiesWidget(Element *elmt, QWidget *parent)
|
|||||||
@param text
|
@param text
|
||||||
@param parent
|
@param parent
|
||||||
*/
|
*/
|
||||||
ElementPropertiesWidget::ElementPropertiesWidget(DynamicElementTextItem *text, QWidget *parent) :
|
ElementPropertiesWidget::ElementPropertiesWidget(DynamicElementTextItem *text,
|
||||||
|
QWidget *parent) :
|
||||||
AbstractElementPropertiesEditorWidget (parent),
|
AbstractElementPropertiesEditorWidget (parent),
|
||||||
m_tab (nullptr),
|
m_tab (nullptr),
|
||||||
m_general_widget(nullptr)
|
m_general_widget(nullptr)
|
||||||
@@ -80,7 +82,8 @@ ElementPropertiesWidget::ElementPropertiesWidget(DynamicElementTextItem *text, Q
|
|||||||
@param group
|
@param group
|
||||||
@param parent
|
@param parent
|
||||||
*/
|
*/
|
||||||
ElementPropertiesWidget::ElementPropertiesWidget(ElementTextItemGroup *group, QWidget *parent) :
|
ElementPropertiesWidget::ElementPropertiesWidget(ElementTextItemGroup *group,
|
||||||
|
QWidget *parent) :
|
||||||
AbstractElementPropertiesEditorWidget (parent),
|
AbstractElementPropertiesEditorWidget (parent),
|
||||||
m_tab (nullptr),
|
m_tab (nullptr),
|
||||||
m_general_widget(nullptr)
|
m_general_widget(nullptr)
|
||||||
|
|||||||
@@ -44,7 +44,9 @@ IndiTextPropertiesWidget::IndiTextPropertiesWidget(IndependentTextItem *text, QW
|
|||||||
@param text_list : a list of texts to edit
|
@param text_list : a list of texts to edit
|
||||||
@param parent : the parent widget of this widget
|
@param parent : the parent widget of this widget
|
||||||
*/
|
*/
|
||||||
IndiTextPropertiesWidget::IndiTextPropertiesWidget(QList<IndependentTextItem *> text_list, QWidget *parent) :
|
IndiTextPropertiesWidget::IndiTextPropertiesWidget(
|
||||||
|
QList<IndependentTextItem *> text_list,
|
||||||
|
QWidget *parent) :
|
||||||
PropertiesEditorWidget (parent),
|
PropertiesEditorWidget (parent),
|
||||||
ui(new Ui::IndiTextPropertiesWidget)
|
ui(new Ui::IndiTextPropertiesWidget)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -44,7 +44,8 @@ class LinkSingleElementWidget : public AbstractElementPropertiesEditorWidget
|
|||||||
|
|
||||||
///Methods
|
///Methods
|
||||||
public:
|
public:
|
||||||
explicit LinkSingleElementWidget(Element *elmt, QWidget *parent = nullptr);
|
explicit LinkSingleElementWidget(Element *elmt,
|
||||||
|
QWidget *parent = nullptr);
|
||||||
~LinkSingleElementWidget() override;
|
~LinkSingleElementWidget() override;
|
||||||
|
|
||||||
void setElement (Element *element) override;
|
void setElement (Element *element) override;
|
||||||
|
|||||||
@@ -34,7 +34,10 @@
|
|||||||
@param content : content to remove
|
@param content : content to remove
|
||||||
@param parent : parent undo
|
@param parent : parent undo
|
||||||
*/
|
*/
|
||||||
DeleteQGraphicsItemCommand::DeleteQGraphicsItemCommand(Diagram *diagram, const DiagramContent &content, QUndoCommand *parent) :
|
DeleteQGraphicsItemCommand::DeleteQGraphicsItemCommand(
|
||||||
|
Diagram *diagram,
|
||||||
|
const DiagramContent &content,
|
||||||
|
QUndoCommand *parent) :
|
||||||
QUndoCommand(parent),
|
QUndoCommand(parent),
|
||||||
m_removed_contents(content),
|
m_removed_contents(content),
|
||||||
m_diagram(diagram)
|
m_diagram(diagram)
|
||||||
@@ -96,8 +99,12 @@ DeleteQGraphicsItemCommand::DeleteQGraphicsItemCommand(Diagram *diagram, const D
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setText(QString(QObject::tr("supprimer %1", "undo caption - %1 is a sentence listing the removed content")).arg(m_removed_contents.sentence(DiagramContent::All)));
|
setText(QString(QObject::tr(
|
||||||
//Table is now managed by @m_table_scene_hash, we clear the tables of m_removed_content
|
"supprimer %1",
|
||||||
|
"undo caption - %1 is a sentence listing the removed content"))
|
||||||
|
.arg(m_removed_contents.sentence(DiagramContent::All)));
|
||||||
|
//Table is now managed by m_table_scene_hash,
|
||||||
|
//we clear the tables of m_removed_content
|
||||||
m_removed_contents.m_tables.clear();
|
m_removed_contents.m_tables.clear();
|
||||||
m_diagram->qgiManager().manage(m_removed_contents.items(DiagramContent::All));
|
m_diagram->qgiManager().manage(m_removed_contents.items(DiagramContent::All));
|
||||||
}
|
}
|
||||||
@@ -195,14 +202,18 @@ void DeleteQGraphicsItemCommand::setPotentialsOfRemovedElements()
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
@brief DeleteQGraphicsItemCommand::terminalInSamePotential
|
@brief DeleteQGraphicsItemCommand::terminalInSamePotential
|
||||||
Return a terminal at the same potential of @terminal, by traveling through the conductors connected to @terminal
|
Return a terminal at the same potential of terminal,
|
||||||
only if the owner element of the terminal is not delete by this undo command.
|
by traveling through the conductors connected to terminal
|
||||||
|
only if the owner element of the terminal
|
||||||
|
is not delete by this undo command.
|
||||||
Return nullptr if a terminal can't be found.
|
Return nullptr if a terminal can't be found.
|
||||||
@param terminal - terminal from search
|
@param terminal - terminal from search
|
||||||
@param conductor_to_exclude - a conductor to exlcude from search.
|
@param conductor_to_exclude - a conductor to exlcude from search.
|
||||||
@return
|
@return
|
||||||
*/
|
*/
|
||||||
Terminal *DeleteQGraphicsItemCommand::terminalInSamePotential(Terminal *terminal, Conductor *conductor_to_exclude)
|
Terminal *DeleteQGraphicsItemCommand::terminalInSamePotential(
|
||||||
|
Terminal *terminal,
|
||||||
|
Conductor *conductor_to_exclude)
|
||||||
{
|
{
|
||||||
QList<Conductor *> conductor_list = terminal->conductors();
|
QList<Conductor *> conductor_list = terminal->conductors();
|
||||||
conductor_list.removeAll(conductor_to_exclude);
|
conductor_list.removeAll(conductor_to_exclude);
|
||||||
|
|||||||
@@ -223,13 +223,15 @@ void LinkElementCommand::redo()
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
@brief LinkElementCommand::setUpNewLink
|
@brief LinkElementCommand::setUpNewLink
|
||||||
Update the content of m_link_after with the content of @element_list.
|
Update the content of m_link_after with the content of element_list.
|
||||||
Each linkable element (know via the static method isLinkable) is added to m_linked_after
|
Each linkable element (know via the static method isLinkable)
|
||||||
@already_link is used for the static method isLinkable.
|
is added to m_linked_after
|
||||||
|
already_link is used for the static method isLinkable.
|
||||||
@param element_list
|
@param element_list
|
||||||
@param already_link
|
@param already_link
|
||||||
*/
|
*/
|
||||||
void LinkElementCommand::setUpNewLink(const QList<Element *> &element_list, bool already_link)
|
void LinkElementCommand::setUpNewLink(const QList<Element *> &element_list,
|
||||||
|
bool already_link)
|
||||||
{
|
{
|
||||||
//m_element is a master we can connect several element to it
|
//m_element is a master we can connect several element to it
|
||||||
//if m_element isn't master (may be a report or slave) we can connect only one element
|
//if m_element isn't master (may be a report or slave) we can connect only one element
|
||||||
|
|||||||
Reference in New Issue
Block a user