mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-21 16:50:53 +01:00
Compare commits
4 Commits
sqldatabas
...
Fix_compil
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cecacfc769 | ||
|
|
8c9b30acd6 | ||
|
|
6aa6d055ec | ||
|
|
495d9a5f51 |
@@ -3,5 +3,7 @@
|
|||||||
<name lang="fr">11- Schémas et plans d'installation, architecturaux et topographiques</name>
|
<name lang="fr">11- Schémas et plans d'installation, architecturaux et topographiques</name>
|
||||||
<name lang="es">11- Dibujos y planos arquitectónicos y topográficos</name>
|
<name lang="es">11- Dibujos y planos arquitectónicos y topográficos</name>
|
||||||
<name lang="da">11- Bygningsmæssige og topografiske installationstegninger og -skemaer</name>
|
<name lang="da">11- Bygningsmæssige og topografiske installationstegninger og -skemaer</name>
|
||||||
|
<name lang="en">11- Installation, architectural and topographical diagrams and plans</name>
|
||||||
|
<name lang="be">11- Installatie, bouwkundig en topografische schema's en plannen</name>
|
||||||
</names>
|
</names>
|
||||||
</qet-directory>
|
</qet-directory>
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
- 17 columns of 60.0 px wide by 20.0px high
|
- 17 columns of 60.0 px wide by 20.0px high
|
||||||
- 8 lines of 80.0 px high by 20.0px wide
|
- 8 lines of 80.0 px high by 20.0px wide
|
||||||
|
|
||||||
Initialise un objet BorderProperties avec les proprietes par
|
\~French Initialise un objet BorderProperties avec les proprietes par
|
||||||
defaut suivantes :
|
defaut suivantes :
|
||||||
- 17 colonnes affichees de 60.0 px de large pour 20.0px de haut
|
- 17 colonnes affichees de 60.0 px de large pour 20.0px de haut
|
||||||
- 8 lignes affichees de 80.0 px de haut pour 20.0px de large
|
- 8 lignes affichees de 80.0 px de haut pour 20.0px de large
|
||||||
@@ -53,12 +53,11 @@ BorderProperties::~BorderProperties() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
@brief BorderProperties::operator ==
|
@brief BorderProperties::operator ==
|
||||||
@param bp :
|
|
||||||
- other BorderProperties container/class
|
\~ @param bp : Other BorderProperties container/class.
|
||||||
- autre conteneur BorderProperties
|
\~French Autre conteneur BorderProperties
|
||||||
@return
|
\~ @return True if it and this container are identical, false otherwise.
|
||||||
- true if it and this container are identical, false otherwise
|
\~French True si ip et ce conteneur sont identiques, false sinon
|
||||||
- true si ip et ce conteneur sont identiques, false sinon
|
|
||||||
*/
|
*/
|
||||||
bool BorderProperties::operator==(const BorderProperties &bp) {
|
bool BorderProperties::operator==(const BorderProperties &bp) {
|
||||||
return(
|
return(
|
||||||
@@ -75,12 +74,13 @@ bool BorderProperties::operator==(const BorderProperties &bp) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
@brief BorderProperties::operator !=
|
@brief BorderProperties::operator !=
|
||||||
@param bp :
|
|
||||||
- other BorderProperties container/class
|
\~ @param bp :
|
||||||
- autre conteneur BorderProperties
|
Other BorderProperties container/class.
|
||||||
@return
|
\~French Autre conteneur BorderProperties
|
||||||
- false if it and this container are identical, true otherwise
|
\~ @return
|
||||||
- false si bp et ce conteneur sont identiques, true sinon
|
False if it and this container are identical, true otherwise.
|
||||||
|
\~French False si bp et ce conteneur sont identiques, true sinon
|
||||||
*/
|
*/
|
||||||
bool BorderProperties::operator!=(const BorderProperties &bp) {
|
bool BorderProperties::operator!=(const BorderProperties &bp) {
|
||||||
return(!(*this == bp));
|
return(!(*this == bp));
|
||||||
@@ -88,11 +88,12 @@ bool BorderProperties::operator!=(const BorderProperties &bp) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
@brief BorderProperties::toXml
|
@brief BorderProperties::toXml
|
||||||
- Exports dimensions as XML attributes added to element e.
|
Exports dimensions as XML attributes added to element e.
|
||||||
- Exporte les dimensions sous formes d'attributs XML ajoutes a l'element e.
|
\~French Exporte les dimensions sous formes d'attributs XML ajoutes a l'element e.
|
||||||
@param e :
|
|
||||||
- XML element to which attributes will be added
|
\~ @param e :
|
||||||
- Element XML auquel seront ajoutes des attributs
|
XML element to which attributes will be added
|
||||||
|
\~French Element XML auquel seront ajoutes des attributs
|
||||||
*/
|
*/
|
||||||
void BorderProperties::toXml(QDomElement &e) const {
|
void BorderProperties::toXml(QDomElement &e) const {
|
||||||
e.setAttribute("cols", columns_count);
|
e.setAttribute("cols", columns_count);
|
||||||
@@ -105,11 +106,12 @@ void BorderProperties::toXml(QDomElement &e) const {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
@brief BorderProperties::fromXml
|
@brief BorderProperties::fromXml
|
||||||
- Import dimensions from XML attributes of element e
|
Import dimensions from XML attributes of element e
|
||||||
- Importe les dimensions a partir des attributs XML de l'element e
|
\~French Importe les dimensions a partir des attributs XML de l'element e
|
||||||
@param e :
|
|
||||||
- XML element whose attributes will be read
|
\~ @param e :
|
||||||
- Element XML dont les attributs seront lus
|
XML element whose attributes will be read
|
||||||
|
\~French Element XML dont les attributs seront lus
|
||||||
*/
|
*/
|
||||||
void BorderProperties::fromXml(QDomElement &e) {
|
void BorderProperties::fromXml(QDomElement &e) {
|
||||||
if (e.hasAttribute("cols")) columns_count = e.attribute("cols").toInt();
|
if (e.hasAttribute("cols")) columns_count = e.attribute("cols").toInt();
|
||||||
@@ -122,14 +124,15 @@ void BorderProperties::fromXml(QDomElement &e) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
@brief BorderProperties::toSettings
|
@brief BorderProperties::toSettings
|
||||||
- Export dimensions in a QSettings object.
|
Export dimensions in a QSettings object.
|
||||||
- Exporte les dimensions dans une configuration.
|
\~French Exporte les dimensions dans une configuration.
|
||||||
@param settings :
|
|
||||||
- QSettings object to write
|
\~ @param settings :
|
||||||
- Parametres a ecrire
|
QSettings object to write
|
||||||
@param prefix :
|
\~French Parametres a ecrire
|
||||||
- prefix to be added before the names of the parameters
|
\~ @param prefix :
|
||||||
- prefixe a ajouter devant les noms des parametres
|
prefix to be added before the names of the parameters
|
||||||
|
\~French prefixe a ajouter devant les noms des parametres
|
||||||
*/
|
*/
|
||||||
void BorderProperties::toSettings(QSettings &settings, const QString &prefix) const {
|
void BorderProperties::toSettings(QSettings &settings, const QString &prefix) const {
|
||||||
settings.setValue(prefix + "cols", columns_count);
|
settings.setValue(prefix + "cols", columns_count);
|
||||||
@@ -142,14 +145,12 @@ void BorderProperties::toSettings(QSettings &settings, const QString &prefix) co
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
@brief BorderProperties::fromSettings
|
@brief BorderProperties::fromSettings
|
||||||
- Import dimensions from a QSettings object.
|
Import dimensions from a QSettings object.
|
||||||
- Importe les dimensions depuis une configuration.
|
\~French Importe les dimensions depuis une configuration.
|
||||||
@param settings :
|
\~ @param settings : QSettings object to read
|
||||||
- QSettings object to read
|
\~French Parametres a lire
|
||||||
- Parametres a lire
|
\~ @param prefix : prefix to be added before the names of the parameters
|
||||||
@param prefix :
|
\~French prefixe a ajouter devant les noms des parametres
|
||||||
- prefix to be added before the names of the parameters
|
|
||||||
- prefixe a ajouter devant les noms des parametres
|
|
||||||
*/
|
*/
|
||||||
void BorderProperties::fromSettings(QSettings &settings, const QString &prefix) {
|
void BorderProperties::fromSettings(QSettings &settings, const QString &prefix) {
|
||||||
columns_count = settings.value(prefix + "cols", columns_count).toInt();
|
columns_count = settings.value(prefix + "cols", columns_count).toInt();
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -29,6 +29,7 @@ class DiagramPosition;
|
|||||||
class TitleBlockTemplate;
|
class TitleBlockTemplate;
|
||||||
class TitleBlockTemplateRenderer;
|
class TitleBlockTemplateRenderer;
|
||||||
/**
|
/**
|
||||||
|
@brief The BorderTitleBlock class
|
||||||
This class represents the border and the titleblock which frame a
|
This class represents the border and the titleblock which frame a
|
||||||
particular electric diagram.
|
particular electric diagram.
|
||||||
*/
|
*/
|
||||||
@@ -55,9 +56,11 @@ class BorderTitleBlock : public QObject
|
|||||||
/// @return the columns width, in pixels
|
/// @return the columns width, in pixels
|
||||||
qreal columnsWidth() const { return(columns_width_); }
|
qreal columnsWidth() const { return(columns_width_); }
|
||||||
/// @return the total width of all columns, headers excluded
|
/// @return the total width of all columns, headers excluded
|
||||||
qreal columnsTotalWidth() const { return(columns_count_ * columns_width_); }
|
qreal columnsTotalWidth() const {
|
||||||
|
return(columns_count_ * columns_width_); }
|
||||||
/// @return the column headers height, in pixels
|
/// @return the column headers height, in pixels
|
||||||
qreal columnsHeaderHeight() const { return(columns_header_height_); }
|
qreal columnsHeaderHeight() const {
|
||||||
|
return(columns_header_height_); }
|
||||||
|
|
||||||
//ROWS
|
//ROWS
|
||||||
/// @return the number of rows
|
/// @return the number of rows
|
||||||
@@ -65,15 +68,26 @@ class BorderTitleBlock : public QObject
|
|||||||
/// @return the rows height, in pixels
|
/// @return the rows height, in pixels
|
||||||
qreal rowsHeight() const { return(rows_height_); }
|
qreal rowsHeight() const { return(rows_height_); }
|
||||||
/// @return the total height of all rows, headers excluded
|
/// @return the total height of all rows, headers excluded
|
||||||
qreal rowsTotalHeight() const { return(rows_count_ * rows_height_); }
|
qreal rowsTotalHeight() const {
|
||||||
|
return(rows_count_ * rows_height_); }
|
||||||
/// @return la rows header width, in pixels
|
/// @return la rows header width, in pixels
|
||||||
qreal rowsHeaderWidth() const { return(rows_header_width_); }
|
qreal rowsHeaderWidth() const { return(rows_header_width_); }
|
||||||
|
|
||||||
// border - title block = diagram
|
// border - title block = diagram
|
||||||
/// @return the diagram width, i.e. the width of the border without title block
|
/**
|
||||||
qreal diagramWidth() const { return(columnsTotalWidth() + rowsHeaderWidth()); }
|
@brief diagramWidth
|
||||||
/// @return the diagram height, i.e. the height of the border without title block
|
@return the diagram width,
|
||||||
qreal diagramHeight() const { return(rowsTotalHeight() + columnsHeaderHeight()); }
|
i.e. the width of the border without title block
|
||||||
|
*/
|
||||||
|
qreal diagramWidth() const {
|
||||||
|
return(columnsTotalWidth() + rowsHeaderWidth()); }
|
||||||
|
/**
|
||||||
|
@brief diagramHeight
|
||||||
|
@return the diagram height,
|
||||||
|
i.e. the height of the border without title block
|
||||||
|
*/
|
||||||
|
qreal diagramHeight() const {
|
||||||
|
return(rowsTotalHeight() + columnsHeaderHeight()); }
|
||||||
|
|
||||||
QRectF titleBlockRect () const;
|
QRectF titleBlockRect () const;
|
||||||
|
|
||||||
@@ -110,7 +124,8 @@ class BorderTitleBlock : public QObject
|
|||||||
/// @return the value of the title block Additional Fields
|
/// @return the value of the title block Additional Fields
|
||||||
QString version() const { return(btb_version_); }
|
QString version() const { return(btb_version_); }
|
||||||
/// @return the value of the title block Additional Fields
|
/// @return the value of the title block Additional Fields
|
||||||
DiagramContext additionalFields() const { return (additional_fields_); }
|
DiagramContext additionalFields() const {
|
||||||
|
return (additional_fields_); }
|
||||||
/// @return the value of the title block
|
/// @return the value of the title block
|
||||||
QString autoPageNum() const { return(btb_auto_page_num_); }
|
QString autoPageNum() const { return(btb_auto_page_num_); }
|
||||||
/// @return the value of the total number of folios
|
/// @return the value of the total number of folios
|
||||||
@@ -118,10 +133,13 @@ class BorderTitleBlock : public QObject
|
|||||||
|
|
||||||
// methods to get display options
|
// methods to get display options
|
||||||
/// @return true si le cartouche est affiche, false sinon
|
/// @return true si le cartouche est affiche, false sinon
|
||||||
bool titleBlockIsDisplayed() const { return(display_titleblock_); }
|
bool titleBlockIsDisplayed() const {
|
||||||
/// @return true si les entetes des colonnes sont affiches, false sinon
|
return(display_titleblock_); }
|
||||||
|
/// @return true si les entetes des colonnes sont affiches,
|
||||||
|
/// false sinon
|
||||||
bool columnsAreDisplayed() const { return(display_columns_); }
|
bool columnsAreDisplayed() const { return(display_columns_); }
|
||||||
/// @return true si les entetes des lignes sont affiches, false sinon
|
/// @return true si les entetes des lignes sont affiches,
|
||||||
|
/// false sinon
|
||||||
bool rowsAreDisplayed() const { return(display_rows_); }
|
bool rowsAreDisplayed() const { return(display_rows_); }
|
||||||
/// @return true si la bordure est affichee, false sinon
|
/// @return true si la bordure est affichee, false sinon
|
||||||
bool borderIsDisplayed() const { return(display_border_); }
|
bool borderIsDisplayed() const { return(display_border_); }
|
||||||
@@ -142,7 +160,8 @@ class BorderTitleBlock : public QObject
|
|||||||
void setDate(const QDate &date);
|
void setDate(const QDate &date);
|
||||||
void setTitle(const QString &title);
|
void setTitle(const QString &title);
|
||||||
void setFolio(const QString &folio);
|
void setFolio(const QString &folio);
|
||||||
void setFolioData(int, int, const QString& = nullptr, const DiagramContext & = DiagramContext());
|
void setFolioData(int, int, const QString& = nullptr,
|
||||||
|
const DiagramContext & = DiagramContext());
|
||||||
void setPlant(const QString &plant);
|
void setPlant(const QString &plant);
|
||||||
void setLocMach(const QString &locmach);
|
void setLocMach(const QString &locmach);
|
||||||
void setIndicerev(const QString &indexrev);
|
void setIndicerev(const QString &indexrev);
|
||||||
@@ -168,7 +187,9 @@ class BorderTitleBlock : public QObject
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void titleBlockTemplateChanged(const QString &);
|
void titleBlockTemplateChanged(const QString &);
|
||||||
void titleBlockTemplateRemoved(const QString &, const TitleBlockTemplate * = nullptr);
|
void titleBlockTemplateRemoved(
|
||||||
|
const QString &,
|
||||||
|
const TitleBlockTemplate * = nullptr);
|
||||||
|
|
||||||
// methods to set display options
|
// methods to set display options
|
||||||
void displayTitleBlock(bool);
|
void displayTitleBlock(bool);
|
||||||
@@ -179,21 +200,25 @@ class BorderTitleBlock : public QObject
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void updateRectangles();
|
void updateRectangles();
|
||||||
void updateDiagramContextForTitleBlock(const DiagramContext & = DiagramContext());
|
void updateDiagramContextForTitleBlock(
|
||||||
|
const DiagramContext & = DiagramContext());
|
||||||
QString incrementLetters(const QString &);
|
QString incrementLetters(const QString &);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
/**
|
/**
|
||||||
|
@brief borderChanged
|
||||||
Signal emitted after the border has changed
|
Signal emitted after the border has changed
|
||||||
@param old_border Former border
|
@param old_border Former border
|
||||||
@param new_border New border
|
@param new_border New border
|
||||||
*/
|
*/
|
||||||
void borderChanged(QRectF old_border, QRectF new_border);
|
void borderChanged(QRectF old_border, QRectF new_border);
|
||||||
/**
|
/**
|
||||||
|
@brief displayChanged
|
||||||
Signal emitted after display options have changed
|
Signal emitted after display options have changed
|
||||||
*/
|
*/
|
||||||
void displayChanged();
|
void displayChanged();
|
||||||
/**
|
/**
|
||||||
|
@brief diagramTitleChanged
|
||||||
Signal emitted after the title has changed
|
Signal emitted after the title has changed
|
||||||
*/
|
*/
|
||||||
void diagramTitleChanged(const QString &);
|
void diagramTitleChanged(const QString &);
|
||||||
@@ -203,48 +228,53 @@ class BorderTitleBlock : public QObject
|
|||||||
*/
|
*/
|
||||||
void titleBlockFolioChanged(const QString &);
|
void titleBlockFolioChanged(const QString &);
|
||||||
/**
|
/**
|
||||||
Signal emitted when the title block requires its data to be updated in order
|
@brief needFolioData
|
||||||
to generate the folio field.
|
Signal emitted when the title block
|
||||||
|
requires its data to be updated
|
||||||
|
in order to generate the folio field.
|
||||||
*/
|
*/
|
||||||
void needFolioData();
|
void needFolioData();
|
||||||
/**
|
/**
|
||||||
Signal emitted when this object needs to set a specific title block
|
@brief needTitleBlockTemplate
|
||||||
template. This object cannot handle the job since it does not know of
|
Signal emitted when this object needs to
|
||||||
its parent project.
|
set a specific title block template.
|
||||||
|
This object cannot handle the job
|
||||||
|
since it does not know of its parent project.
|
||||||
*/
|
*/
|
||||||
void needTitleBlockTemplate(const QString &);
|
void needTitleBlockTemplate(const QString &);
|
||||||
|
|
||||||
// attributes
|
// attributes
|
||||||
private:
|
private:
|
||||||
// titleblock basic data
|
// titleblock basic data
|
||||||
QString btb_author_;
|
QString btb_author_; ///< titleblock author
|
||||||
QDate btb_date_;
|
QDate btb_date_; ///< titleblock date
|
||||||
QString btb_title_;
|
QString btb_title_; ///< titleblock title
|
||||||
QString btb_folio_;
|
QString btb_folio_; ///< titleblock folio
|
||||||
QString btb_plant_;
|
QString btb_plant_; ///< titleblock plant
|
||||||
QString btb_locmach_;
|
QString btb_locmach_; ///< titleblock locmach
|
||||||
QString btb_indexrev_;
|
QString btb_indexrev_; ///< titleblock index rev
|
||||||
QString btb_final_folio_;
|
QString btb_final_folio_; ///< titleblock final folio
|
||||||
QString btb_auto_page_num_;
|
QString btb_auto_page_num_; ///< titleblock auto page num
|
||||||
int folio_index_;
|
int folio_index_; ///< titleblock index
|
||||||
int folio_total_;
|
int folio_total_; ///< titleblock total
|
||||||
QString btb_filename_;
|
QString btb_filename_; ///< titleblock filename
|
||||||
QString btb_version_;
|
QString btb_version_; ///< titleblock version
|
||||||
|
/// titleblock additional fields
|
||||||
DiagramContext additional_fields_;
|
DiagramContext additional_fields_;
|
||||||
Qt::Edge m_edge;
|
Qt::Edge m_edge; ///< titleblock edge
|
||||||
QString m_next_folio_num,
|
QString m_next_folio_num; ///< titleblock next folio num
|
||||||
m_previous_folio_num;
|
QString m_previous_folio_num; ///< titleblock previous folio num
|
||||||
|
|
||||||
// border dimensions (rows and columns)
|
// border dimensions (rows and columns)
|
||||||
// columns: number and dimensions
|
// columns: number and dimensions
|
||||||
int columns_count_;
|
int columns_count_; ///< columns count
|
||||||
qreal columns_width_;
|
qreal columns_width_; ///< columns width
|
||||||
qreal columns_header_height_;
|
qreal columns_header_height_; ///< columns header height
|
||||||
|
|
||||||
// rows: number and dimensions
|
// rows: number and dimensions
|
||||||
int rows_count_;
|
int rows_count_; ///< rows count
|
||||||
qreal rows_height_;
|
qreal rows_height_; ///< rows height
|
||||||
qreal rows_header_width_;
|
qreal rows_header_width_; ///< rows header width
|
||||||
|
|
||||||
// title block dimensions
|
// title block dimensions
|
||||||
qreal titleblock_height_;
|
qreal titleblock_height_;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2006-2014 The QElectroTech team
|
Copyright 2006-2020 The QElectroTech team
|
||||||
This file is part of QElectroTech.
|
This file is part of QElectroTech.
|
||||||
|
|
||||||
QElectroTech is free software: you can redistribute it and/or modify
|
QElectroTech is free software: you can redistribute it and/or modify
|
||||||
@@ -26,16 +26,23 @@
|
|||||||
#include "assignvariables.h"
|
#include "assignvariables.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief ConductorAutoNumerotation::ConductorAutoNumerotation
|
@brief ConductorAutoNumerotation::ConductorAutoNumerotation
|
||||||
* Constructor of autonum, after create a class, call numerate to apply the autonum.
|
Constructor of autonum, after create a class,
|
||||||
* When autonum is applyed, they do with an undo command added to the stack of diagram.
|
call numerate to apply the autonum.
|
||||||
* If you give a parent_undo at constructor, the undo command create in this class have parent_undo for parent,
|
When autonum is applyed,
|
||||||
* and wasn't added to the stack of diagram (it's the responsabillty of the parent_undo)
|
they do with an undo command added to the stack of diagram.
|
||||||
* @param conductor : the conductor to apply automatic numerotation
|
If you give a parent_undo at constructor,
|
||||||
* @param diagram : the diagram of conductor
|
the undo command create in this class have parent_undo for parent,
|
||||||
* @param parent_undo : parent undo command
|
and wasn't added to the stack of diagram
|
||||||
*/
|
(it's the responsabillty of the parent_undo)
|
||||||
ConductorAutoNumerotation::ConductorAutoNumerotation(Conductor *conductor, Diagram *diagram, QUndoCommand *parent_undo) :
|
@param conductor : the conductor to apply automatic numerotation
|
||||||
|
@param diagram : the diagram of conductor
|
||||||
|
@param parent_undo : parent undo command
|
||||||
|
*/
|
||||||
|
ConductorAutoNumerotation::ConductorAutoNumerotation(
|
||||||
|
Conductor *conductor,
|
||||||
|
Diagram *diagram,
|
||||||
|
QUndoCommand *parent_undo) :
|
||||||
m_diagram (diagram),
|
m_diagram (diagram),
|
||||||
m_conductor (conductor),
|
m_conductor (conductor),
|
||||||
conductor_list (conductor -> relatedPotentialConductors().values()),
|
conductor_list (conductor -> relatedPotentialConductors().values()),
|
||||||
@@ -43,19 +50,22 @@ ConductorAutoNumerotation::ConductorAutoNumerotation(Conductor *conductor, Diagr
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief ConductorAutoNumerotation::numerate
|
@brief ConductorAutoNumerotation::numerate
|
||||||
* execute the automatic numerotation
|
execute the automatic numerotation
|
||||||
*/
|
*/
|
||||||
void ConductorAutoNumerotation::numerate() {
|
void ConductorAutoNumerotation::numerate() {
|
||||||
if (!m_conductor) return;
|
if (!m_conductor) return;
|
||||||
if (conductor_list.size() >= 1 ) numeratePotential();
|
if (conductor_list.size() >= 1 ) numeratePotential();
|
||||||
else if (m_conductor -> properties().type == ConductorProperties::Multi) numerateNewConductor();
|
else if (m_conductor -> properties().type == ConductorProperties::Multi)
|
||||||
|
numerateNewConductor();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief ConductorAutoNumerotation::applyText
|
@brief ConductorAutoNumerotation::applyText
|
||||||
* apply the text @t to @conductor_ and all conductors at the same potential
|
apply the text @t to @conductor_
|
||||||
*/
|
and all conductors at the same potential
|
||||||
|
@param t : Conductor text
|
||||||
|
*/
|
||||||
void ConductorAutoNumerotation::applyText(const QString& t)
|
void ConductorAutoNumerotation::applyText(const QString& t)
|
||||||
{
|
{
|
||||||
if (!m_conductor) return;
|
if (!m_conductor) return;
|
||||||
@@ -70,20 +80,36 @@ void ConductorAutoNumerotation::applyText(const QString& t)
|
|||||||
|
|
||||||
if (m_parent_undo)
|
if (m_parent_undo)
|
||||||
{
|
{
|
||||||
new QPropertyUndoCommand(m_conductor, "properties", old_value, new_value, m_parent_undo);
|
new QPropertyUndoCommand(
|
||||||
|
m_conductor,
|
||||||
|
"properties",
|
||||||
|
old_value,
|
||||||
|
new_value,
|
||||||
|
m_parent_undo);
|
||||||
undo = m_parent_undo;
|
undo = m_parent_undo;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
undo = new QUndoCommand();
|
undo = new QUndoCommand();
|
||||||
new QPropertyUndoCommand(m_conductor, "properties", old_value, new_value, undo);
|
new QPropertyUndoCommand(
|
||||||
undo->setText(QObject::tr("Modifier les propriétés d'un conducteur", "undo caption"));
|
m_conductor,
|
||||||
|
"properties",
|
||||||
|
old_value,
|
||||||
|
new_value,
|
||||||
|
undo);
|
||||||
|
undo->setText(
|
||||||
|
QObject::tr(
|
||||||
|
"Modifier les propriétés d'un conducteur",
|
||||||
|
"undo caption"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!conductor_list.isEmpty())
|
if (!conductor_list.isEmpty())
|
||||||
{
|
{
|
||||||
if (!m_parent_undo)
|
if (!m_parent_undo)
|
||||||
undo->setText(QObject::tr("Modifier les propriétés de plusieurs conducteurs", "undo caption"));
|
undo->setText(
|
||||||
|
QObject::tr(
|
||||||
|
"Modifier les propriétés de plusieurs conducteurs",
|
||||||
|
"undo caption"));
|
||||||
|
|
||||||
foreach (Conductor *cond, conductor_list)
|
foreach (Conductor *cond, conductor_list)
|
||||||
{
|
{
|
||||||
@@ -91,7 +117,12 @@ void ConductorAutoNumerotation::applyText(const QString& t)
|
|||||||
old_value.setValue(cp2);
|
old_value.setValue(cp2);
|
||||||
cp2.text = t;
|
cp2.text = t;
|
||||||
new_value.setValue(cp2);
|
new_value.setValue(cp2);
|
||||||
new QPropertyUndoCommand(cond, "properties", old_value, new_value, undo);
|
new QPropertyUndoCommand(
|
||||||
|
cond,
|
||||||
|
"properties",
|
||||||
|
old_value,
|
||||||
|
new_value,
|
||||||
|
undo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,15 +131,19 @@ void ConductorAutoNumerotation::applyText(const QString& t)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief ConductorAutoNumerotation::newProperties
|
@brief ConductorAutoNumerotation::newProperties
|
||||||
* Create a new properties according to the current autonum rule of diagram
|
Create a new properties according to the current autonum rule of diagram
|
||||||
* @param d
|
@param diagram : Diagram class
|
||||||
* @param cp
|
@param cp : ConductorProperties
|
||||||
* @param seq
|
@param seq : sequentialNumbers
|
||||||
*/
|
*/
|
||||||
void ConductorAutoNumerotation::newProperties(Diagram *diagram, ConductorProperties &cp, autonum::sequentialNumbers &seq)
|
void ConductorAutoNumerotation::newProperties(
|
||||||
|
Diagram *diagram,
|
||||||
|
ConductorProperties &cp,
|
||||||
|
autonum::sequentialNumbers &seq)
|
||||||
{
|
{
|
||||||
NumerotationContext context = diagram->project()->conductorAutoNum(diagram->conductorsAutonumName());
|
NumerotationContext context = diagram->project()->conductorAutoNum(
|
||||||
|
diagram->conductorsAutonumName());
|
||||||
if (context.isEmpty()) {
|
if (context.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -124,9 +159,9 @@ void ConductorAutoNumerotation::newProperties(Diagram *diagram, ConductorPropert
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief ConductorAutoNumerotation::numeratePotential
|
@brief ConductorAutoNumerotation::numeratePotential
|
||||||
* Numerate a conductor on an existing potential
|
Numerate a conductor on an existing potential
|
||||||
*/
|
*/
|
||||||
void ConductorAutoNumerotation::numeratePotential()
|
void ConductorAutoNumerotation::numeratePotential()
|
||||||
{
|
{
|
||||||
ConductorProperties cp = conductor_list.first()->properties();
|
ConductorProperties cp = conductor_list.first()->properties();
|
||||||
@@ -136,7 +171,8 @@ void ConductorAutoNumerotation::numeratePotential()
|
|||||||
if (conductor->properties() != cp)
|
if (conductor->properties() != cp)
|
||||||
properties_equal = false;
|
properties_equal = false;
|
||||||
}
|
}
|
||||||
//Every properties of the potential is equal, so we apply it to m_conductor
|
// Every properties of the potential is equal,
|
||||||
|
// so we apply it to m_conductor
|
||||||
if (properties_equal)
|
if (properties_equal)
|
||||||
{
|
{
|
||||||
m_conductor->setProperties(cp);
|
m_conductor->setProperties(cp);
|
||||||
@@ -169,21 +205,25 @@ void ConductorAutoNumerotation::numeratePotential()
|
|||||||
//the texts isn't identicals
|
//the texts isn't identicals
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PotentialSelectorDialog psd(m_conductor, m_parent_undo, m_conductor->diagramEditor());
|
PotentialSelectorDialog psd(
|
||||||
|
m_conductor,
|
||||||
|
m_parent_undo,
|
||||||
|
m_conductor->diagramEditor());
|
||||||
psd.exec();
|
psd.exec();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief ConductorAutoNumerotation::numerateNewConductor
|
@brief ConductorAutoNumerotation::numerateNewConductor
|
||||||
* create and apply a new numerotation to @m_conductor
|
create and apply a new numerotation to @m_conductor
|
||||||
*/
|
*/
|
||||||
void ConductorAutoNumerotation::numerateNewConductor()
|
void ConductorAutoNumerotation::numerateNewConductor()
|
||||||
{
|
{
|
||||||
if (!m_conductor || m_diagram->conductorsAutonumName().isEmpty())
|
if (!m_conductor || m_diagram->conductorsAutonumName().isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
NumerotationContext context = m_diagram->project()->conductorAutoNum(m_diagram -> conductorsAutonumName());
|
NumerotationContext context = m_diagram->project()->conductorAutoNum(
|
||||||
|
m_diagram -> conductorsAutonumName());
|
||||||
if (context.isEmpty())
|
if (context.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -194,10 +234,17 @@ void ConductorAutoNumerotation::numerateNewConductor()
|
|||||||
cp.m_formula = formula;
|
cp.m_formula = formula;
|
||||||
m_conductor->setProperties(cp);
|
m_conductor->setProperties(cp);
|
||||||
|
|
||||||
autonum::setSequential(formula, m_conductor->rSequenceNum(), context, m_diagram, autoNum_name);
|
autonum::setSequential(formula,
|
||||||
|
m_conductor->rSequenceNum(),
|
||||||
|
context,
|
||||||
|
m_diagram,
|
||||||
|
autoNum_name);
|
||||||
|
|
||||||
NumerotationContextCommands ncc (context, m_diagram);
|
NumerotationContextCommands ncc (context, m_diagram);
|
||||||
m_diagram->project()->addConductorAutoNum(autoNum_name, ncc.next());
|
m_diagram->project()->addConductorAutoNum(autoNum_name, ncc.next());
|
||||||
|
|
||||||
applyText(autonum::AssignVariables::formulaToLabel(formula, m_conductor->rSequenceNum(), m_diagram));
|
applyText(autonum::AssignVariables::formulaToLabel(
|
||||||
|
formula,
|
||||||
|
m_conductor->rSequenceNum(),
|
||||||
|
m_diagram));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2006-2014 The QElectroTech team
|
Copyright 2006-2020 The QElectroTech team
|
||||||
This file is part of QElectroTech.
|
This file is part of QElectroTech.
|
||||||
|
|
||||||
QElectroTech is free software: you can redistribute it and/or modify
|
QElectroTech is free software: you can redistribute it and/or modify
|
||||||
@@ -26,16 +26,23 @@ class Conductor;
|
|||||||
class QUndoCommand;
|
class QUndoCommand;
|
||||||
class ConductorProperties;
|
class ConductorProperties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief The ConductorAutoNumerotation class
|
||||||
|
*/
|
||||||
class ConductorAutoNumerotation
|
class ConductorAutoNumerotation
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//constructors & destructor
|
//constructors & destructor
|
||||||
ConductorAutoNumerotation (Conductor *conductor, Diagram *diagram, QUndoCommand *undo_parent = nullptr);
|
ConductorAutoNumerotation (Conductor *conductor,
|
||||||
|
Diagram *diagram,
|
||||||
|
QUndoCommand *undo_parent = nullptr);
|
||||||
|
|
||||||
//methods
|
//methods
|
||||||
void numerate ();
|
void numerate ();
|
||||||
void applyText (const QString&);
|
void applyText (const QString&);
|
||||||
static void newProperties(Diagram *diagram, ConductorProperties &cp, autonum::sequentialNumbers &seq);
|
static void newProperties(Diagram *diagram,
|
||||||
|
ConductorProperties &cp,
|
||||||
|
autonum::sequentialNumbers &seq);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//methods
|
//methods
|
||||||
|
|||||||
@@ -928,8 +928,6 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
|
|||||||
// The first element must be a diagram
|
// The first element must be a diagram
|
||||||
if (root.tagName() != "diagram") return(false);
|
if (root.tagName() != "diagram") return(false);
|
||||||
|
|
||||||
qDebug() << "Diagram: " << root.attribute("title");
|
|
||||||
|
|
||||||
// Read attributes of this diagram
|
// Read attributes of this diagram
|
||||||
if (consider_informations) {
|
if (consider_informations) {
|
||||||
// Version of diagram
|
// Version of diagram
|
||||||
@@ -1025,7 +1023,6 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
|
|||||||
}
|
}
|
||||||
|
|
||||||
int state = 0;
|
int state = 0;
|
||||||
qDebug() << "Element from collection: " << element_location;
|
|
||||||
Element *nvel_elmt = ElementFactory::Instance() -> createElement(element_location, nullptr, &state);
|
Element *nvel_elmt = ElementFactory::Instance() -> createElement(element_location, nullptr, &state);
|
||||||
if (state)
|
if (state)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ int DiagramContext::count() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief DiagramContext::keyMustShow
|
* @brief DiagramContext::keyMustShow
|
||||||
* @return the value pairs with key, if key not found, return false
|
* @return the value pairs with key, if key no found, return false
|
||||||
*/
|
*/
|
||||||
bool DiagramContext::keyMustShow(const QString &key) const {
|
bool DiagramContext::keyMustShow(const QString &key) const {
|
||||||
if (m_content_show.contains(key))
|
if (m_content_show.contains(key))
|
||||||
|
|||||||
@@ -20,3 +20,8 @@
|
|||||||
PropertiesInterface::PropertiesInterface()
|
PropertiesInterface::PropertiesInterface()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PropertiesInterface::~PropertiesInterface()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ class PropertiesInterface
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PropertiesInterface();
|
PropertiesInterface();
|
||||||
|
virtual ~PropertiesInterface();
|
||||||
// Save/load properties to setting file. QString is use for prefix a word befor the name of each paramètre
|
// Save/load properties to setting file. QString is use for prefix a word befor the name of each paramètre
|
||||||
virtual void toSettings (QSettings &settings, const QString = QString()) const =0;
|
virtual void toSettings (QSettings &settings, const QString = QString()) const =0;
|
||||||
virtual void fromSettings (const QSettings &settings, const QString = QString()) =0;
|
virtual void fromSettings (const QSettings &settings, const QString = QString()) =0;
|
||||||
|
|||||||
@@ -418,7 +418,6 @@ bool Element::buildFromXml(const QDomElement &xml_def_elmt, int *state)
|
|||||||
{
|
{
|
||||||
//Minor workaround to find if there is a "input" tagg as label.
|
//Minor workaround to find if there is a "input" tagg as label.
|
||||||
//If not, we set the tagg "label" to the first "input.
|
//If not, we set the tagg "label" to the first "input.
|
||||||
// TODO: Remove in later version begin
|
|
||||||
QList <QDomElement> input_field;
|
QList <QDomElement> input_field;
|
||||||
bool have_label = false;
|
bool have_label = false;
|
||||||
for (QDomElement input_node = node.firstChildElement("input") ; !input_node.isNull() ; input_node = input_node.nextSiblingElement("input"))
|
for (QDomElement input_node = node.firstChildElement("input") ; !input_node.isNull() ; input_node = input_node.nextSiblingElement("input"))
|
||||||
@@ -430,11 +429,8 @@ bool Element::buildFromXml(const QDomElement &xml_def_elmt, int *state)
|
|||||||
have_label = true;
|
have_label = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!have_label && !input_field.isEmpty()) {
|
if(!have_label && !input_field.isEmpty())
|
||||||
qDebug() << input_field.first().attribute("text");
|
|
||||||
input_field.first().setAttribute("tagg", "label");
|
input_field.first().setAttribute("tagg", "label");
|
||||||
}
|
|
||||||
// TODO: Remove in later version end
|
|
||||||
|
|
||||||
//Parse the definition
|
//Parse the definition
|
||||||
for (QDomNode n = node.firstChild() ; !n.isNull() ; n = n.nextSibling())
|
for (QDomNode n = node.firstChild() ; !n.isNull() ; n = n.nextSibling())
|
||||||
@@ -721,20 +717,15 @@ bool Element::fromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr, bool
|
|||||||
setRotation(90*read_ori);
|
setRotation(90*read_ori);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: elementInformations are not read from the diagram section or? Yes see below
|
//Befor load the dynamic text field,
|
||||||
|
|
||||||
//#######################################################################################################################
|
|
||||||
//#### START #######################################################################################################
|
|
||||||
//#######################################################################################################################
|
|
||||||
//Before load the dynamic text field,
|
|
||||||
//we remove the dynamic text field created from the description of this element, to avoid doublons.
|
//we remove the dynamic text field created from the description of this element, to avoid doublons.
|
||||||
for(DynamicElementTextItem *deti : m_dynamic_text_list)
|
for(DynamicElementTextItem *deti : m_dynamic_text_list)
|
||||||
delete deti;
|
delete deti;
|
||||||
m_dynamic_text_list.clear();
|
m_dynamic_text_list.clear();
|
||||||
|
|
||||||
//************************//
|
//************************//
|
||||||
//***Dynamic texts item***//
|
//***Dynamic texts item***//
|
||||||
//************************//
|
//************************//
|
||||||
// Texts in diagram section
|
|
||||||
for (const QDomElement& qde : QET::findInDomElement(e, "dynamic_texts", DynamicElementTextItem::xmlTagName()))
|
for (const QDomElement& qde : QET::findInDomElement(e, "dynamic_texts", DynamicElementTextItem::xmlTagName()))
|
||||||
{
|
{
|
||||||
DynamicElementTextItem *deti = new DynamicElementTextItem(this);
|
DynamicElementTextItem *deti = new DynamicElementTextItem(this);
|
||||||
@@ -742,24 +733,20 @@ bool Element::fromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr, bool
|
|||||||
deti->fromXml(qde);
|
deti->fromXml(qde);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: remove in later version begin
|
|
||||||
|
|
||||||
//************************//
|
//************************//
|
||||||
//***Element texts item***//
|
//***Element texts item***//
|
||||||
//************************//
|
//************************//
|
||||||
// Inputs in diagram section
|
QList<QDomElement> inputs = QET::findInDomElement(e, "inputs", "input");
|
||||||
QList<QDomElement> inputs = QET::findInDomElement(e, "inputs", "input"); // Inputs in diagram section
|
|
||||||
|
|
||||||
//First case, we check for the text item converted to dynamic text item
|
//First case, we check for the text item converted to dynamic text item
|
||||||
const QList <DynamicElementTextItem *> conv_deti_list = m_converted_text_from_xml_description.keys(); // Texts in element definition (elements collection)
|
const QList <DynamicElementTextItem *> conv_deti_list = m_converted_text_from_xml_description.keys();
|
||||||
QList <DynamicElementTextItem *> successfully_converted;
|
QList <DynamicElementTextItem *> successfully_converted;
|
||||||
const QList <QDomElement> dom_inputs = inputs;
|
const QList <QDomElement> dom_inputs = inputs;
|
||||||
|
|
||||||
|
for (DynamicElementTextItem *deti : conv_deti_list)
|
||||||
|
|
||||||
for (DynamicElementTextItem *deti : conv_deti_list) // Texts from element definition (elements collection)
|
|
||||||
{
|
{
|
||||||
for(const QDomElement& dom_input : dom_inputs) // Inputs in diagram section
|
for(const QDomElement& dom_input : dom_inputs)
|
||||||
{
|
{
|
||||||
//we use the same method used in ElementTextItem::fromXml to compar and know if the input dom element is for one of the text stored.
|
//we use the same method used in ElementTextItem::fromXml to compar and know if the input dom element is for one of the text stored.
|
||||||
//The comparaison is made from the text position : if the position of the text is the same as the position stored in 'input' dom element
|
//The comparaison is made from the text position : if the position of the text is the same as the position stored in 'input' dom element
|
||||||
@@ -830,7 +817,7 @@ bool Element::fromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr, bool
|
|||||||
group->fromXml(qde);
|
group->fromXml(qde);
|
||||||
}
|
}
|
||||||
|
|
||||||
//load elementInformations from diagram section
|
//load informations
|
||||||
DiagramContext dc;
|
DiagramContext dc;
|
||||||
dc.fromXml(e.firstChildElement("elementInformations"), "elementInformation");
|
dc.fromXml(e.firstChildElement("elementInformations"), "elementInformation");
|
||||||
/**
|
/**
|
||||||
@@ -1004,12 +991,6 @@ bool Element::fromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr, bool
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: remove in later version end
|
|
||||||
|
|
||||||
//#######################################################################################################################
|
|
||||||
//#### END #######################################################################################################
|
|
||||||
//#######################################################################################################################
|
|
||||||
m_state = QET::GIOK;
|
m_state = QET::GIOK;
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -186,10 +186,6 @@ QUndoCommand *DynamicElementTextItemEditor::associatedUndo() const
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief DynamicElementTextItemEditor::dataEdited
|
|
||||||
* Apply changes to the text item. It is called when dataChanged() signal is called
|
|
||||||
*/
|
|
||||||
void DynamicElementTextItemEditor::dataEdited()
|
void DynamicElementTextItemEditor::dataEdited()
|
||||||
{
|
{
|
||||||
if (m_live_edit)
|
if (m_live_edit)
|
||||||
|
|||||||
@@ -29,10 +29,6 @@ namespace Ui {
|
|||||||
class DynamicElementTextItemEditor;
|
class DynamicElementTextItemEditor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief The DynamicElementTextItemEditor class
|
|
||||||
* Widget used to modify the properties of DynamicElementTextItem.
|
|
||||||
*/
|
|
||||||
class DynamicElementTextItemEditor : public AbstractElementPropertiesEditorWidget
|
class DynamicElementTextItemEditor : public AbstractElementPropertiesEditorWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|||||||
@@ -57,10 +57,6 @@ static int adjust_grp_row = 4;
|
|||||||
static int frame_grp_row = 5;
|
static int frame_grp_row = 5;
|
||||||
static int hold_to_bottom_grp_row = 6;
|
static int hold_to_bottom_grp_row = 6;
|
||||||
|
|
||||||
const char* user_text = "Texte utilisateur";
|
|
||||||
const char* element_information = "Information de l'élément";
|
|
||||||
const char* composite_text = "Texte composé";
|
|
||||||
|
|
||||||
DynamicElementTextModel::DynamicElementTextModel(Element *element, QObject *parent) :
|
DynamicElementTextModel::DynamicElementTextModel(Element *element, QObject *parent) :
|
||||||
QStandardItemModel(parent),
|
QStandardItemModel(parent),
|
||||||
m_element(element)
|
m_element(element)
|
||||||
@@ -140,9 +136,9 @@ QList<QStandardItem *> DynamicElementTextModel::itemsForText(DynamicElementTextI
|
|||||||
src->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
src->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||||
|
|
||||||
QString title;
|
QString title;
|
||||||
if (deti->textFrom() == DynamicElementTextItem::UserText) title = tr(user_text);
|
if (deti->textFrom() == DynamicElementTextItem::UserText) title = tr("Texte utilisateur");
|
||||||
else if (deti->textFrom() == DynamicElementTextItem::ElementInfo) title = tr(element_information);
|
else if (deti->textFrom() == DynamicElementTextItem::ElementInfo) title = tr("Information de l'élément");
|
||||||
else title = tr(composite_text);
|
else title = tr("Texte composé");
|
||||||
QStandardItem *srca = new QStandardItem(title);
|
QStandardItem *srca = new QStandardItem(title);
|
||||||
srca->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable);
|
srca->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable);
|
||||||
srca->setData(textFrom, Qt::UserRole+1);
|
srca->setData(textFrom, Qt::UserRole+1);
|
||||||
@@ -176,7 +172,7 @@ QList<QStandardItem *> DynamicElementTextModel::itemsForText(DynamicElementTextI
|
|||||||
qsi->appendRow(qsi_list);
|
qsi->appendRow(qsi_list);
|
||||||
|
|
||||||
//Composite text
|
//Composite text
|
||||||
QStandardItem *composite = new QStandardItem(tr(composite_text));
|
QStandardItem *composite = new QStandardItem(tr("Texte composé"));
|
||||||
composite->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
composite->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||||
|
|
||||||
DiagramContext dc;
|
DiagramContext dc;
|
||||||
@@ -401,7 +397,7 @@ DynamicElementTextItem *DynamicElementTextModel::textFromItem(QStandardItem *ite
|
|||||||
|
|
||||||
|
|
||||||
QStandardItem *text_item = item;
|
QStandardItem *text_item = item;
|
||||||
while (text_item->parent()) // recursive search for the highest parent
|
while (text_item->parent())
|
||||||
text_item = text_item->parent();
|
text_item = text_item->parent();
|
||||||
|
|
||||||
if (m_texts_list.values().contains(text_item)) //The item is a text
|
if (m_texts_list.values().contains(text_item)) //The item is a text
|
||||||
@@ -462,26 +458,26 @@ QUndoCommand *DynamicElementTextModel::undoForEditedText(DynamicElementTextItem
|
|||||||
QStandardItem *text_qsi = m_texts_list.value(deti);
|
QStandardItem *text_qsi = m_texts_list.value(deti);
|
||||||
|
|
||||||
QString from = text_qsi->child(src_txt_row,1)->data(Qt::DisplayRole).toString();
|
QString from = text_qsi->child(src_txt_row,1)->data(Qt::DisplayRole).toString();
|
||||||
if ((from == tr(user_text)) && (deti->textFrom() != DynamicElementTextItem::UserText))
|
if ((from == tr("Texte utilisateur")) && (deti->textFrom() != DynamicElementTextItem::UserText))
|
||||||
new QPropertyUndoCommand(deti, "textFrom", QVariant(deti->textFrom()), QVariant(DynamicElementTextItem::UserText), undo);
|
new QPropertyUndoCommand(deti, "textFrom", QVariant(deti->textFrom()), QVariant(DynamicElementTextItem::UserText), undo);
|
||||||
else if ((from == tr(element_information)) && (deti->textFrom() != DynamicElementTextItem::ElementInfo))
|
else if ((from == tr("Information de l'élément")) && (deti->textFrom() != DynamicElementTextItem::ElementInfo))
|
||||||
new QPropertyUndoCommand(deti, "textFrom", QVariant(deti->textFrom()), QVariant(DynamicElementTextItem::ElementInfo), undo);
|
new QPropertyUndoCommand(deti, "textFrom", QVariant(deti->textFrom()), QVariant(DynamicElementTextItem::ElementInfo), undo);
|
||||||
else if ((from == tr(composite_text)) && (deti->textFrom() != DynamicElementTextItem::CompositeText))
|
else if ((from == tr("Texte composé")) && (deti->textFrom() != DynamicElementTextItem::CompositeText))
|
||||||
new QPropertyUndoCommand(deti, "textFrom", QVariant(deti->textFrom()), QVariant(DynamicElementTextItem::CompositeText), undo);
|
new QPropertyUndoCommand(deti, "textFrom", QVariant(deti->textFrom()), QVariant(DynamicElementTextItem::CompositeText), undo);
|
||||||
|
|
||||||
if(from == tr(user_text))
|
if(from == tr("Texte utilisateur"))
|
||||||
{
|
{
|
||||||
QString text = text_qsi->child(usr_txt_row,1)->data(Qt::DisplayRole).toString();
|
QString text = text_qsi->child(usr_txt_row,1)->data(Qt::DisplayRole).toString();
|
||||||
if (text != deti->text())
|
if (text != deti->text())
|
||||||
new QPropertyUndoCommand(deti, "text", QVariant(deti->text()), QVariant(text), undo);
|
new QPropertyUndoCommand(deti, "text", QVariant(deti->text()), QVariant(text), undo);
|
||||||
}
|
}
|
||||||
else if (from == tr(element_information))
|
else if (from == tr("Information de l'élément"))
|
||||||
{
|
{
|
||||||
QString info_name = text_qsi->child(info_txt_row,1)->data(Qt::UserRole+2).toString();
|
QString info_name = text_qsi->child(info_txt_row,1)->data(Qt::UserRole+2).toString();
|
||||||
if(info_name != deti->infoName())
|
if(info_name != deti->infoName())
|
||||||
new QPropertyUndoCommand(deti, "infoName", QVariant(deti->infoName()), QVariant(info_name), undo);
|
new QPropertyUndoCommand(deti, "infoName", QVariant(deti->infoName()), QVariant(info_name), undo);
|
||||||
}
|
}
|
||||||
else if (from == tr(composite_text))
|
else if (from == tr("Texte composé"))
|
||||||
{
|
{
|
||||||
QString composite_text = text_qsi->child(compo_txt_row,1)->data(Qt::UserRole+2).toString();
|
QString composite_text = text_qsi->child(compo_txt_row,1)->data(Qt::UserRole+2).toString();
|
||||||
if(composite_text != deti->compositeText())
|
if(composite_text != deti->compositeText())
|
||||||
@@ -1116,7 +1112,6 @@ void DynamicElementTextModel::enableSourceText(DynamicElementTextItem *deti, Dyn
|
|||||||
case DynamicElementTextItem::CompositeText: compo = true;break;
|
case DynamicElementTextItem::CompositeText: compo = true;break;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ignore_item_change = true;
|
|
||||||
//User text
|
//User text
|
||||||
qsi->child(usr_txt_row,0)->setEnabled(usr);
|
qsi->child(usr_txt_row,0)->setEnabled(usr);
|
||||||
qsi->child(usr_txt_row,1)->setEnabled(usr);
|
qsi->child(usr_txt_row,1)->setEnabled(usr);
|
||||||
@@ -1125,7 +1120,6 @@ void DynamicElementTextModel::enableSourceText(DynamicElementTextItem *deti, Dyn
|
|||||||
qsi->child(info_txt_row,1)->setEnabled(info);
|
qsi->child(info_txt_row,1)->setEnabled(info);
|
||||||
//Composite text
|
//Composite text
|
||||||
qsi->child(compo_txt_row,0)->setEnabled(compo);
|
qsi->child(compo_txt_row,0)->setEnabled(compo);
|
||||||
m_ignore_item_change = false;
|
|
||||||
qsi->child(compo_txt_row,1)->setEnabled(compo);
|
qsi->child(compo_txt_row,1)->setEnabled(compo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1163,10 +1157,6 @@ void DynamicElementTextModel::enableGroupRotationAndPos(ElementTextItemGroup *gr
|
|||||||
|
|
||||||
void DynamicElementTextModel::itemDataChanged(QStandardItem *qsi)
|
void DynamicElementTextModel::itemDataChanged(QStandardItem *qsi)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (m_ignore_item_change)
|
|
||||||
return;
|
|
||||||
|
|
||||||
DynamicElementTextItem *deti = textFromItem(qsi);
|
DynamicElementTextItem *deti = textFromItem(qsi);
|
||||||
ElementTextItemGroup *etig = groupFromItem(qsi);
|
ElementTextItemGroup *etig = groupFromItem(qsi);
|
||||||
if (!deti && !etig)
|
if (!deti && !etig)
|
||||||
@@ -1180,15 +1170,15 @@ void DynamicElementTextModel::itemDataChanged(QStandardItem *qsi)
|
|||||||
dc = deti->elementUseForInfo()->elementInformations();
|
dc = deti->elementUseForInfo()->elementInformations();
|
||||||
|
|
||||||
if (qsi->data().toInt() == textFrom)
|
if (qsi->data().toInt() == textFrom)
|
||||||
{ // change textFrom
|
{
|
||||||
QString from = qsi->data(Qt::DisplayRole).toString();
|
QString from = qsi->data(Qt::DisplayRole).toString();
|
||||||
|
|
||||||
if (from == tr(user_text))
|
if (from == tr("Texte utilisateur"))
|
||||||
{
|
{
|
||||||
enableSourceText(deti, DynamicElementTextItem::UserText);
|
enableSourceText(deti, DynamicElementTextItem::UserText);
|
||||||
text_qsi->setData(text_qsi->child(usr_txt_row,1)->data(Qt::DisplayRole).toString());
|
text_qsi->setData(text_qsi->child(usr_txt_row,1)->data(Qt::DisplayRole).toString());
|
||||||
}
|
}
|
||||||
else if (from == tr(element_information))
|
else if (from == tr("Information de l'élément"))
|
||||||
{
|
{
|
||||||
enableSourceText(deti, DynamicElementTextItem::ElementInfo);
|
enableSourceText(deti, DynamicElementTextItem::ElementInfo);
|
||||||
QString info = text_qsi->child(info_txt_row,1)->data(Qt::UserRole+2).toString();
|
QString info = text_qsi->child(info_txt_row,1)->data(Qt::UserRole+2).toString();
|
||||||
@@ -1223,7 +1213,7 @@ void DynamicElementTextModel::itemDataChanged(QStandardItem *qsi)
|
|||||||
//We emit the signal only if @qsi is in the second column, because the data are stored on this column
|
//We emit the signal only if @qsi is in the second column, because the data are stored on this column
|
||||||
//the first column is use only for display the title of the property, except for the name of texts group
|
//the first column is use only for display the title of the property, except for the name of texts group
|
||||||
if((m_groups_list.values().contains(qsi) || qsi->column() == 1) && !m_block_dataChanged)
|
if((m_groups_list.values().contains(qsi) || qsi->column() == 1) && !m_block_dataChanged)
|
||||||
emit dataChanged(); // TODO: where it goes?
|
emit dataChanged();
|
||||||
if(deti) deti->updateXref();
|
if(deti) deti->updateXref();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1319,9 +1309,9 @@ void DynamicElementTextModel::updateDataFromText(DynamicElementTextItem *deti, V
|
|||||||
{
|
{
|
||||||
switch (deti->textFrom())
|
switch (deti->textFrom())
|
||||||
{
|
{
|
||||||
case DynamicElementTextItem::UserText: qsi->child(0,1)->setData(tr(user_text), Qt::DisplayRole); break;
|
case DynamicElementTextItem::UserText: qsi->child(0,1)->setData(tr("Texte utilisateur"), Qt::DisplayRole); break;
|
||||||
case DynamicElementTextItem::ElementInfo : qsi->child(0,1)->setData(tr(element_information), Qt::DisplayRole); break;
|
case DynamicElementTextItem::ElementInfo : qsi->child(0,1)->setData(tr("Information de l'élément"), Qt::DisplayRole); break;
|
||||||
case DynamicElementTextItem::CompositeText : qsi->child(0,1)->setData(tr(composite_text), Qt::DisplayRole); break;
|
case DynamicElementTextItem::CompositeText : qsi->child(0,1)->setData(tr("Texte composé"), Qt::DisplayRole); break;
|
||||||
}
|
}
|
||||||
enableSourceText(deti, deti->textFrom());
|
enableSourceText(deti, deti->textFrom());
|
||||||
qsi->setData(deti->toPlainText(), Qt::DisplayRole);
|
qsi->setData(deti->toPlainText(), Qt::DisplayRole);
|
||||||
@@ -1458,15 +1448,6 @@ DynamicTextItemDelegate::DynamicTextItemDelegate(QObject *parent) :
|
|||||||
QStyledItemDelegate(parent)
|
QStyledItemDelegate(parent)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief DynamicTextItemDelegate::createEditor
|
|
||||||
* Different widgets are used depending of the data which should be shown in the view.
|
|
||||||
* For example for choosing color, a color chooser is used.
|
|
||||||
* \param parent
|
|
||||||
* \param option
|
|
||||||
* \param index
|
|
||||||
* \return
|
|
||||||
*/
|
|
||||||
QWidget *DynamicTextItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
QWidget *DynamicTextItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
switch (index.data(Qt::UserRole+1).toInt())
|
switch (index.data(Qt::UserRole+1).toInt())
|
||||||
@@ -1475,9 +1456,9 @@ QWidget *DynamicTextItemDelegate::createEditor(QWidget *parent, const QStyleOpti
|
|||||||
{
|
{
|
||||||
QComboBox *qcb = new QComboBox(parent);
|
QComboBox *qcb = new QComboBox(parent);
|
||||||
qcb->setObjectName("text_from");
|
qcb->setObjectName("text_from");
|
||||||
qcb->addItem(tr(user_text));
|
qcb->addItem(tr("Texte utilisateur"));
|
||||||
qcb->addItem(tr(element_information));
|
qcb->addItem(tr("Information de l'élément"));
|
||||||
qcb->addItem(tr(composite_text));
|
qcb->addItem(tr("Texte composé"));
|
||||||
return qcb;
|
return qcb;
|
||||||
}
|
}
|
||||||
case DynamicElementTextModel::infoText:
|
case DynamicElementTextModel::infoText:
|
||||||
|
|||||||
@@ -106,7 +106,6 @@ class DynamicElementTextModel : public QStandardItemModel
|
|||||||
QHash <DynamicElementTextItem *, QList<QMetaObject::Connection>> m_hash_text_connect;
|
QHash <DynamicElementTextItem *, QList<QMetaObject::Connection>> m_hash_text_connect;
|
||||||
QHash <ElementTextItemGroup *, QList<QMetaObject::Connection>> m_hash_group_connect;
|
QHash <ElementTextItemGroup *, QList<QMetaObject::Connection>> m_hash_group_connect;
|
||||||
bool m_block_dataChanged = false;
|
bool m_block_dataChanged = false;
|
||||||
bool m_ignore_item_change{false};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class DynamicTextItemDelegate : public QStyledItemDelegate
|
class DynamicTextItemDelegate : public QStyledItemDelegate
|
||||||
|
|||||||
Reference in New Issue
Block a user