mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
Compare commits
29 Commits
XMLPropert
...
feature_re
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
698db4e5c0 | ||
|
|
6b95c6bf6f | ||
|
|
03425bcb5b | ||
|
|
3a08e60856 | ||
|
|
e03e36fb2c | ||
|
|
8f5e759528 | ||
|
|
bddf10588f | ||
|
|
a33ae2bb13 | ||
|
|
bd93e62341 | ||
|
|
119e12b1cf | ||
|
|
f242e1bccc | ||
|
|
709280e3c1 | ||
|
|
3b14946421 | ||
|
|
280e4605e8 | ||
|
|
fe4552200b | ||
|
|
d3b237d06c | ||
|
|
26fd1a497c | ||
|
|
bbd3085b8d | ||
|
|
1251d7d9b0 | ||
|
|
2229a1938d | ||
|
|
ffcdccb469 | ||
|
|
5df6d7f403 | ||
|
|
4cd69a2450 | ||
|
|
102629b86f | ||
|
|
7ddae811a5 | ||
|
|
cecacfc769 | ||
|
|
8c9b30acd6 | ||
|
|
6aa6d055ec | ||
|
|
495d9a5f51 |
5
.gitignore
vendored
5
.gitignore
vendored
@@ -1,2 +1,7 @@
|
|||||||
*.snap
|
*.snap
|
||||||
.flatpak-builder
|
.flatpak-builder
|
||||||
|
# Qt build output
|
||||||
|
*.user
|
||||||
|
# doxygen Doxyfile output
|
||||||
|
doc/
|
||||||
|
QElectroTech.tag
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
#include <QtCore/QSharedMemory>
|
#include <QtCore/QSharedMemory>
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) // ### Qt 6: remove
|
#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) // ### Qt 6: remove
|
||||||
#else
|
#else
|
||||||
|
#pragma message("@TODO remove code for QT 5.10 or later")
|
||||||
#include <QRandomGenerator>
|
#include <QRandomGenerator>
|
||||||
#endif
|
#endif
|
||||||
#include "singleapplication.h"
|
#include "singleapplication.h"
|
||||||
@@ -106,6 +107,7 @@ SingleApplication::SingleApplication( int &argc, char *argv[], bool allowSeconda
|
|||||||
qsrand( QDateTime::currentMSecsSinceEpoch() % std::numeric_limits<uint>::max() );
|
qsrand( QDateTime::currentMSecsSinceEpoch() % std::numeric_limits<uint>::max() );
|
||||||
QThread::sleep( 8 + static_cast <unsigned long>( static_cast <float>( qrand() ) / RAND_MAX * 10 ) );
|
QThread::sleep( 8 + static_cast <unsigned long>( static_cast <float>( qrand() ) / RAND_MAX * 10 ) );
|
||||||
#else
|
#else
|
||||||
|
#pragma message("@TODO remove code for QT 5.10 or later")
|
||||||
quint32 value = QRandomGenerator::global()->generate();
|
quint32 value = QRandomGenerator::global()->generate();
|
||||||
QThread::sleep( 8 + static_cast <unsigned long>( static_cast <float>( value ) / RAND_MAX * 10 ) );
|
QThread::sleep( 8 + static_cast <unsigned long>( static_cast <float>( value ) / RAND_MAX * 10 ) );
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -641,6 +641,7 @@ void ElementsCollectionWidget::search()
|
|||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
|
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
|
||||||
QStringList text_list = text.split("+", QString::SkipEmptyParts);
|
QStringList text_list = text.split("+", QString::SkipEmptyParts);
|
||||||
#else
|
#else
|
||||||
|
#pragma message("@TODO remove code for QT 5.14 or later")
|
||||||
QStringList text_list = text.split("+", Qt::SkipEmptyParts);
|
QStringList text_list = text.split("+", Qt::SkipEmptyParts);
|
||||||
#endif
|
#endif
|
||||||
QModelIndexList match_index;
|
QModelIndexList match_index;
|
||||||
|
|||||||
@@ -754,6 +754,7 @@ QDebug operator<< (QDebug debug, const ElementsLocation &location)
|
|||||||
QDebugStateSaver saver(debug);
|
QDebugStateSaver saver(debug);
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050400
|
#if QT_VERSION >= 0x050400
|
||||||
|
#pragma message("@TODO remove code for QT 5.04 or later")
|
||||||
debug.noquote();
|
debug.noquote();
|
||||||
#else
|
#else
|
||||||
debug.nospace();
|
debug.nospace();
|
||||||
|
|||||||
@@ -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.
|
||||||
*/
|
*/
|
||||||
@@ -50,30 +51,43 @@ class BorderTitleBlock : public QObject
|
|||||||
|
|
||||||
//METHODS TO GET DIMENSION
|
//METHODS TO GET DIMENSION
|
||||||
//COLUMNS
|
//COLUMNS
|
||||||
/// @return the number of columns
|
/// @return the number of columns
|
||||||
int columnsCount() const { return(columns_count_); }
|
int columnsCount() const { return(columns_count_); }
|
||||||
/// @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 the column headers height, in pixels
|
return(columns_count_ * columns_width_); }
|
||||||
qreal columnsHeaderHeight() const { return(columns_header_height_); }
|
/// @return the column headers height, in pixels
|
||||||
|
qreal columnsHeaderHeight() const {
|
||||||
|
return(columns_header_height_); }
|
||||||
|
|
||||||
//ROWS
|
//ROWS
|
||||||
/// @return the number of rows
|
/// @return the number of rows
|
||||||
int rowsCount() const { return(rows_count_); }
|
int rowsCount() const { return(rows_count_); }
|
||||||
/// @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 la rows header width, in pixels
|
return(rows_count_ * rows_height_); }
|
||||||
|
/// @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;
|
||||||
|
|
||||||
@@ -88,45 +102,49 @@ class BorderTitleBlock : public QObject
|
|||||||
QRectF outsideBorderRect() const;
|
QRectF outsideBorderRect() const;
|
||||||
QRectF insideBorderRect() const;
|
QRectF insideBorderRect() const;
|
||||||
|
|
||||||
// methods to get title block basic data
|
// methods to get title block basic data
|
||||||
/// @return the value of the title block "Author" field
|
/// @return the value of the title block "Author" field
|
||||||
QString author() const { return(btb_author_); }
|
QString author() const { return(btb_author_); }
|
||||||
/// @return the value of the title block "Date" field
|
/// @return the value of the title block "Date" field
|
||||||
QDate date() const { return(btb_date_); }
|
QDate date() const { return(btb_date_); }
|
||||||
/// @return the value of the title block "Title" field
|
/// @return the value of the title block "Title" field
|
||||||
QString title() const { return(btb_title_); }
|
QString title() const { return(btb_title_); }
|
||||||
/// @return the value of the title block "Folio" field
|
/// @return the value of the title block "Folio" field
|
||||||
QString folio() const { return(btb_folio_); }
|
QString folio() const { return(btb_folio_); }
|
||||||
/// @return the value of the title block "Folio" field as displayed
|
/// @return the value of the title block "Folio" field as displayed
|
||||||
QString finalfolio() const { return(btb_final_folio_); }
|
QString finalfolio() const { return(btb_final_folio_); }
|
||||||
/// @return the value of the title block "Plant" field
|
/// @return the value of the title block "Plant" field
|
||||||
QString plant() const { return(btb_plant_); }
|
QString plant() const { return(btb_plant_); }
|
||||||
/// @return the value of the title block "Locmach" field
|
/// @return the value of the title block "Locmach" field
|
||||||
QString locmach() const { return(btb_locmach_); }
|
QString locmach() const { return(btb_locmach_); }
|
||||||
/// @return the value of the revision index block "Folio" field
|
/// @return the value of the revision index block "Folio" field
|
||||||
QString indexrev() const { return(btb_indexrev_); }
|
QString indexrev() const { return(btb_indexrev_); }
|
||||||
/// @return the value of the title block "File" field
|
/// @return the value of the title block "File" field
|
||||||
QString fileName() const { return(btb_filename_); }
|
QString fileName() const { return(btb_filename_); }
|
||||||
/// @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 the value of the title block
|
return (additional_fields_); }
|
||||||
|
/// @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
|
||||||
int folioTotal() const { return(folio_total_);}
|
int folioTotal() const { return(folio_total_);}
|
||||||
|
|
||||||
// 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_); }
|
||||||
|
|
||||||
// methods to set dimensions
|
// methods to set dimensions
|
||||||
void setColumnsCount(int);
|
void setColumnsCount(int);
|
||||||
void setRowsCount(int);
|
void setRowsCount(int);
|
||||||
void setColumnsWidth(const qreal &);
|
void setColumnsWidth(const qreal &);
|
||||||
@@ -137,12 +155,13 @@ class BorderTitleBlock : public QObject
|
|||||||
|
|
||||||
DiagramPosition convertPosition(const QPointF &);
|
DiagramPosition convertPosition(const QPointF &);
|
||||||
|
|
||||||
// methods to set title block basic data
|
// methods to set title block basic data
|
||||||
void setAuthor(const QString &author);
|
void setAuthor(const QString &author);
|
||||||
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,9 +187,11 @@ 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);
|
||||||
void displayColumns(bool);
|
void displayColumns(bool);
|
||||||
void displayRows(bool);
|
void displayRows(bool);
|
||||||
@@ -179,77 +200,86 @@ 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:
|
||||||
/**
|
/**
|
||||||
Signal emitted after the border has changed
|
@brief borderChanged
|
||||||
@param old_border Former border
|
Signal emitted after the border has changed
|
||||||
@param new_border New border
|
@param old_border Former border
|
||||||
*/
|
@param new_border New border
|
||||||
|
*/
|
||||||
void borderChanged(QRectF old_border, QRectF new_border);
|
void borderChanged(QRectF old_border, QRectF new_border);
|
||||||
/**
|
/**
|
||||||
Signal emitted after display options have changed
|
@brief displayChanged
|
||||||
*/
|
Signal emitted after display options have changed
|
||||||
|
*/
|
||||||
void displayChanged();
|
void displayChanged();
|
||||||
/**
|
/**
|
||||||
Signal emitted after the title has changed
|
@brief diagramTitleChanged
|
||||||
*/
|
Signal emitted after the title has changed
|
||||||
|
*/
|
||||||
void diagramTitleChanged(const QString &);
|
void diagramTitleChanged(const QString &);
|
||||||
/**
|
/**
|
||||||
@brief titleBlockFolioChanged
|
@brief titleBlockFolioChanged
|
||||||
Signal emitted after Folio has changed
|
Signal emitted after Folio has changed
|
||||||
*/
|
*/
|
||||||
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_;
|
||||||
|
|
||||||
// rectangles used for drawing operations
|
// rectangles used for drawing operations
|
||||||
QRectF diagram_rect_;
|
QRectF diagram_rect_;
|
||||||
|
|
||||||
// display options
|
// display options
|
||||||
|
|||||||
@@ -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,19 +26,26 @@ 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
|
||||||
void numeratePotential ();
|
void numeratePotential ();
|
||||||
void numerateNewConductor ();
|
void numerateNewConductor ();
|
||||||
|
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ bool ConductorNumExport::toCsv()
|
|||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) // ### Qt 6: remove
|
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) // ### Qt 6: remove
|
||||||
stream << wiresNum() << endl;
|
stream << wiresNum() << endl;
|
||||||
#else
|
#else
|
||||||
|
#pragma message("@TODO remove code for QT 5.15 or later")
|
||||||
stream << wiresNum() << &Qt::endl(stream);
|
stream << wiresNum() << &Qt::endl(stream);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -331,12 +331,23 @@ void ConductorProperties::fromXml(QDomElement &e)
|
|||||||
horiz_rotate_text = e.attribute("horizrotatetext").toDouble();
|
horiz_rotate_text = e.attribute("horizrotatetext").toDouble();
|
||||||
|
|
||||||
QMetaEnum me = QMetaEnum::fromType<Qt::Alignment>();
|
QMetaEnum me = QMetaEnum::fromType<Qt::Alignment>();
|
||||||
m_horizontal_alignment = Qt::Alignment(me.keyToValue(e.attribute("horizontal-alignment", "AlignBottom").toStdString().data()));
|
m_horizontal_alignment = Qt::Alignment(
|
||||||
m_vertical_alignment = Qt::Alignment(me.keyToValue(e.attribute("vertical-alignment", "AlignRight").toStdString().data()));
|
me.keyToValue(
|
||||||
|
e.attribute(
|
||||||
|
"horizontal-alignment",
|
||||||
|
"AlignBottom"
|
||||||
|
).toStdString().data()));
|
||||||
|
m_vertical_alignment = Qt::Alignment(
|
||||||
|
me.keyToValue(
|
||||||
|
e.attribute(
|
||||||
|
"vertical-alignment",
|
||||||
|
"AlignRight"
|
||||||
|
).toStdString().data()));
|
||||||
|
|
||||||
//Keep retrocompatible with version older than 0,4
|
//Keep retrocompatible with version older than 0,4
|
||||||
//If the propertie @type is simple (removed since QET 0,4), we set text no visible.
|
//If the propertie @type is simple (removed since QET 0,4), we set text no visible.
|
||||||
//@TODO remove this code for qet 0.6 or later
|
//@TODO remove this code for qet 0.6 or later
|
||||||
|
#pragma message("@TODO remove this code for qet 0.6 or later")
|
||||||
if (e.attribute("type") == "simple") m_show_text = false;
|
if (e.attribute("type") == "simple") m_show_text = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -754,6 +765,7 @@ void ConductorProperties::readStyle(const QString &style_string) {
|
|||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
|
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
|
||||||
QStringList styles = style_string.split(";", QString::SkipEmptyParts);
|
QStringList styles = style_string.split(";", QString::SkipEmptyParts);
|
||||||
#else
|
#else
|
||||||
|
#pragma message("@TODO remove code QString::SkipEmptyParts for QT 5.14 or later")
|
||||||
QStringList styles = style_string.split(";", Qt::SkipEmptyParts);
|
QStringList styles = style_string.split(";", Qt::SkipEmptyParts);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
class QPainter;
|
class QPainter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@brief The SingleLineProperties class
|
||||||
This class represents the properties of a singleline conductor.
|
This class represents the properties of a singleline conductor.
|
||||||
*/
|
*/
|
||||||
class SingleLineProperties {
|
class SingleLineProperties {
|
||||||
@@ -59,6 +60,7 @@ class SingleLineProperties {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@brief The ConductorProperties class
|
||||||
This class represents the functional properties of a particular conductor,
|
This class represents the functional properties of a particular conductor,
|
||||||
i.e. properties other than path and terminals.
|
i.e. properties other than path and terminals.
|
||||||
*/
|
*/
|
||||||
@@ -69,14 +71,15 @@ class ConductorProperties
|
|||||||
virtual ~ConductorProperties();
|
virtual ~ConductorProperties();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The ConductorType enum Represents the kind of a particular conductor:
|
@brief The ConductorType enum Represents
|
||||||
* Single: singleline symbols, no text input
|
the kind of a particular conductor:
|
||||||
* Multi: text input, no symbol
|
Single: singleline symbols, no text input
|
||||||
*/
|
Multi: text input, no symbol
|
||||||
|
*/
|
||||||
enum ConductorType { Single, Multi };
|
enum ConductorType { Single, Multi };
|
||||||
|
|
||||||
|
|
||||||
//Attributes
|
//Attributes
|
||||||
ConductorType type;
|
ConductorType type;
|
||||||
|
|
||||||
QColor color,
|
QColor color,
|
||||||
@@ -108,7 +111,7 @@ class ConductorProperties
|
|||||||
|
|
||||||
SingleLineProperties singleLineProperties;
|
SingleLineProperties singleLineProperties;
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
void toXml(QDomElement &) const;
|
void toXml(QDomElement &) const;
|
||||||
void fromXml(QDomElement &);
|
void fromXml(QDomElement &);
|
||||||
void toSettings(QSettings &, const QString & = QString()) const;
|
void toSettings(QSettings &, const QString & = QString()) const;
|
||||||
@@ -118,7 +121,7 @@ class ConductorProperties
|
|||||||
|
|
||||||
static ConductorProperties defaultProperties();
|
static ConductorProperties defaultProperties();
|
||||||
|
|
||||||
// operators
|
// operators
|
||||||
bool operator==(const ConductorProperties &) const;
|
bool operator==(const ConductorProperties &) const;
|
||||||
bool operator!=(const ConductorProperties &) const;
|
bool operator!=(const ConductorProperties &) const;
|
||||||
|
|
||||||
|
|||||||
@@ -15,46 +15,74 @@
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
#include <QScrollArea>
|
||||||
#include "configdialog.h"
|
#include "configdialog.h"
|
||||||
#include "configpages.h"
|
#include "configpages.h"
|
||||||
#include "qetapp.h"
|
#include "qetapp.h"
|
||||||
|
|
||||||
|
#include "machine_info.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Constructeur
|
Constructeur
|
||||||
@param parent QWidget parent
|
@param parent QWidget parent
|
||||||
*/
|
*/
|
||||||
ConfigDialog::ConfigDialog(QWidget *parent) : QDialog(parent) {
|
ConfigDialog::ConfigDialog(QWidget *parent) : QDialog(parent) {
|
||||||
|
Machine_info *mymachineinfo= new Machine_info(this);
|
||||||
|
//ScrollArea for low screens
|
||||||
|
QScrollArea *scroll = new QScrollArea(this);
|
||||||
|
scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||||
|
scroll->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||||
|
|
||||||
// liste des pages
|
// liste des pages
|
||||||
pages_list = new QListWidget();
|
pages_list = new QListWidget();
|
||||||
pages_list -> setViewMode(QListView::IconMode);
|
pages_list -> setViewMode(QListView::IconMode);
|
||||||
pages_list -> setIconSize(QSize(128, 128));
|
if(mymachineinfo->get_max_screen_height()<1000){
|
||||||
|
pages_list -> setIconSize(QSize(64, 64));
|
||||||
|
} else {
|
||||||
|
pages_list -> setIconSize(QSize(128, 128));
|
||||||
|
}
|
||||||
pages_list -> setMovement(QListView::Static);
|
pages_list -> setMovement(QListView::Static);
|
||||||
pages_list -> setMinimumWidth(168);
|
pages_list -> setMinimumWidth(168);
|
||||||
pages_list -> setMaximumWidth(168);
|
pages_list -> setMaximumWidth(168);
|
||||||
pages_list -> setSpacing(16);
|
pages_list -> setSpacing(16);
|
||||||
pages_list -> setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
pages_list -> setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
|
|
||||||
// pages
|
// pages
|
||||||
pages_widget = new QStackedWidget();
|
pages_widget = new QStackedWidget();
|
||||||
|
|
||||||
// boutons
|
// boutons
|
||||||
buttons = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
|
buttons = new QDialogButtonBox(
|
||||||
|
QDialogButtonBox::Ok
|
||||||
|
|QDialogButtonBox::Cancel);
|
||||||
|
|
||||||
|
|
||||||
|
QWidget *viewport = new QWidget(this);
|
||||||
|
scroll->setWidget(viewport);
|
||||||
|
scroll->setWidgetResizable(true);
|
||||||
|
|
||||||
// layouts
|
// layouts
|
||||||
QHBoxLayout *hlayout1 = new QHBoxLayout();
|
QHBoxLayout *hlayout1 = new QHBoxLayout(viewport);
|
||||||
|
// add needed widgets to layout "hlayout1"
|
||||||
hlayout1 -> addWidget(pages_list);
|
hlayout1 -> addWidget(pages_list);
|
||||||
hlayout1 -> addWidget(pages_widget);
|
hlayout1 -> addWidget(pages_widget);
|
||||||
|
|
||||||
QVBoxLayout *vlayout1 = new QVBoxLayout();
|
//add hlayout1 to widget
|
||||||
vlayout1 -> addLayout(hlayout1);
|
viewport->setLayout(hlayout1);
|
||||||
vlayout1 -> addWidget(buttons);
|
|
||||||
setLayout(vlayout1);
|
// Add a layout for QDialog
|
||||||
|
QVBoxLayout *dialog_layout = new QVBoxLayout(this);
|
||||||
|
dialog_layout->addWidget(scroll); // add scroll to the QDialog's layout
|
||||||
|
dialog_layout -> addWidget(buttons);
|
||||||
|
setLayout(dialog_layout);
|
||||||
|
|
||||||
// connexion signaux / slots
|
// connexion signaux / slots
|
||||||
connect(buttons, SIGNAL(accepted()), this, SLOT(applyConf()));
|
connect(buttons, SIGNAL(accepted()), this, SLOT(applyConf()));
|
||||||
connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
|
connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
|
||||||
connect(pages_list, SIGNAL(currentRowChanged(int)), pages_widget, SLOT(setCurrentIndex(int)));
|
connect(pages_list, SIGNAL(currentRowChanged(int)),
|
||||||
|
pages_widget, SLOT(setCurrentIndex(int)));
|
||||||
|
|
||||||
|
resize(mymachineinfo->get_max_screen_width(),
|
||||||
|
mymachineinfo->get_max_screen_height());
|
||||||
|
|
||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
if (parent) {
|
if (parent) {
|
||||||
setWindowFlags(Qt::Sheet);
|
setWindowFlags(Qt::Sheet);
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ ElementQueryWidget::ElementQueryWidget(QWidget *parent) :
|
|||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) // ### Qt 6: remove
|
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) // ### Qt 6: remove
|
||||||
connect(&m_button_group, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), [this](int id)
|
connect(&m_button_group, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), [this](int id)
|
||||||
#else
|
#else
|
||||||
|
#pragma message("@TODO remove code for QT 5.15 or later")
|
||||||
connect(&m_button_group, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::idClicked), [this](int id)
|
connect(&m_button_group, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::idClicked), [this](int id)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1141,6 +1141,7 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
|
|||||||
content_ptr -> m_images = added_images.toSet();
|
content_ptr -> m_images = added_images.toSet();
|
||||||
content_ptr -> m_shapes = added_shapes.toSet();
|
content_ptr -> m_shapes = added_shapes.toSet();
|
||||||
#else
|
#else
|
||||||
|
#pragma message("@TODO remove code for QT 5.14 or later")
|
||||||
content_ptr -> m_text_fields = QSet<IndependentTextItem *>(
|
content_ptr -> m_text_fields = QSet<IndependentTextItem *>(
|
||||||
added_texts.begin(),
|
added_texts.begin(),
|
||||||
added_texts.end());
|
added_texts.end());
|
||||||
|
|||||||
@@ -416,6 +416,7 @@ void ChangeZValueCommand::applyRaise(const QList<QGraphicsItem *> &items_list) {
|
|||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0) // ### Qt 6: remove
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0) // ### Qt 6: remove
|
||||||
my_items_list.swap(i, i + 1);
|
my_items_list.swap(i, i + 1);
|
||||||
#else
|
#else
|
||||||
|
#pragma message("@TODO remove code for QT 5.13 or later")
|
||||||
my_items_list.swapItemsAt(i, i + 1);
|
my_items_list.swapItemsAt(i, i + 1);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -438,6 +439,7 @@ void ChangeZValueCommand::applyLower(const QList<QGraphicsItem *> &items_list) {
|
|||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0) // ### Qt 6: remove
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0) // ### Qt 6: remove
|
||||||
my_items_list.swap(i, i - 1);
|
my_items_list.swap(i, i - 1);
|
||||||
#else
|
#else
|
||||||
|
#pragma message("@TODO remove code for QT 5.13 or later")
|
||||||
my_items_list.swapItemsAt(i, i - 1);
|
my_items_list.swapItemsAt(i, i - 1);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -498,6 +498,7 @@ void CustomElementGraphicPart::stylesFromXml(const QDomElement &qde)
|
|||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
|
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
|
||||||
QStringList styles = qde.attribute("style").split(";", QString::SkipEmptyParts);
|
QStringList styles = qde.attribute("style").split(";", QString::SkipEmptyParts);
|
||||||
#else
|
#else
|
||||||
|
#pragma message("@TODO remove code for QT 5.14 or later")
|
||||||
QStringList styles = qde.attribute("style").split(";", Qt::SkipEmptyParts);
|
QStringList styles = qde.attribute("style").split(";", Qt::SkipEmptyParts);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -51,8 +51,9 @@ ElementsCollectionCache::ElementsCollectionCache(const QString &database_path, Q
|
|||||||
cache_db_.exec("PRAGMA locking_mode = EXCLUSIVE");
|
cache_db_.exec("PRAGMA locking_mode = EXCLUSIVE");
|
||||||
cache_db_.exec("PRAGMA synchronous = OFF");
|
cache_db_.exec("PRAGMA synchronous = OFF");
|
||||||
|
|
||||||
//TODO This code remove old table with mtime for create table with uuid, created at version 0,5
|
//TODO This code remove old table with mtime for create table with uuid, created at version 0,5
|
||||||
//see to remove this code at version 0,6 or 0,7 when all users will table with uuid.
|
//see to remove this code at version 0,6 or 0,7 when all users will table with uuid.
|
||||||
|
#pragma message("@TODO remove this code for qet 0.6 or later")
|
||||||
QSqlQuery table_name(cache_db_);
|
QSqlQuery table_name(cache_db_);
|
||||||
if (table_name.exec("PRAGMA table_info(names)"))
|
if (table_name.exec("PRAGMA table_info(names)"))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -559,6 +559,7 @@ void ElementPictureFactory::setPainterStyle(const QDomElement &dom, QPainter &pa
|
|||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
|
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
|
||||||
const QStringList styles = dom.attribute("style").split(";", QString::SkipEmptyParts);
|
const QStringList styles = dom.attribute("style").split(";", QString::SkipEmptyParts);
|
||||||
#else
|
#else
|
||||||
|
#pragma message("@TODO remove code for QT 5.14 or later")
|
||||||
const QStringList styles = dom.attribute("style").split(";", Qt::SkipEmptyParts);
|
const QStringList styles = dom.attribute("style").split(";", Qt::SkipEmptyParts);
|
||||||
#endif
|
#endif
|
||||||
QRegExp rx("^\\s*([a-z-]+)\\s*:\\s*([a-zA-Z-]+)\\s*$");
|
QRegExp rx("^\\s*([a-z-]+)\\s*:\\s*([a-zA-Z-]+)\\s*$");
|
||||||
|
|||||||
85
sources/machine_info.cpp
Normal file
85
sources/machine_info.cpp
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
/*
|
||||||
|
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/>.
|
||||||
|
*/
|
||||||
|
#include "machine_info.h"
|
||||||
|
#include <QScreen>
|
||||||
|
#include <QApplication>
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Machine_info::Machine_info
|
||||||
|
@param parent
|
||||||
|
*/
|
||||||
|
Machine_info::Machine_info(QObject *parent) : QObject(parent)
|
||||||
|
{
|
||||||
|
init_get_Screen_info();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Machine_info::init_get_Screen_info
|
||||||
|
Finds the largest screen and saves the values
|
||||||
|
*/
|
||||||
|
void Machine_info::init_get_Screen_info()
|
||||||
|
{
|
||||||
|
const auto screens = qApp->screens();
|
||||||
|
for (int ii = 0; ii < screens.count(); ++ii)
|
||||||
|
{
|
||||||
|
if(
|
||||||
|
Max_screen_width
|
||||||
|
<
|
||||||
|
screens[ii]->geometry().width()
|
||||||
|
*
|
||||||
|
screens[ii]->devicePixelRatio()
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Max_screen_width =
|
||||||
|
screens[ii]->geometry().width()
|
||||||
|
*
|
||||||
|
screens[ii]->devicePixelRatio();
|
||||||
|
}
|
||||||
|
if(
|
||||||
|
Max_screen_height
|
||||||
|
<
|
||||||
|
screens[ii]->geometry().height()
|
||||||
|
*
|
||||||
|
screens[ii]->devicePixelRatio()
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Max_screen_height =
|
||||||
|
screens[ii]->geometry().height()
|
||||||
|
*
|
||||||
|
screens[ii]->devicePixelRatio();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Machine_info::get_max_screen_width
|
||||||
|
@return max screen width
|
||||||
|
*/
|
||||||
|
int32_t Machine_info::get_max_screen_width()
|
||||||
|
{
|
||||||
|
return Max_screen_width;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Machine_info::get_max_screen_height
|
||||||
|
@return max screen height
|
||||||
|
*/
|
||||||
|
int32_t Machine_info::get_max_screen_height()
|
||||||
|
{
|
||||||
|
return Max_screen_height;
|
||||||
|
}
|
||||||
45
sources/machine_info.h
Normal file
45
sources/machine_info.h
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
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/>.
|
||||||
|
*/
|
||||||
|
#ifndef MACHINE_INFO_H
|
||||||
|
#define MACHINE_INFO_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief The Machine_info class
|
||||||
|
This class hold information from your PC.
|
||||||
|
*/
|
||||||
|
class Machine_info : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit Machine_info(QObject *parent = nullptr);
|
||||||
|
int32_t get_max_screen_width();
|
||||||
|
int32_t get_max_screen_height();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
private:
|
||||||
|
void init_get_Screen_info();
|
||||||
|
int32_t Max_screen_width;
|
||||||
|
int32_t Max_screen_height;
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MACHINE_INFO_H
|
||||||
@@ -22,29 +22,32 @@
|
|||||||
#include <QStyleFactory>
|
#include <QStyleFactory>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief main
|
@brief main
|
||||||
* Main function of QElectroTech
|
Main function of QElectroTech
|
||||||
* @param argc : number of paramètres
|
@param argc : number of parameters
|
||||||
* @param argv : paramètres
|
\~French number of paramètres
|
||||||
* @return
|
\~ @param argv : parameters
|
||||||
*/
|
\~French paramètres
|
||||||
|
\~ @return exit code
|
||||||
|
*/
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
//Some setup, notably to use with QSetting.
|
//Some setup, notably to use with QSetting.
|
||||||
QCoreApplication::setOrganizationName("QElectroTech");
|
QCoreApplication::setOrganizationName("QElectroTech");
|
||||||
QCoreApplication::setOrganizationDomain("qelectrotech.org");
|
QCoreApplication::setOrganizationDomain("qelectrotech.org");
|
||||||
QCoreApplication::setApplicationName("QElectroTech");
|
QCoreApplication::setApplicationName("QElectroTech");
|
||||||
//Creation and execution of the application
|
//Creation and execution of the application
|
||||||
//HighDPI
|
//HighDPI
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
||||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
#pragma message("@TODO remove code for QT 5.6 or later")
|
||||||
|
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||||
#else
|
#else
|
||||||
qputenv("QT_DEVICE_PIXEL_RATIO", QByteArray("auto"));
|
qputenv("QT_DEVICE_PIXEL_RATIO", QByteArray("auto"));
|
||||||
#endif
|
#endif
|
||||||
SingleApplication app(argc, argv, true);
|
SingleApplication app(argc, argv, true);
|
||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
//Handle the opening of QET when user double click on a .qet .elmt .tbt file
|
//Handle the opening of QET when user double click on a .qet .elmt .tbt file
|
||||||
//or drop these same files to the QET icon of the dock
|
//or drop these same files to the QET icon of the dock
|
||||||
MacOSXOpenEvent open_event;
|
MacOSXOpenEvent open_event;
|
||||||
app.installEventFilter(&open_event);
|
app.installEventFilter(&open_event);
|
||||||
app.setStyle(QStyleFactory::create("Fusion"));
|
app.setStyle(QStyleFactory::create("Fusion"));
|
||||||
@@ -53,17 +56,19 @@ int main(int argc, char **argv)
|
|||||||
if (app.isSecondary())
|
if (app.isSecondary())
|
||||||
{
|
{
|
||||||
QStringList arg_list = app.arguments();
|
QStringList arg_list = app.arguments();
|
||||||
//Remove the first argument, it's the binary file
|
//Remove the first argument, it's the binary file
|
||||||
arg_list.takeFirst();
|
arg_list.takeFirst();
|
||||||
QETArguments qetarg(arg_list);
|
QETArguments qetarg(arg_list);
|
||||||
QString message = "launched-with-args: " + QET::joinWithSpaces(QStringList(qetarg.arguments()));
|
QString message = "launched-with-args: " + QET::joinWithSpaces(
|
||||||
|
QStringList(qetarg.arguments()));
|
||||||
app.sendMessage(message.toUtf8());
|
app.sendMessage(message.toUtf8());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
QETApp qetapp;
|
QETApp qetapp;
|
||||||
QETApp::instance()->installEventFilter(&qetapp);
|
QETApp::instance()->installEventFilter(&qetapp);
|
||||||
QObject::connect(&app, &SingleApplication::receivedMessage, &qetapp, &QETApp::receiveMessage);
|
QObject::connect(&app, &SingleApplication::receivedMessage,
|
||||||
|
&qetapp, &QETApp::receiveMessage);
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ bool nomenclature::saveToCSVFile()
|
|||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) // ### Qt 6: remove
|
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) // ### Qt 6: remove
|
||||||
stream << getNomenclature() << endl;
|
stream << getNomenclature() << endl;
|
||||||
#else
|
#else
|
||||||
|
#pragma message("@TODO remove code for QT 5.15 or later")
|
||||||
stream << getNomenclature() << &Qt::endl(stream);
|
stream << getNomenclature() << &Qt::endl(stream);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,16 @@
|
|||||||
*/
|
*/
|
||||||
#include "propertiesinterface.h"
|
#include "propertiesinterface.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief PropertiesInterface::PropertiesInterface
|
||||||
|
*/
|
||||||
PropertiesInterface::PropertiesInterface()
|
PropertiesInterface::PropertiesInterface()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
@brief PropertiesInterface::~PropertiesInterface
|
||||||
|
*/
|
||||||
|
PropertiesInterface::~PropertiesInterface()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -23,19 +23,45 @@
|
|||||||
#include <QDomElement>
|
#include <QDomElement>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The PropertiesInterface class
|
@brief The PropertiesInterface class
|
||||||
* This class is an interface for have common way to use properties in QElectroTech
|
This class is an interface for have common way
|
||||||
*/
|
to use properties in QElectroTech
|
||||||
|
*/
|
||||||
class PropertiesInterface
|
class PropertiesInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PropertiesInterface();
|
PropertiesInterface();
|
||||||
// Save/load properties to setting file. QString is use for prefix a word befor the name of each paramètre
|
virtual ~PropertiesInterface();
|
||||||
virtual void toSettings (QSettings &settings, const QString = QString()) const =0;
|
/**
|
||||||
virtual void fromSettings (const QSettings &settings, const QString = QString()) =0;
|
@brief toSettings
|
||||||
// Save/load properties to xml element
|
Save properties to setting file.
|
||||||
virtual QDomElement toXml (QDomDocument &xml_document) const =0;
|
@param settings : is use for prefix a word
|
||||||
virtual bool fromXml (const QDomElement &xml_element) =0;
|
befor the name of each paramètre
|
||||||
|
*/
|
||||||
|
virtual void toSettings (QSettings &settings,
|
||||||
|
const QString = QString()) const =0;
|
||||||
|
/**
|
||||||
|
@brief fromSettings
|
||||||
|
load properties to setting file.
|
||||||
|
@param settings : is use for prefix a word
|
||||||
|
befor the name of each paramètre
|
||||||
|
*/
|
||||||
|
virtual void fromSettings (const QSettings &settings,
|
||||||
|
const QString = QString()) =0;
|
||||||
|
/**
|
||||||
|
@brief toXml
|
||||||
|
Save properties to xml element
|
||||||
|
@param xml_document
|
||||||
|
@return QDomElement
|
||||||
|
*/
|
||||||
|
virtual QDomElement toXml (QDomDocument &xml_document) const =0;
|
||||||
|
/**
|
||||||
|
@brief fromXml
|
||||||
|
load properties to xml element
|
||||||
|
@param xml_element
|
||||||
|
@return true / false
|
||||||
|
*/
|
||||||
|
virtual bool fromXml (const QDomElement &xml_element) =0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PROPERTIESINTERFACE_H
|
#endif // PROPERTIESINTERFACE_H
|
||||||
|
|||||||
@@ -20,6 +20,9 @@
|
|||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief The ReportProperties class
|
||||||
|
*/
|
||||||
class ReportProperties
|
class ReportProperties
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -3,16 +3,16 @@
|
|||||||
#include <QGraphicsObject>
|
#include <QGraphicsObject>
|
||||||
|
|
||||||
TerminalData::TerminalData():
|
TerminalData::TerminalData():
|
||||||
PropertiesInterface()
|
PropertiesInterface()
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
TerminalData::TerminalData(QGraphicsObject *parent):
|
TerminalData::TerminalData(QGraphicsObject *parent):
|
||||||
PropertiesInterface(),
|
PropertiesInterface(),
|
||||||
q(parent)
|
q(parent)
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TerminalData::init() {
|
void TerminalData::init() {
|
||||||
@@ -23,65 +23,114 @@ TerminalData::~TerminalData()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief TerminalData::setParent
|
||||||
|
@param parent
|
||||||
|
*/
|
||||||
void TerminalData::setParent(QGraphicsObject* parent)
|
void TerminalData::setParent(QGraphicsObject* parent)
|
||||||
{
|
{
|
||||||
q = parent;
|
q = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief TerminalData::toSettings
|
||||||
|
Save properties to setting file.
|
||||||
|
|
||||||
|
QString is use for prefix a word befor the name of each paramètre
|
||||||
|
@param settings UNUSED
|
||||||
|
*/
|
||||||
void TerminalData::toSettings(QSettings &settings, const QString) const
|
void TerminalData::toSettings(QSettings &settings, const QString) const
|
||||||
|
|
||||||
{
|
{
|
||||||
Q_UNUSED(settings);
|
Q_UNUSED(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief TerminalData::fromSettings
|
||||||
|
load properties to setting file.
|
||||||
|
|
||||||
|
QString is use for prefix a word befor the name of each paramètre
|
||||||
|
@param settings UNUSED
|
||||||
|
*/
|
||||||
void TerminalData::fromSettings(const QSettings &settings, const QString)
|
void TerminalData::fromSettings(const QSettings &settings, const QString)
|
||||||
{
|
{
|
||||||
Q_UNUSED(settings);
|
Q_UNUSED(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief TerminalData::toXml
|
||||||
|
Save properties to xml element
|
||||||
|
write the name, number, position and orientation of the terminal
|
||||||
|
to xml_element
|
||||||
|
|
||||||
|
@note This method is only called from the PartTerminal
|
||||||
|
and should never called from the Terminal class
|
||||||
|
@param xml_document
|
||||||
|
@return xml_element : DomElement with
|
||||||
|
the name, number, position and orientation of the terminal
|
||||||
|
*/
|
||||||
QDomElement TerminalData::toXml(QDomDocument &xml_document) const
|
QDomElement TerminalData::toXml(QDomDocument &xml_document) const
|
||||||
{
|
{
|
||||||
QDomElement xml_element = xml_document.createElement("terminal");
|
QDomElement xml_element = xml_document.createElement("terminal");
|
||||||
|
|
||||||
// ecrit la position de la borne
|
// write the position of the terminal
|
||||||
xml_element.setAttribute("x", QString("%1").arg(q->scenePos().x()));
|
// ecrit la position de la borne
|
||||||
xml_element.setAttribute("y", QString("%1").arg(q->scenePos().y()));
|
xml_element.setAttribute("x", QString("%1").arg(q->scenePos().x()));
|
||||||
|
xml_element.setAttribute("y", QString("%1").arg(q->scenePos().y()));
|
||||||
|
|
||||||
|
// Write name and number to XML
|
||||||
|
xml_element.setAttribute("uuid", m_uuid.toString());
|
||||||
|
xml_element.setAttribute("name", m_name);
|
||||||
|
|
||||||
xml_element.setAttribute("uuid", m_uuid.toString());
|
// write the orientation of the terminal
|
||||||
xml_element.setAttribute("name", m_name);
|
// ecrit l'orientation de la borne
|
||||||
|
xml_element.setAttribute("orientation",
|
||||||
|
Qet::orientationToString(m_orientation));
|
||||||
|
|
||||||
// ecrit l'orientation de la borne
|
return(xml_element);
|
||||||
xml_element.setAttribute("orientation", Qet::orientationToString(m_orientation));
|
|
||||||
// Write name and number to XML
|
|
||||||
|
|
||||||
return(xml_element);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief TerminalData::fromXml
|
||||||
|
load properties to xml element
|
||||||
|
|
||||||
|
@note This method is only called from the PartTerminal
|
||||||
|
and should never called from the Terminal class
|
||||||
|
@param xml_element
|
||||||
|
@return true if succeeded / false if the attribute is not real
|
||||||
|
*/
|
||||||
bool TerminalData::fromXml (const QDomElement &xml_element)
|
bool TerminalData::fromXml (const QDomElement &xml_element)
|
||||||
{
|
{
|
||||||
// lit la position de la borne
|
qreal term_x = 0.0;
|
||||||
qreal term_x = 0.0, term_y = 0.0;
|
qreal term_y = 0.0;
|
||||||
if (!QET::attributeIsAReal(xml_element, "x", &term_x))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!QET::attributeIsAReal(xml_element, "y", &term_y))
|
// reads the position of the terminal
|
||||||
return false;
|
// lit la position de la borne
|
||||||
|
if (!QET::attributeIsAReal(xml_element, "x", &term_x))
|
||||||
|
return false;
|
||||||
|
|
||||||
m_pos = QPointF(term_x, term_y);
|
if (!QET::attributeIsAReal(xml_element, "y", &term_y))
|
||||||
|
return false;
|
||||||
|
|
||||||
//emit posFromXML(QPointF(term_x, term_y));
|
m_pos = QPointF(term_x, term_y);
|
||||||
|
|
||||||
QString uuid = xml_element.attribute("uuid");
|
//emit posFromXML(QPointF(term_x, term_y));
|
||||||
// update part and add uuid, which is used in the new version to connect terminals together
|
|
||||||
// if the attribute not exists, means, the element is created with an older version of qet. So use the legacy approach
|
|
||||||
// to identify terminals
|
|
||||||
if (!uuid.isEmpty())
|
|
||||||
m_uuid = QUuid(uuid);
|
|
||||||
|
|
||||||
m_name = xml_element.attribute("name");
|
QString uuid = xml_element.attribute("uuid");
|
||||||
|
// update part and add uuid, which is used in the new version
|
||||||
|
// to connect terminals together
|
||||||
|
// if the attribute not exists, means, the element is created with an
|
||||||
|
// older version of qet. So use the legacy approach
|
||||||
|
// to identify terminals
|
||||||
|
if (!uuid.isEmpty())
|
||||||
|
m_uuid = QUuid(uuid);
|
||||||
|
|
||||||
// lit l'orientation de la borne
|
m_name = xml_element.attribute("name");
|
||||||
m_orientation = Qet::orientationFromString(xml_element.attribute("orientation"));
|
|
||||||
|
|
||||||
return true;
|
// read the orientation of the terminal
|
||||||
|
// lit l'orientation de la borne
|
||||||
|
m_orientation = Qet::orientationFromString(
|
||||||
|
xml_element.attribute("orientation"));
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,62 +18,70 @@ class QGraphicsObject;
|
|||||||
*/
|
*/
|
||||||
class TerminalData : public PropertiesInterface
|
class TerminalData : public PropertiesInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TerminalData();
|
TerminalData();
|
||||||
TerminalData(QGraphicsObject* parent);
|
TerminalData(QGraphicsObject* parent);
|
||||||
~TerminalData();
|
~TerminalData();
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
void setParent(QGraphicsObject* parent);
|
void setParent(QGraphicsObject* parent);
|
||||||
|
void toSettings(QSettings &settings,
|
||||||
|
const QString = QString()) const override;
|
||||||
|
void fromSettings(const QSettings &settings,
|
||||||
|
const QString = QString()) override;
|
||||||
|
QDomElement toXml(QDomDocument &xml_element) const override;
|
||||||
|
bool fromXml(const QDomElement &xml_element) override;
|
||||||
|
|
||||||
// Save/load properties to setting file. QString is use for prefix a word befor the name of each paramètre
|
// must be public, because this class is a private member
|
||||||
void toSettings(QSettings &settings, const QString = QString()) const override;
|
// of PartTerminal/Terminal and they must access this data
|
||||||
void fromSettings(const QSettings &settings, const QString = QString()) override;
|
public:
|
||||||
// Save/load properties to xml element
|
/**
|
||||||
// This method is only called from the PartTerminal and should never called from the Terminal class
|
@brief m_orientation
|
||||||
QDomElement toXml(QDomDocument &xml_element) const override;
|
Orientation of the terminal
|
||||||
bool fromXml(const QDomElement &xml_element) override;
|
*/
|
||||||
|
Qet::Orientation m_orientation;
|
||||||
|
/**
|
||||||
|
@brief second_point
|
||||||
|
Position of the second point of the terminal
|
||||||
|
in scene coordinates
|
||||||
|
*/
|
||||||
|
QPointF second_point;
|
||||||
|
/**
|
||||||
|
@brief m_uuid
|
||||||
|
Uuid of the terminal.
|
||||||
|
|
||||||
// must be public, because this class is a private member of PartTerminal/Terminal and they must
|
In elementscene.cpp an element gets a new uuid when
|
||||||
// access this data
|
saving the element. In the current state
|
||||||
public:
|
each connection is made by using the local position
|
||||||
/*!
|
of the terminal and a dynamic id. In the new
|
||||||
* \brief m_orientation
|
case, each terminal should have it's own uuid to
|
||||||
* Orientation of the terminal
|
identify it uniquely. When changing each time this
|
||||||
*/
|
uuid, the conductor after updating the part is anymore
|
||||||
Qet::Orientation m_orientation;
|
valid. So if in the loaded document a uuid exists,
|
||||||
/*!
|
use this one and don't create a new one.
|
||||||
* \brief second_point
|
*/
|
||||||
* Position of the second point of the terminal in scene coordinates
|
QUuid m_uuid;
|
||||||
*/
|
/**
|
||||||
QPointF second_point;
|
@brief m_name
|
||||||
/*!
|
Name of the element.
|
||||||
* \brief m_uuid
|
It can be used to create wiring harness tables
|
||||||
* Uuid of the terminal.
|
*/
|
||||||
*
|
QString m_name;
|
||||||
* In elementscene.cpp an element gets a new uuid when saving the element. In the current state
|
|
||||||
* each connection is made by using the local position of the terminal and a dynamic id. In the new
|
|
||||||
* case, each terminal should have it's own uuid to identify it uniquely. When changing each time this
|
|
||||||
* uuid, the conductor after updating the part is anymore valid. So if in the loaded document a uuid exists,
|
|
||||||
* use this one and don't create a new one.
|
|
||||||
*/
|
|
||||||
QUuid m_uuid;
|
|
||||||
/*!
|
|
||||||
* \brief m_name
|
|
||||||
* Name of the element. It can be used to create wiring harness tables
|
|
||||||
*/
|
|
||||||
QString m_name;
|
|
||||||
|
|
||||||
/*!
|
/**
|
||||||
* \brief m_pos
|
@brief m_pos
|
||||||
* Position of the terminal. The second point is calculated from this position and the orientation
|
Position of the terminal. The second point is calculated
|
||||||
* Important: this variable is only updated during read from xml and not during mouse move!
|
from this position and the orientation
|
||||||
* It is used to store the initial position so that PartTerminal and Terminal have access to it.
|
@note
|
||||||
*/
|
Important: this variable is only updated during read
|
||||||
QPointF m_pos;
|
from xml and not during mouse move!
|
||||||
private:
|
It is used to store the initial position so that
|
||||||
QGraphicsObject* q{nullptr};
|
PartTerminal and Terminal have access to it.
|
||||||
|
*/
|
||||||
|
QPointF m_pos;
|
||||||
|
private:
|
||||||
|
QGraphicsObject* q{nullptr};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TERMINALDATA_H
|
#endif // TERMINALDATA_H
|
||||||
|
|||||||
@@ -176,6 +176,7 @@ bool QET::orthogonalProjection(const QPointF &point, const QLineF &line, QPointF
|
|||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
||||||
QLineF::IntersectType it = line.intersect(perpendicular_line, &intersection_point); // ### Qt 6: remove
|
QLineF::IntersectType it = line.intersect(perpendicular_line, &intersection_point); // ### Qt 6: remove
|
||||||
#else
|
#else
|
||||||
|
#pragma message("@TODO remove code for QT 5.14 or later")
|
||||||
QLineF::IntersectType it = line.intersects(perpendicular_line, &intersection_point);
|
QLineF::IntersectType it = line.intersects(perpendicular_line, &intersection_point);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -450,6 +451,7 @@ QStringList QET::splitWithSpaces(const QString &string) {
|
|||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
|
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
|
||||||
QStringList escaped_strings = string.split(QRegExp("[^\\]?(?:\\\\)* "), QString::SkipEmptyParts);
|
QStringList escaped_strings = string.split(QRegExp("[^\\]?(?:\\\\)* "), QString::SkipEmptyParts);
|
||||||
#else
|
#else
|
||||||
|
#pragma message("@TODO remove code for QT 5.14 or later")
|
||||||
QStringList escaped_strings = string.split(QRegExp("[^\\]?(?:\\\\)* "), Qt::SkipEmptyParts);
|
QStringList escaped_strings = string.split(QRegExp("[^\\]?(?:\\\\)* "), Qt::SkipEmptyParts);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -2220,19 +2220,19 @@ void QETDiagramEditor::generateTerminalBlock()
|
|||||||
success = process->startDetached("qet_tb_generator", {(QETDiagramEditor::currentProjectView()->project()->filePath())});
|
success = process->startDetached("qet_tb_generator", {(QETDiagramEditor::currentProjectView()->project()->filePath())});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
success = process->startDetached("qet_tb_generator");
|
success = process->startDetached("qet_tb_generator", {("")});
|
||||||
}
|
}
|
||||||
if (openedProjects().count()){
|
if (openedProjects().count()){
|
||||||
success = process->startDetached(QDir::homePath() + "/Application Data/qet/qet_tb_generator.exe", {(QETDiagramEditor::currentProjectView()->project()->filePath())});
|
success = process->startDetached(QDir::homePath() + "/Application Data/qet/qet_tb_generator.exe", {(QETDiagramEditor::currentProjectView()->project()->filePath())});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
success = process->startDetached(QDir::homePath() + "/Application Data/qet/qet_tb_generator.exe");
|
success = process->startDetached(QDir::homePath() + "/Application Data/qet/qet_tb_generator.exe", {("")});
|
||||||
}
|
}
|
||||||
if (openedProjects().count()){
|
if (openedProjects().count()){
|
||||||
success = process->startDetached(QDir::homePath() + "/qet_tb_generator.exe", {(QETDiagramEditor::currentProjectView()->project()->filePath())});
|
success = process->startDetached(QDir::homePath() + "/qet_tb_generator.exe", {(QETDiagramEditor::currentProjectView()->project()->filePath())});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
success = process->startDetached(QDir::homePath() + "/qet_tb_generator.exe");
|
success = process->startDetached(QDir::homePath() + "/qet_tb_generator.exe", {("")});
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(Q_OS_MAC)
|
#elif defined(Q_OS_MAC)
|
||||||
@@ -2240,13 +2240,13 @@ void QETDiagramEditor::generateTerminalBlock()
|
|||||||
success = process->startDetached("/Library/Frameworks/Python.framework/Versions/3.8/bin/qet_tb_generator", {(QETDiagramEditor::currentProjectView()->project()->filePath())});
|
success = process->startDetached("/Library/Frameworks/Python.framework/Versions/3.8/bin/qet_tb_generator", {(QETDiagramEditor::currentProjectView()->project()->filePath())});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
success = process->startDetached("/Library/Frameworks/Python.framework/Versions/3.8/bin/qet_tb_generator");
|
success = process->startDetached("/Library/Frameworks/Python.framework/Versions/3.8/bin/qet_tb_generator", {("")});
|
||||||
}
|
}
|
||||||
if (openedProjects().count()){
|
if (openedProjects().count()){
|
||||||
success = process->startDetached(QDir::homePath() + "/.qet/qet_tb_generator.app", {(QETDiagramEditor::currentProjectView()->project()->filePath())});
|
success = process->startDetached(QDir::homePath() + "/.qet/qet_tb_generator.app", {(QETDiagramEditor::currentProjectView()->project()->filePath())});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
success = process->startDetached(QDir::homePath() + "/.qet/qet_tb_generator.app");
|
success = process->startDetached(QDir::homePath() + "/.qet/qet_tb_generator.app", {("")});
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@@ -2254,13 +2254,13 @@ void QETDiagramEditor::generateTerminalBlock()
|
|||||||
success = process->startDetached("qet_tb_generator", {(QETDiagramEditor::currentProjectView()->project()->filePath())});
|
success = process->startDetached("qet_tb_generator", {(QETDiagramEditor::currentProjectView()->project()->filePath())});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
success = process->startDetached("qet_tb_generator");
|
success = process->startDetached("qet_tb_generator", {("")});
|
||||||
}
|
}
|
||||||
if (openedProjects().count()){
|
if (openedProjects().count()){
|
||||||
success = process->startDetached(QDir::homePath() + "/.qet/qet_tb_generator", {(QETDiagramEditor::currentProjectView()->project()->filePath())});
|
success = process->startDetached(QDir::homePath() + "/.qet/qet_tb_generator", {(QETDiagramEditor::currentProjectView()->project()->filePath())});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
success = process->startDetached(QDir::homePath() + "/.qet/qet_tb_generator");
|
success = process->startDetached(QDir::homePath() + "/.qet/qet_tb_generator", {("")});
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -309,8 +309,6 @@ void ProjectDBModel::dataBaseUpdated()
|
|||||||
auto new_record = m_record;
|
auto new_record = m_record;
|
||||||
m_record = original_record;
|
m_record = original_record;
|
||||||
|
|
||||||
//This a very special case, if this nomenclature model is added
|
|
||||||
//befor any element, column count return 0, so in this case we emit column inserted
|
|
||||||
if (new_record.size() != m_record.size())
|
if (new_record.size() != m_record.size())
|
||||||
{
|
{
|
||||||
emit beginResetModel();
|
emit beginResetModel();
|
||||||
|
|||||||
@@ -61,6 +61,56 @@ void QetGraphicsTableItem::adjustTableToFolio(QetGraphicsTableItem *table, QMarg
|
|||||||
table->setDisplayNRow(int(floor(available_height/min_row_height))); //Convert a double to int, but max_row_to_display is already rounded an integer so we assume everything is ok
|
table->setDisplayNRow(int(floor(available_height/min_row_height))); //Convert a double to int, but max_row_to_display is already rounded an integer so we assume everything is ok
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief QetGraphicsTableItem::checkInsufficientRowsCount
|
||||||
|
* Check if the number of rows of @table + linked table is enough to display all
|
||||||
|
* content of the model, if not open a dialog to advise user what to do.
|
||||||
|
* @param table
|
||||||
|
*/
|
||||||
|
void QetGraphicsTableItem::checkInsufficientRowsCount(QetGraphicsTableItem *table)
|
||||||
|
{
|
||||||
|
if (!table->diagram() || !table->model()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto first_table = table;
|
||||||
|
while (first_table->previousTable())
|
||||||
|
first_table = first_table->previousTable();
|
||||||
|
|
||||||
|
if (first_table->displayNRow() <= 0) //displayed rows is unlimited
|
||||||
|
return;
|
||||||
|
|
||||||
|
int count_ = first_table->displayNRow();
|
||||||
|
bool several_table = false;
|
||||||
|
while (first_table->nextTable())
|
||||||
|
{
|
||||||
|
several_table = true;
|
||||||
|
first_table = first_table->nextTable();
|
||||||
|
if (first_table->displayNRow() <= 0) { //displayed rows is unlimited
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
count_ += first_table->displayNRow();
|
||||||
|
first_table->displayNRowOffset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count_ < first_table->model()->rowCount())
|
||||||
|
{
|
||||||
|
QWidget *parent = first_table->diagram()->views().first() ? first_table->diagram()->views().first() : nullptr;
|
||||||
|
|
||||||
|
QString text;
|
||||||
|
if (several_table) {
|
||||||
|
text = tr("Les information à afficher sont supérieurs à la quantité maximal pouvant être affiché par les tableaux.\n"
|
||||||
|
"Veuillez ajouter un nouveau tableau ou regler les tableaux existant afin d'afficher l'integralité des informations.");
|
||||||
|
} else {
|
||||||
|
text = tr("Les information à afficher sont supérieurs à la quantité maximal pouvant être affiché par le tableau.\n"
|
||||||
|
"Veuillez ajouter un nouveau tableau ou regler le tableau existant afin d'afficher l'integralité des informations.");
|
||||||
|
}
|
||||||
|
QMessageBox::information(parent, tr("Limitation de tableau"), text);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief QetGraphicsTableItem::QetGraphicsTableItem
|
* @brief QetGraphicsTableItem::QetGraphicsTableItem
|
||||||
* Default constructor
|
* Default constructor
|
||||||
@@ -601,6 +651,10 @@ QVariant QetGraphicsTableItem::itemChange(QGraphicsItem::GraphicsItemChange chan
|
|||||||
void QetGraphicsTableItem::modelReseted() {
|
void QetGraphicsTableItem::modelReseted() {
|
||||||
dataChanged(m_model->index(0,0), m_model->index(0,0), QVector<int>());
|
dataChanged(m_model->index(0,0), m_model->index(0,0), QVector<int>());
|
||||||
setToMinimumHeight();
|
setToMinimumHeight();
|
||||||
|
|
||||||
|
if (!previousTable()) { //this is the head table
|
||||||
|
checkInsufficientRowsCount(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ class QetGraphicsTableItem : public QetGraphicsItem
|
|||||||
|
|
||||||
public :
|
public :
|
||||||
static void adjustTableToFolio(QetGraphicsTableItem *table, QMargins margins = QMargins(20,20,20,0));
|
static void adjustTableToFolio(QetGraphicsTableItem *table, QMargins margins = QMargins(20,20,20,0));
|
||||||
|
static void checkInsufficientRowsCount(QetGraphicsTableItem *first_table);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QetGraphicsTableItem(QGraphicsItem *parent= nullptr);
|
QetGraphicsTableItem(QGraphicsItem *parent= nullptr);
|
||||||
|
|||||||
@@ -52,6 +52,8 @@ GraphicsTablePropertiesEditor::GraphicsTablePropertiesEditor(QetGraphicsTableIte
|
|||||||
if (table) {
|
if (table) {
|
||||||
setTable(table);
|
setTable(table);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ui->m_info_label->setStyleSheet("QLabel {color : red; }");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -281,6 +283,8 @@ void GraphicsTablePropertiesEditor::updateUi()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateInfoLabel();
|
||||||
|
|
||||||
auto margin = QETUtils::marginsFromString(m_table_item->model()->headerData(0, Qt::Horizontal, Qt::UserRole+1).toString());
|
auto margin = QETUtils::marginsFromString(m_table_item->model()->headerData(0, Qt::Horizontal, Qt::UserRole+1).toString());
|
||||||
ui->m_header_top_margin ->setValue(margin.top());
|
ui->m_header_top_margin ->setValue(margin.top());
|
||||||
ui->m_header_left_margin ->setValue(margin.left());
|
ui->m_header_left_margin ->setValue(margin.left());
|
||||||
@@ -306,6 +310,38 @@ void GraphicsTablePropertiesEditor::updateUi()
|
|||||||
setUpEditConnection();
|
setUpEditConnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GraphicsTablePropertiesEditor::updateInfoLabel()
|
||||||
|
{
|
||||||
|
auto table_ = m_table_item;
|
||||||
|
while (table_->previousTable()) { table_ = table_->previousTable();}
|
||||||
|
|
||||||
|
int count_ = 0;
|
||||||
|
bool infinite = false;
|
||||||
|
if (table_->displayNRow() <= 0) {
|
||||||
|
infinite = true;
|
||||||
|
} else {
|
||||||
|
count_ = table_->displayNRow();
|
||||||
|
}
|
||||||
|
|
||||||
|
while (table_->nextTable())
|
||||||
|
{
|
||||||
|
table_ = table_->nextTable();
|
||||||
|
if (table_->displayNRow() <= 0) {
|
||||||
|
infinite = true;
|
||||||
|
} else {
|
||||||
|
count_ += table_->displayNRow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto value = m_table_item->model()->rowCount() - count_;
|
||||||
|
if (value > 0 && !infinite) {
|
||||||
|
ui->m_info_label->setText(tr("<center>ATTENTION :</center>\n il manque %1 lignes afin d'afficher l'intégralité des informations").arg(value));
|
||||||
|
ui->m_info_label->show();
|
||||||
|
} else {
|
||||||
|
ui->m_info_label->hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief GraphicsTablePropertiesEditor::setUpEditConnection
|
* @brief GraphicsTablePropertiesEditor::setUpEditConnection
|
||||||
*/
|
*/
|
||||||
@@ -333,10 +369,12 @@ void GraphicsTablePropertiesEditor::setUpEditConnection()
|
|||||||
m_edit_connection << connect(m_table_button_group, QOverload<int>::of(&QButtonGroup::buttonClicked), this, &GraphicsTablePropertiesEditor::apply);
|
m_edit_connection << connect(m_table_button_group, QOverload<int>::of(&QButtonGroup::buttonClicked), this, &GraphicsTablePropertiesEditor::apply);
|
||||||
m_edit_connection << connect(m_header_button_group, QOverload<int>::of(&QButtonGroup::buttonClicked), this, &GraphicsTablePropertiesEditor::apply);
|
m_edit_connection << connect(m_header_button_group, QOverload<int>::of(&QButtonGroup::buttonClicked), this, &GraphicsTablePropertiesEditor::apply);
|
||||||
#else
|
#else
|
||||||
|
#pragma message("@TODO remove code for QT 5.15 or later")
|
||||||
m_edit_connection << connect(m_table_button_group, QOverload<int>::of(&QButtonGroup::idClicked), this, &GraphicsTablePropertiesEditor::apply);
|
m_edit_connection << connect(m_table_button_group, QOverload<int>::of(&QButtonGroup::idClicked), this, &GraphicsTablePropertiesEditor::apply);
|
||||||
m_edit_connection << connect(m_header_button_group, QOverload<int>::of(&QButtonGroup::idClicked), this, &GraphicsTablePropertiesEditor::apply);
|
m_edit_connection << connect(m_header_button_group, QOverload<int>::of(&QButtonGroup::idClicked), this, &GraphicsTablePropertiesEditor::apply);
|
||||||
#endif
|
#endif
|
||||||
m_edit_connection << connect(ui->m_display_n_row_sb, QOverload<int>::of(&QSpinBox::valueChanged), this, &GraphicsTablePropertiesEditor::apply);
|
m_edit_connection << connect(ui->m_display_n_row_sb, QOverload<int>::of(&QSpinBox::valueChanged), this, &GraphicsTablePropertiesEditor::apply);
|
||||||
|
m_edit_connection << connect(ui->m_display_n_row_sb, QOverload<int>::of(&QSpinBox::valueChanged), this, &GraphicsTablePropertiesEditor::updateInfoLabel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ class GraphicsTablePropertiesEditor : public PropertiesEditorWidget
|
|||||||
void on_m_header_font_pb_clicked();
|
void on_m_header_font_pb_clicked();
|
||||||
void on_m_table_font_pb_clicked();
|
void on_m_table_font_pb_clicked();
|
||||||
virtual void updateUi() override;
|
virtual void updateUi() override;
|
||||||
|
void updateInfoLabel();
|
||||||
void on_m_table_name_le_textEdited(const QString &arg1);
|
void on_m_table_name_le_textEdited(const QString &arg1);
|
||||||
void on_m_previous_table_cb_activated(int index);
|
void on_m_previous_table_cb_activated(int index);
|
||||||
void on_m_previous_pb_clicked();
|
void on_m_previous_pb_clicked();
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>524</width>
|
<width>524</width>
|
||||||
<height>600</height>
|
<height>623</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -40,40 +40,17 @@
|
|||||||
<string>Géometrie et lignes</string>
|
<string>Géometrie et lignes</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_2" columnstretch="0,0,0,0,0,0,0,0">
|
<layout class="QGridLayout" name="gridLayout_2" columnstretch="0,0,0,0,0,0,0,0">
|
||||||
<item row="0" column="6">
|
|
||||||
<widget class="QPushButton" name="m_apply_geometry_to_linked_table_pb">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Appliquer la géometrie à tous les tableaux liée à celui-ci</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="../../../../qelectrotech.qrc">
|
|
||||||
<normaloff>:/ico/22x22/all_pages.png</normaloff>:/ico/22x22/all_pages.png</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="2">
|
|
||||||
<widget class="QSpinBox" name="m_y_pos">
|
|
||||||
<property name="maximum">
|
|
||||||
<number>10000</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="4">
|
<item row="1" column="4">
|
||||||
<widget class="QComboBox" name="m_previous_table_cb">
|
<widget class="QSpinBox" name="m_display_n_row_sb">
|
||||||
<property name="insertPolicy">
|
<property name="specialValueText">
|
||||||
<enum>QComboBox::InsertAtBottom</enum>
|
<string>Toutes</string>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>999</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Aucun</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="6">
|
<item row="2" column="6">
|
||||||
<widget class="QPushButton" name="m_next_pb">
|
<widget class="QPushButton" name="m_next_pb">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@@ -93,14 +70,19 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="2" column="4">
|
||||||
<widget class="QSpinBox" name="m_x_pos">
|
<widget class="QComboBox" name="m_previous_table_cb">
|
||||||
<property name="maximum">
|
<property name="insertPolicy">
|
||||||
<number>10000</number>
|
<enum>QComboBox::InsertAtBottom</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Aucun</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="1" column="0">
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
@@ -113,20 +95,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="7">
|
<item row="1" column="5">
|
||||||
<spacer name="horizontalSpacer_2">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="5">
|
|
||||||
<widget class="QPushButton" name="m_auto_geometry_pb">
|
<widget class="QPushButton" name="m_auto_geometry_pb">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Ajuster le tableau au folio</string>
|
<string>Ajuster le tableau au folio</string>
|
||||||
@@ -140,7 +109,47 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1" colspan="6">
|
<item row="2" column="7">
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QLabel" name="label_7">
|
||||||
|
<property name="text">
|
||||||
|
<string>Y :</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLabel" name="label_8">
|
||||||
|
<property name="text">
|
||||||
|
<string>X :</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QSpinBox" name="m_x_pos">
|
||||||
|
<property name="maximum">
|
||||||
|
<number>10000</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1" colspan="6">
|
||||||
<widget class="QWidget" name="widget_3" native="true">
|
<widget class="QWidget" name="widget_3" native="true">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
@@ -158,47 +167,7 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="3">
|
<item row="2" column="5">
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="text">
|
|
||||||
<string>Lignes à afficher :</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QLabel" name="label_8">
|
|
||||||
<property name="text">
|
|
||||||
<string>X :</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="4">
|
|
||||||
<widget class="QSpinBox" name="m_display_n_row_sb">
|
|
||||||
<property name="specialValueText">
|
|
||||||
<string>Toutes</string>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>999</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="3">
|
|
||||||
<widget class="QLabel" name="label_3">
|
|
||||||
<property name="text">
|
|
||||||
<string>Tableau précédent :</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="5">
|
|
||||||
<widget class="QPushButton" name="m_previous_pb">
|
<widget class="QPushButton" name="m_previous_pb">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@@ -218,16 +187,60 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="2" column="2">
|
||||||
<widget class="QLabel" name="label_7">
|
<widget class="QSpinBox" name="m_y_pos">
|
||||||
|
<property name="maximum">
|
||||||
|
<number>10000</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="6">
|
||||||
|
<widget class="QPushButton" name="m_apply_geometry_to_linked_table_pb">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Appliquer la géometrie à tous les tableaux liée à celui-ci</string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Y :</string>
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../../../qelectrotech.qrc">
|
||||||
|
<normaloff>:/ico/22x22/all_pages.png</normaloff>:/ico/22x22/all_pages.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="3">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Tableau précédent :</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="3">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Lignes à afficher :</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1" colspan="6">
|
||||||
|
<widget class="QLabel" name="m_info_label">
|
||||||
|
<property name="text">
|
||||||
|
<string>TextLabel</string>
|
||||||
|
</property>
|
||||||
|
<property name="textFormat">
|
||||||
|
<enum>Qt::RichText</enum>
|
||||||
|
</property>
|
||||||
|
<property name="scaledContents">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -1675,6 +1675,7 @@ QSet<Conductor *> Conductor::relatedPotentialConductors(const bool all_diagram,
|
|||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
|
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
|
||||||
other_conductors += other_conductors_list_t.toSet();
|
other_conductors += other_conductors_list_t.toSet();
|
||||||
#else
|
#else
|
||||||
|
#pragma message("@TODO remove code for QT 5.14 or later")
|
||||||
other_conductors += QSet<Conductor*>(other_conductors_list_t.begin(),other_conductors_list_t.end());
|
other_conductors += QSet<Conductor*>(other_conductors_list_t.begin(),other_conductors_list_t.end());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -826,6 +826,7 @@ bool Element::fromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr, bool
|
|||||||
* this mean the label was made before commit 4791 (0.51 dev). So we swap the value stored in "label" to "formula" as expected.
|
* this mean the label was made before commit 4791 (0.51 dev). So we swap the value stored in "label" to "formula" as expected.
|
||||||
* @TODO remove this code at version 0.7 or more (probably useless).
|
* @TODO remove this code at version 0.7 or more (probably useless).
|
||||||
*/
|
*/
|
||||||
|
#pragma message("@TODO remove this code for qet 0.7 or later")
|
||||||
if (dc["label"].toString().contains("%") && dc["formula"].toString().isNull())
|
if (dc["label"].toString().contains("%") && dc["formula"].toString().isNull())
|
||||||
{
|
{
|
||||||
dc.addValue("formula", dc["label"]);
|
dc.addValue("formula", dc["label"]);
|
||||||
|
|||||||
@@ -23,12 +23,13 @@
|
|||||||
#include <QFont>
|
#include <QFont>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief QETXML::penToXml
|
@brief QETXML::penToXml
|
||||||
* Write attribute of a QPen in xml element
|
Write attribute of a QPen in xml element
|
||||||
* @param parent_document : parent document for create the QDomElement
|
@param parent_document : parent document for create the QDomElement
|
||||||
* @param pen : the pen to store
|
@param pen : the pen to store
|
||||||
* @return : A QDomElement with the attribute stored. The tagName of QDomeElement is "pen".
|
@return : A QDomElement with the attribute stored.
|
||||||
*/
|
The tagName of QDomeElement is "pen".
|
||||||
|
*/
|
||||||
QDomElement QETXML::penToXml(QDomDocument &parent_document,const QPen& pen)
|
QDomElement QETXML::penToXml(QDomDocument &parent_document,const QPen& pen)
|
||||||
{
|
{
|
||||||
QDomElement element = parent_document.createElement("pen");
|
QDomElement element = parent_document.createElement("pen");
|
||||||
@@ -48,19 +49,19 @@ QDomElement QETXML::penToXml(QDomDocument &parent_document,const QPen& pen)
|
|||||||
element.setAttribute("style", style);
|
element.setAttribute("style", style);
|
||||||
element.setAttribute("color", pen.color().name());
|
element.setAttribute("color", pen.color().name());
|
||||||
element.setAttribute("widthF", QString::number(pen.widthF()));
|
element.setAttribute("widthF", QString::number(pen.widthF()));
|
||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief QETXML::penFromXml
|
@brief QETXML::penFromXml
|
||||||
* Build a QPen from a xml description
|
Build a QPen from a xml description
|
||||||
* @param element, The QDomElement that describe the pen
|
@param element, The QDomElement that describe the pen
|
||||||
* @return the created pen. If @element is null or tagName isn't "pen"
|
@return the created pen. If @element is null or tagName isn't "pen"
|
||||||
* return a default constructed QPen
|
return a default constructed QPen
|
||||||
*/
|
*/
|
||||||
QPen QETXML::penFromXml(const QDomElement &element)
|
QPen QETXML::penFromXml(const QDomElement &element)
|
||||||
{
|
{
|
||||||
QPen pen;
|
QPen pen;
|
||||||
|
|
||||||
if (!(!element.isNull() && element.tagName() == "pen"))
|
if (!(!element.isNull() && element.tagName() == "pen"))
|
||||||
{
|
{
|
||||||
@@ -82,17 +83,19 @@ QPen QETXML::penFromXml(const QDomElement &element)
|
|||||||
|
|
||||||
pen.setColor(QColor(element.attribute("color", "#000000")));
|
pen.setColor(QColor(element.attribute("color", "#000000")));
|
||||||
pen.setWidthF(element.attribute("widthF", "1").toDouble());
|
pen.setWidthF(element.attribute("widthF", "1").toDouble());
|
||||||
return pen;
|
return pen;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief QETXML::brushToXml
|
@brief QETXML::brushToXml
|
||||||
* Write attribute of a QBrush in xml element
|
Write attribute of a QBrush in xml element
|
||||||
* @param parent_document : parent document for create the QDomElement
|
@param parent_document : parent document for create the QDomElement
|
||||||
* @param brush : the brush to store
|
@param brush : the brush to store
|
||||||
* @return A QDomElement with the attribute stored. The tagName of QDomeElement is "brush".
|
@return A QDomElement with the attribute stored.
|
||||||
*/
|
The tagName of QDomeElement is "brush".
|
||||||
QDomElement QETXML::brushToXml(QDomDocument &parent_document, const QBrush& brush)
|
*/
|
||||||
|
QDomElement QETXML::brushToXml(QDomDocument &parent_document,
|
||||||
|
const QBrush& brush)
|
||||||
{
|
{
|
||||||
QDomElement element = parent_document.createElement("brush");
|
QDomElement element = parent_document.createElement("brush");
|
||||||
|
|
||||||
@@ -114,7 +117,7 @@ QDomElement QETXML::brushToXml(QDomDocument &parent_document, const QBrush& brus
|
|||||||
case Qt::BDiagPattern : style = "BDiagPattern"; break;
|
case Qt::BDiagPattern : style = "BDiagPattern"; break;
|
||||||
case Qt::FDiagPattern : style = "FDiagPattern"; break;
|
case Qt::FDiagPattern : style = "FDiagPattern"; break;
|
||||||
case Qt::DiagCrossPattern : style = "DiagCrossPattern"; break;
|
case Qt::DiagCrossPattern : style = "DiagCrossPattern"; break;
|
||||||
default : style = "Unknown"; break;
|
default : style = "Unknown"; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
element.setAttribute("style", style);
|
element.setAttribute("style", style);
|
||||||
@@ -123,12 +126,12 @@ QDomElement QETXML::brushToXml(QDomDocument &parent_document, const QBrush& brus
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief QETXML::brushFromXml
|
@brief QETXML::brushFromXml
|
||||||
* Build a QBrush from a xml description
|
Build a QBrush from a xml description
|
||||||
* @param element, the QDomElement that describe the pen
|
@param element, the QDomElement that describe the pen
|
||||||
* @return the created brush. If @element is null or tagName isn't "brush"
|
@return the created brush. If @element is null or tagName isn't "brush"
|
||||||
* return a default constructed QBrush
|
return a default constructed QBrush
|
||||||
*/
|
*/
|
||||||
QBrush QETXML::brushFromXml(const QDomElement &element)
|
QBrush QETXML::brushFromXml(const QDomElement &element)
|
||||||
{
|
{
|
||||||
QBrush brush;
|
QBrush brush;
|
||||||
@@ -158,15 +161,20 @@ QBrush QETXML::brushFromXml(const QDomElement &element)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief QETXML::fileSystemDirToXmlCollectionDir
|
@brief QETXML::fileSystemDirToXmlCollectionDir
|
||||||
* @param document : owner document of returned QDomElement, use to create the QDomElement.
|
@param document : owner document of returned QDomElement,
|
||||||
* @param dir : file system direcory to convert to QDomElement directory
|
use to create the QDomElement.
|
||||||
* @param rename : by default the attribute "name" of the returned QDomElement is the same name of @dir
|
@param dir : file system direcory to convert to QDomElement directory
|
||||||
* but we can override itwith @rename
|
@param rename : by default the attribute "name" of the returned
|
||||||
* @return A file system directory converted to a QDomElement directory ready to be inserted into a XmlElementCollection.
|
QDomElement is the same name of @dir
|
||||||
* If the QDomElement can't be created, return a null QDomElement.
|
but we can override itwith @rename
|
||||||
*/
|
@return A file system directory converted to a QDomElement directory
|
||||||
QDomElement QETXML::fileSystemDirToXmlCollectionDir(QDomDocument &document, const QDir &dir, const QString& rename)
|
ready to be inserted into a XmlElementCollection.
|
||||||
|
If the QDomElement can't be created, return a null QDomElement.
|
||||||
|
*/
|
||||||
|
QDomElement QETXML::fileSystemDirToXmlCollectionDir(QDomDocument &document,
|
||||||
|
const QDir &dir,
|
||||||
|
const QString& rename)
|
||||||
{
|
{
|
||||||
if (!dir.exists()) return QDomElement();
|
if (!dir.exists()) return QDomElement();
|
||||||
|
|
||||||
@@ -175,7 +183,9 @@ QDomElement QETXML::fileSystemDirToXmlCollectionDir(QDomDocument &document, cons
|
|||||||
|
|
||||||
//Get the traduction of this directory
|
//Get the traduction of this directory
|
||||||
QFile qet_dir(dir.filePath("qet_directory"));
|
QFile qet_dir(dir.filePath("qet_directory"));
|
||||||
if (qet_dir.exists() && qet_dir.open(QIODevice::ReadOnly | QIODevice::Text))
|
if (qet_dir.exists() && qet_dir.open(
|
||||||
|
QIODevice::ReadOnly
|
||||||
|
| QIODevice::Text))
|
||||||
{
|
{
|
||||||
//Get the content of the file
|
//Get the content of the file
|
||||||
QDomDocument trad_document;
|
QDomDocument trad_document;
|
||||||
@@ -196,15 +206,21 @@ QDomElement QETXML::fileSystemDirToXmlCollectionDir(QDomDocument &document, cons
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief QETXML::fileSystemElementToXmlCollectionElement
|
@brief QETXML::fileSystemElementToXmlCollectionElement
|
||||||
* @param document : owner document of returned QDomElement, use to create the QDomElement.
|
@param document : owner document of returned QDomElement,
|
||||||
* @param file : file system element file to convert to QDomElement;
|
use to create the QDomElement.
|
||||||
* @param rename : by default the attribute "name" of the returned QDomElement is the same name of @file
|
@param file : file system element file to convert to QDomElement;
|
||||||
* but we can override itwith @rename
|
@param rename : by default the attribute "name" of
|
||||||
* @return A file system element converted to a QDomElement ready to be inserted into a XmlElementCollection
|
the returned QDomElement is the same name of @file
|
||||||
* If the QDomElement can't be created, return a null QDomElement
|
but we can override itwith @rename
|
||||||
*/
|
@return A file system element converted to a QDomElement
|
||||||
QDomElement QETXML::fileSystemElementToXmlCollectionElement(QDomDocument &document, QFile &file, const QString& rename)
|
ready to be inserted into a XmlElementCollection
|
||||||
|
If the QDomElement can't be created, return a null QDomElement
|
||||||
|
*/
|
||||||
|
QDomElement QETXML::fileSystemElementToXmlCollectionElement(
|
||||||
|
QDomDocument &document,
|
||||||
|
QFile &file,
|
||||||
|
const QString& rename)
|
||||||
{
|
{
|
||||||
if (file.exists() && file.open(QIODevice::ReadOnly | QIODevice::Text))
|
if (file.exists() && file.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||||
{
|
{
|
||||||
@@ -229,26 +245,32 @@ QDomElement QETXML::fileSystemElementToXmlCollectionElement(QDomDocument &docume
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief QETXML::writeXmlFile
|
@brief QETXML::writeXmlFile
|
||||||
* Export an XML document to an UTF-8 text file indented with 4 spaces, with LF end of lines and no BOM.
|
Export an XML document to an UTF-8 text file indented with 4 spaces,
|
||||||
* @param xml_document : An XML document to be exported
|
with LF end of lines and no BOM.
|
||||||
* @param file_path : Path to the file to be written
|
@param xml_document : An XML document to be exported
|
||||||
* @param error_message : If non-zero, will contain an error message explaining what happened when this function returns false.
|
@param file_path : Path to the file to be written
|
||||||
* @return false if an error occurred, true otherwise
|
@param error_message : If non-zero, will contain an error message
|
||||||
*/
|
explaining what happened when this function returns false.
|
||||||
bool QETXML::writeXmlFile(const QDomDocument &xml_document, const QString &file_path, QString *error_message)
|
@return false if an error occurred, true otherwise
|
||||||
|
*/
|
||||||
|
bool QETXML::writeXmlFile(const QDomDocument &xml_document,
|
||||||
|
const QString &file_path,
|
||||||
|
QString *error_message)
|
||||||
{
|
{
|
||||||
QFile file(file_path);
|
QFile file(file_path);
|
||||||
|
|
||||||
// Note: we do not set QIODevice::Text to avoid generating CRLF end of lines
|
// Note: we do not set QIODevice::Text to avoid generating CRLF end of lines
|
||||||
bool file_opening = file.open(QIODevice::WriteOnly);
|
bool file_opening = file.open(QIODevice::WriteOnly);
|
||||||
if (!file_opening)
|
if (!file_opening)
|
||||||
{
|
{
|
||||||
if (error_message)
|
if (error_message)
|
||||||
{
|
{
|
||||||
*error_message = QString(QObject::tr("Impossible d'ouvrir le fichier %1 en écriture, erreur %2 rencontrée.",
|
*error_message = QString(
|
||||||
"error message when attempting to write an XML file")
|
QObject::tr(
|
||||||
).arg(file_path).arg(file.error());
|
"Impossible d'ouvrir le fichier %1 en écriture, erreur %2 rencontrée.",
|
||||||
|
"error message when attempting to write an XML file")
|
||||||
|
).arg(file_path).arg(file.error());
|
||||||
}
|
}
|
||||||
return(false);
|
return(false);
|
||||||
}
|
}
|
||||||
@@ -263,14 +285,17 @@ bool QETXML::writeXmlFile(const QDomDocument &xml_document, const QString &file_
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief QETXML::textToDomElement
|
@brief QETXML::textToDomElement
|
||||||
* Return a QDomElement, created from @document, with tag name @tag_name and text @value.
|
Return a QDomElement, created from @document,
|
||||||
* @param document
|
with tag name @tag_name and text @value.
|
||||||
* @param tag_name
|
@param document
|
||||||
* @param value
|
@param tag_name
|
||||||
* @return
|
@param value
|
||||||
*/
|
@return a QDomElement, created from @document
|
||||||
QDomElement QETXML::textToDomElement(QDomDocument &document, const QString& tag_name, const QString& value)
|
*/
|
||||||
|
QDomElement QETXML::textToDomElement(QDomDocument &document,
|
||||||
|
const QString& tag_name,
|
||||||
|
const QString& value)
|
||||||
{
|
{
|
||||||
QDomElement element = document.createElement(tag_name);
|
QDomElement element = document.createElement(tag_name);
|
||||||
QDomText text = document.createTextNode(value);
|
QDomText text = document.createTextNode(value);
|
||||||
@@ -280,15 +305,19 @@ QDomElement QETXML::textToDomElement(QDomDocument &document, const QString& tag_
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief QETXML::directChild
|
@brief QETXML::directChild
|
||||||
* @param element
|
@param element
|
||||||
* @param tag_name
|
@param tag_name
|
||||||
* @return All direct child of @element with the tag name @tag_name
|
@return All direct child of @element with the tag name @tag_name
|
||||||
*/
|
*/
|
||||||
QVector<QDomElement> QETXML::directChild(const QDomElement &element, const QString &tag_name)
|
QVector<QDomElement> QETXML::directChild(const QDomElement &element,
|
||||||
|
const QString &tag_name)
|
||||||
{
|
{
|
||||||
QVector<QDomElement> return_list;
|
QVector<QDomElement> return_list;
|
||||||
for (QDomNode node = element.firstChild() ; !node.isNull() ; node = node.nextSibling())
|
for (
|
||||||
|
QDomNode node = element.firstChild() ;
|
||||||
|
!node.isNull() ;
|
||||||
|
node = node.nextSibling())
|
||||||
{
|
{
|
||||||
if (!node.isElement()) continue;
|
if (!node.isElement()) continue;
|
||||||
QDomElement element = node.toElement();
|
QDomElement element = node.toElement();
|
||||||
@@ -300,25 +329,34 @@ QVector<QDomElement> QETXML::directChild(const QDomElement &element, const QStri
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief QETXML::subChild
|
@brief QETXML::subChild
|
||||||
* @param element
|
@param element
|
||||||
* @param parent_tag_name
|
@param parent_tag_name
|
||||||
* @param children_tag_name
|
@param children_tag_name
|
||||||
* @return When given an xml dom element @element,
|
@return When given an xml dom element @element,
|
||||||
* returns a vector of all children dom_elements tagged @children_tag_name
|
returns a vector of all children dom_elements tagged @children_tag_name
|
||||||
* nested in the parent dom elements tagged parent_tag_name, themselves children of the dom element @element.
|
nested in the parent dom elements tagged parent_tag_name,
|
||||||
*/
|
themselves children of the dom element @element.
|
||||||
QVector<QDomElement> QETXML::subChild(const QDomElement &element, const QString parent_tag_name, const QString &children_tag_name)
|
*/
|
||||||
|
QVector<QDomElement> QETXML::subChild(const QDomElement &element,
|
||||||
|
const QString parent_tag_name,
|
||||||
|
const QString &children_tag_name)
|
||||||
{
|
{
|
||||||
QVector<QDomElement> return_list;
|
QVector<QDomElement> return_list;
|
||||||
|
|
||||||
for (QDomNode child = element.firstChild() ; !child.isNull() ; child = child.nextSibling())
|
for (
|
||||||
|
QDomNode child = element.firstChild() ;
|
||||||
|
!child.isNull() ;
|
||||||
|
child = child.nextSibling())
|
||||||
{
|
{
|
||||||
QDomElement parents = child.toElement();
|
QDomElement parents = child.toElement();
|
||||||
if (parents.isNull() || parents.tagName() != parent_tag_name)
|
if (parents.isNull() || parents.tagName() != parent_tag_name)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (QDomNode node_children = parents.firstChild() ; !node_children.isNull() ; node_children = node_children.nextSibling())
|
for (
|
||||||
|
QDomNode node_children = parents.firstChild() ;
|
||||||
|
!node_children.isNull() ;
|
||||||
|
node_children = node_children.nextSibling())
|
||||||
{
|
{
|
||||||
QDomElement n_children = node_children.toElement();
|
QDomElement n_children = node_children.toElement();
|
||||||
if (!n_children.isNull() && n_children.tagName() == children_tag_name)
|
if (!n_children.isNull() && n_children.tagName() == children_tag_name)
|
||||||
@@ -330,29 +368,34 @@ QVector<QDomElement> QETXML::subChild(const QDomElement &element, const QString
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief QETXML::marginsToXml
|
@brief QETXML::marginsToXml
|
||||||
* Save a QMargins to xml. the xml tag name is 'margins'
|
Save a QMargins to xml. the xml tag name is 'margins'
|
||||||
* @param parent_document
|
@param parent_document
|
||||||
* @param margins
|
@param margins
|
||||||
* @return
|
@return
|
||||||
*/
|
*/
|
||||||
QDomElement QETXML::marginsToXml(QDomDocument &parent_document, const QMargins &margins)
|
QDomElement QETXML::marginsToXml(QDomDocument &parent_document,
|
||||||
|
const QMargins &margins)
|
||||||
{
|
{
|
||||||
auto dom_ = parent_document.createElement("margins");
|
auto dom_ = parent_document.createElement("margins");
|
||||||
auto text_ = parent_document.createTextNode(QString::number(margins.left()) + QString(";") +
|
auto text_ = parent_document.createTextNode(
|
||||||
QString::number(margins.top()) + QString(";") +
|
QString::number(margins.left())
|
||||||
QString::number(margins.right()) + QString(";") +
|
+ QString(";")
|
||||||
QString::number(margins.bottom()));
|
+ QString::number(margins.top())
|
||||||
|
+ QString(";")
|
||||||
|
+ QString::number(margins.right())
|
||||||
|
+ QString(";")
|
||||||
|
+ QString::number(margins.bottom()));
|
||||||
dom_.appendChild(text_);
|
dom_.appendChild(text_);
|
||||||
return dom_;
|
return dom_;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief QETXML::marginsFromXml
|
@brief QETXML::marginsFromXml
|
||||||
* @param element
|
@param element
|
||||||
* @return a QMargins from an xml description.
|
@return a QMargins from an xml description.
|
||||||
* The tag name must ne 'margins'
|
The tag name must ne 'margins'
|
||||||
*/
|
*/
|
||||||
QMargins QETXML::marginsFromXml(const QDomElement &element)
|
QMargins QETXML::marginsFromXml(const QDomElement &element)
|
||||||
{
|
{
|
||||||
if (element.tagName() != "margins") {
|
if (element.tagName() != "margins") {
|
||||||
@@ -361,22 +404,35 @@ QMargins QETXML::marginsFromXml(const QDomElement &element)
|
|||||||
|
|
||||||
auto margins_ = element.text().split(";");
|
auto margins_ = element.text().split(";");
|
||||||
if (margins_.size() == 4) {
|
if (margins_.size() == 4) {
|
||||||
return QMargins(margins_.at(0).toInt(), margins_.at(1).toInt(), margins_.at(2).toInt(), margins_.at(3).toInt());
|
return QMargins(
|
||||||
|
margins_.at(0).toInt(),
|
||||||
|
margins_.at(1).toInt(),
|
||||||
|
margins_.at(2).toInt(),
|
||||||
|
margins_.at(3).toInt());
|
||||||
} else {
|
} else {
|
||||||
return QMargins();
|
return QMargins();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief QETXML::modelHeaderDataToXml
|
@brief QETXML::modelHeaderDataToXml
|
||||||
* Save to xml element all header data specified by @horizontal_section_role and @vertical_section_role
|
Save to xml element all header data specified
|
||||||
* @param parent_document
|
by @horizontal_section_role and @vertical_section_role
|
||||||
* @param model
|
@param parent_document
|
||||||
* @param horizontal_section_role : key as header section and value as list of roles to save in xml
|
@param model
|
||||||
* @param vertical_section_role :key as header section and value as list of roles to save in xml
|
@param horizontal_section_role : key as header section and value
|
||||||
* @return
|
as list of roles to save in xml
|
||||||
*/
|
@param vertical_section_role :key as header section and value
|
||||||
QDomElement QETXML::modelHeaderDataToXml(QDomDocument &parent_document, const QAbstractItemModel *model, QHash<int, QList<int>> horizontal_section_role, QHash<int, QList<int>> vertical_section_role)
|
as list of roles to save in xml
|
||||||
|
@return
|
||||||
|
*/
|
||||||
|
QDomElement QETXML::modelHeaderDataToXml(
|
||||||
|
QDomDocument &parent_document,
|
||||||
|
const QAbstractItemModel *model,
|
||||||
|
QHash<int,
|
||||||
|
QList<int>> horizontal_section_role,
|
||||||
|
QHash<int,
|
||||||
|
QList<int>> vertical_section_role)
|
||||||
{
|
{
|
||||||
auto dom_element = parent_document.createElement("header_data");
|
auto dom_element = parent_document.createElement("header_data");
|
||||||
|
|
||||||
@@ -401,7 +457,11 @@ QDomElement QETXML::modelHeaderDataToXml(QDomDocument &parent_document, const QA
|
|||||||
dom_data.setAttribute("role", meta_enum_role.valueToKey(role));
|
dom_data.setAttribute("role", meta_enum_role.valueToKey(role));
|
||||||
|
|
||||||
auto text_node = parent_document.createTextNode("");
|
auto text_node = parent_document.createTextNode("");
|
||||||
if (role == Qt::DisplayRole || role == Qt::EditRole || role == Qt::ToolTipRole || role == Qt::StatusTipRole || role == Qt::WhatsThisRole)
|
if (role == Qt::DisplayRole
|
||||||
|
|| role == Qt::EditRole
|
||||||
|
|| role == Qt::ToolTipRole
|
||||||
|
|| role == Qt::StatusTipRole
|
||||||
|
|| role == Qt::WhatsThisRole)
|
||||||
{
|
{
|
||||||
text_node.setData(variant.toString());
|
text_node.setData(variant.toString());
|
||||||
}
|
}
|
||||||
@@ -433,12 +493,13 @@ QDomElement QETXML::modelHeaderDataToXml(QDomDocument &parent_document, const QA
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief QETXML::modelHeaderDataFromXml
|
@brief QETXML::modelHeaderDataFromXml
|
||||||
* Restore from xml modele header data
|
Restore from xml modele header data
|
||||||
* @param element
|
@param element
|
||||||
* @param model
|
@param model
|
||||||
*/
|
*/
|
||||||
void QETXML::modelHeaderDataFromXml(const QDomElement &element, QAbstractItemModel *model)
|
void QETXML::modelHeaderDataFromXml(const QDomElement &element,
|
||||||
|
QAbstractItemModel *model)
|
||||||
{
|
{
|
||||||
if (element.tagName() != "header_data")
|
if (element.tagName() != "header_data")
|
||||||
return;
|
return;
|
||||||
@@ -449,12 +510,25 @@ void QETXML::modelHeaderDataFromXml(const QDomElement &element, QAbstractItemMod
|
|||||||
for (auto child : QETXML::directChild(element, "data"))
|
for (auto child : QETXML::directChild(element, "data"))
|
||||||
{
|
{
|
||||||
auto section_ = child.attribute("section", "-1").toInt();
|
auto section_ = child.attribute("section", "-1").toInt();
|
||||||
auto orientation_ = Qt::Orientation(meta_enum_orientation.keyToValue(child.attribute("orientation", "Horizontal").toStdString().data()));
|
auto orientation_ = Qt::Orientation(
|
||||||
auto role_ = meta_enum_role.keyToValue(child.attribute("role", "DisplayRole").toStdString().data());
|
meta_enum_orientation.keyToValue(
|
||||||
|
child.attribute(
|
||||||
|
"orientation",
|
||||||
|
"Horizontal"
|
||||||
|
).toStdString().data()));
|
||||||
|
auto role_ = meta_enum_role.keyToValue(
|
||||||
|
child.attribute(
|
||||||
|
"role",
|
||||||
|
"DisplayRole"
|
||||||
|
).toStdString().data());
|
||||||
auto text_ = child.text();
|
auto text_ = child.text();
|
||||||
QVariant data_;
|
QVariant data_;
|
||||||
|
|
||||||
if (role_ == Qt::DisplayRole || role_ == Qt::EditRole || role_ == Qt::ToolTipRole || role_ == Qt::StatusTipRole || role_ == Qt::WhatsThisRole) {
|
if (role_ == Qt::DisplayRole
|
||||||
|
|| role_ == Qt::EditRole
|
||||||
|
|| role_ == Qt::ToolTipRole
|
||||||
|
|| role_ == Qt::StatusTipRole
|
||||||
|
|| role_ == Qt::WhatsThisRole) {
|
||||||
data_ = text_;
|
data_ = text_;
|
||||||
}
|
}
|
||||||
else if (role_ == Qt::FontRole)
|
else if (role_ == Qt::FontRole)
|
||||||
|
|||||||
@@ -31,27 +31,48 @@ class QAbstractItemModel;
|
|||||||
*/
|
*/
|
||||||
namespace QETXML
|
namespace QETXML
|
||||||
{
|
{
|
||||||
QDomElement penToXml(QDomDocument &parent_document, const QPen& pen);
|
QDomElement penToXml(QDomDocument &parent_document, const QPen& pen);
|
||||||
QPen penFromXml (const QDomElement &element);
|
QPen penFromXml (const QDomElement &element);
|
||||||
|
|
||||||
QDomElement brushToXml (QDomDocument &parent_document, const QBrush& brush);
|
QDomElement brushToXml (QDomDocument &parent_document,
|
||||||
|
const QBrush& brush);
|
||||||
QBrush brushFromXml (const QDomElement &element);
|
QBrush brushFromXml (const QDomElement &element);
|
||||||
|
|
||||||
QDomElement fileSystemDirToXmlCollectionDir (QDomDocument &document, const QDir &dir, const QString& rename = QString());
|
QDomElement fileSystemDirToXmlCollectionDir (
|
||||||
QDomElement fileSystemElementToXmlCollectionElement (QDomDocument &document, QFile &file, const QString& rename = QString());
|
QDomDocument &document,
|
||||||
|
const QDir &dir,
|
||||||
|
const QString& rename = QString());
|
||||||
|
QDomElement fileSystemElementToXmlCollectionElement (
|
||||||
|
QDomDocument &document,
|
||||||
|
QFile &file,
|
||||||
|
const QString& rename = QString());
|
||||||
|
|
||||||
bool writeXmlFile(const QDomDocument &xml_document, const QString &file_path, QString *error_message = nullptr);
|
bool writeXmlFile(const QDomDocument &xml_document,
|
||||||
|
const QString &file_path,
|
||||||
|
QString *error_message = nullptr);
|
||||||
|
|
||||||
QDomElement textToDomElement (QDomDocument &document, const QString& tag_name, const QString& value);
|
QDomElement textToDomElement (QDomDocument &document,
|
||||||
|
const QString& tag_name,
|
||||||
|
const QString& value);
|
||||||
|
|
||||||
QVector <QDomElement> directChild(const QDomElement &element, const QString &tag_name);
|
QVector <QDomElement> directChild(const QDomElement &element,
|
||||||
QVector <QDomElement> subChild(const QDomElement &element, const QString parent_tag_name, const QString &children_tag_name);
|
const QString &tag_name);
|
||||||
|
QVector <QDomElement> subChild(const QDomElement &element,
|
||||||
|
const QString parent_tag_name,
|
||||||
|
const QString &children_tag_name);
|
||||||
|
|
||||||
QDomElement marginsToXml (QDomDocument &parent_document, const QMargins &margins);
|
QDomElement marginsToXml (QDomDocument &parent_document,
|
||||||
|
const QMargins &margins);
|
||||||
QMargins marginsFromXml(const QDomElement &element);
|
QMargins marginsFromXml(const QDomElement &element);
|
||||||
|
|
||||||
QDomElement modelHeaderDataToXml(QDomDocument &parent_document, const QAbstractItemModel *model, QHash<int, QList<int>> horizontal_section_role, QHash<int, QList<int>> vertical_section_role);
|
QDomElement modelHeaderDataToXml(QDomDocument &parent_document,
|
||||||
void modelHeaderDataFromXml(const QDomElement &element, QAbstractItemModel *model);
|
const QAbstractItemModel *model,
|
||||||
|
QHash<int,
|
||||||
|
QList<int>> horizontal_section_role,
|
||||||
|
QHash<int,
|
||||||
|
QList<int>> vertical_section_role);
|
||||||
|
void modelHeaderDataFromXml(const QDomElement &element,
|
||||||
|
QAbstractItemModel *model);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // QETXML_H
|
#endif // QETXML_H
|
||||||
|
|||||||
@@ -739,6 +739,7 @@ QString RichTextEditor::text(Qt::TextFormat format) const
|
|||||||
break;
|
break;
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
||||||
#else
|
#else
|
||||||
|
#pragma message("@TODO remove code for QT 5.14 or later")
|
||||||
case Qt::MarkdownText: //This enum value was added in Qt 5.14.
|
case Qt::MarkdownText: //This enum value was added in Qt 5.14.
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -338,6 +338,7 @@ void TitleBlockTemplate::parseRows(const QString &rows_string) {
|
|||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
|
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
|
||||||
QStringList rows_descriptions = rows_string.split(QChar(';'), QString::SkipEmptyParts);
|
QStringList rows_descriptions = rows_string.split(QChar(';'), QString::SkipEmptyParts);
|
||||||
#else
|
#else
|
||||||
|
#pragma message("@TODO remove code for QT 5.14 or later")
|
||||||
QStringList rows_descriptions = rows_string.split(QChar(';'), Qt::SkipEmptyParts);
|
QStringList rows_descriptions = rows_string.split(QChar(';'), Qt::SkipEmptyParts);
|
||||||
#endif
|
#endif
|
||||||
foreach (QString rows_description, rows_descriptions) {
|
foreach (QString rows_description, rows_descriptions) {
|
||||||
@@ -365,6 +366,7 @@ void TitleBlockTemplate::parseColumns(const QString &cols_string) {
|
|||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
|
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
|
||||||
QStringList cols_descriptions = cols_string.split(QChar(';'), QString::SkipEmptyParts);
|
QStringList cols_descriptions = cols_string.split(QChar(';'), QString::SkipEmptyParts);
|
||||||
#else
|
#else
|
||||||
|
#pragma message("@TODO remove code for QT 5.14 or later")
|
||||||
QStringList cols_descriptions = cols_string.split(QChar(';'), Qt::SkipEmptyParts);
|
QStringList cols_descriptions = cols_string.split(QChar(';'), Qt::SkipEmptyParts);
|
||||||
#endif
|
#endif
|
||||||
foreach (QString cols_description, cols_descriptions) {
|
foreach (QString cols_description, cols_descriptions) {
|
||||||
|
|||||||
@@ -21,7 +21,13 @@
|
|||||||
|
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QDate>
|
#include <QDate>
|
||||||
|
#include <QScreen>
|
||||||
|
#include <QProcess>
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief AboutQETDialog::AboutQETDialog
|
||||||
|
@param parent
|
||||||
|
*/
|
||||||
AboutQETDialog::AboutQETDialog(QWidget *parent) :
|
AboutQETDialog::AboutQETDialog(QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::AboutQETDialog)
|
ui(new Ui::AboutQETDialog)
|
||||||
@@ -36,11 +42,17 @@ AboutQETDialog::AboutQETDialog(QWidget *parent) :
|
|||||||
setLicence();
|
setLicence();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief AboutQETDialog::~AboutQETDialog
|
||||||
|
*/
|
||||||
AboutQETDialog::~AboutQETDialog()
|
AboutQETDialog::~AboutQETDialog()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief AboutQETDialog::setAbout
|
||||||
|
*/
|
||||||
void AboutQETDialog::setAbout()
|
void AboutQETDialog::setAbout()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -55,6 +67,9 @@ void AboutQETDialog::setAbout()
|
|||||||
ui->m_about_label->setText(str);
|
ui->m_about_label->setText(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief AboutQETDialog::setAuthors
|
||||||
|
*/
|
||||||
void AboutQETDialog::setAuthors()
|
void AboutQETDialog::setAuthors()
|
||||||
{
|
{
|
||||||
addAuthor(ui->m_author_label, "Benoît Ansieau", "benoit@qelectrotech.org", tr("Idée originale"));
|
addAuthor(ui->m_author_label, "Benoît Ansieau", "benoit@qelectrotech.org", tr("Idée originale"));
|
||||||
@@ -66,6 +81,9 @@ void AboutQETDialog::setAuthors()
|
|||||||
addAuthor(ui->m_author_label, "Abhishek Bansal", "abhishek@qelectrotech.org", tr("Développement"));
|
addAuthor(ui->m_author_label, "Abhishek Bansal", "abhishek@qelectrotech.org", tr("Développement"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief AboutQETDialog::setTranslators
|
||||||
|
*/
|
||||||
void AboutQETDialog::setTranslators()
|
void AboutQETDialog::setTranslators()
|
||||||
{
|
{
|
||||||
addAuthor(ui->m_translators_label, "Alfredo Carreto", "electronicos_mx@yahoo.com.mx", tr("Traduction en espagnol"));
|
addAuthor(ui->m_translators_label, "Alfredo Carreto", "electronicos_mx@yahoo.com.mx", tr("Traduction en espagnol"));
|
||||||
@@ -94,6 +112,9 @@ void AboutQETDialog::setTranslators()
|
|||||||
addAuthor(ui->m_translators_label, "Gábor Gubányi", "gubanyig@gmail.com", tr("Traduction en hongrois"));
|
addAuthor(ui->m_translators_label, "Gábor Gubányi", "gubanyig@gmail.com", tr("Traduction en hongrois"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief AboutQETDialog::setContributors
|
||||||
|
*/
|
||||||
void AboutQETDialog::setContributors()
|
void AboutQETDialog::setContributors()
|
||||||
{
|
{
|
||||||
addAuthor(ui->m_contrib_label, "Remi Collet", "remi@fedoraproject.org", tr("Paquets Fedora et Red Hat"));
|
addAuthor(ui->m_contrib_label, "Remi Collet", "remi@fedoraproject.org", tr("Paquets Fedora et Red Hat"));
|
||||||
@@ -117,6 +138,9 @@ void AboutQETDialog::setContributors()
|
|||||||
addAuthor(ui->m_contrib_label, "Maximilian Federle", "", tr("Paquets Snap"));
|
addAuthor(ui->m_contrib_label, "Maximilian Federle", "", tr("Paquets Snap"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief AboutQETDialog::setVersion
|
||||||
|
*/
|
||||||
void AboutQETDialog::setVersion()
|
void AboutQETDialog::setVersion()
|
||||||
{
|
{
|
||||||
QString str = "<span style=\"font-weight:bold;font-size:16pt;\">QElectroTech V " + QET::displayedVersion + "</span>";
|
QString str = "<span style=\"font-weight:bold;font-size:16pt;\">QElectroTech V " + QET::displayedVersion + "</span>";
|
||||||
@@ -129,6 +153,12 @@ void AboutQETDialog::setVersion()
|
|||||||
compilation_info += " : " + QString(__TIME__);
|
compilation_info += " : " + QString(__TIME__);
|
||||||
compilation_info += " <br>Run with Qt "+ QString(qVersion());
|
compilation_info += " <br>Run with Qt "+ QString(qVersion());
|
||||||
compilation_info += " using" + QString(" %1 thread(s)").arg(QThread::idealThreadCount());
|
compilation_info += " using" + QString(" %1 thread(s)").arg(QThread::idealThreadCount());
|
||||||
|
QProcess macoscpuinfo;
|
||||||
|
macoscpuinfo.start("bash", QStringList() << "-c" << "sysctl -n machdep.cpu.brand_string");
|
||||||
|
macoscpuinfo.waitForFinished();
|
||||||
|
QString macosOutput = macoscpuinfo.readAllStandardOutput();
|
||||||
|
compilation_info += "<br>"" CPU : " + QString(macosOutput.toLocal8Bit().constData());
|
||||||
|
|
||||||
compilation_info += "<br>" " OS : " + QString(QSysInfo::kernelType());
|
compilation_info += "<br>" " OS : " + QString(QSysInfo::kernelType());
|
||||||
compilation_info += " - " + QString(QSysInfo::currentCpuArchitecture());
|
compilation_info += " - " + QString(QSysInfo::currentCpuArchitecture());
|
||||||
compilation_info += " - Version : " + QString(QSysInfo::prettyProductName());
|
compilation_info += " - Version : " + QString(QSysInfo::prettyProductName());
|
||||||
@@ -140,15 +170,61 @@ void AboutQETDialog::setVersion()
|
|||||||
compilation_info += " : " + QString(__TIME__);
|
compilation_info += " : " + QString(__TIME__);
|
||||||
compilation_info += " <br>Run with Qt "+ QString(qVersion());
|
compilation_info += " <br>Run with Qt "+ QString(qVersion());
|
||||||
compilation_info += " using" + QString(" %1 thread(s)").arg(QThread::idealThreadCount());
|
compilation_info += " using" + QString(" %1 thread(s)").arg(QThread::idealThreadCount());
|
||||||
|
|
||||||
|
QString OSName = QSysInfo::kernelType();
|
||||||
|
if (OSName == "linux")
|
||||||
|
{
|
||||||
|
QProcess linuxcpuinfo;
|
||||||
|
linuxcpuinfo.start("bash", QStringList() << "-c" << "cat /proc/cpuinfo |grep 'model name' | uniq");
|
||||||
|
linuxcpuinfo.waitForFinished();
|
||||||
|
QString linuxOutput = linuxcpuinfo.readAllStandardOutput();
|
||||||
|
compilation_info += "<br>"" CPU : " + QString(linuxOutput.toLocal8Bit().constData());
|
||||||
|
|
||||||
|
QProcess p;
|
||||||
|
p.start("awk", QStringList() << "/MemTotal/ { print $2 }" << "/proc/meminfo");
|
||||||
|
p.waitForFinished();
|
||||||
|
QString memory = p.readAllStandardOutput();
|
||||||
|
compilation_info += "<br>" + QString("RAM Total : %1 MB").arg(memory.toLong() / 1024);
|
||||||
|
p.close();
|
||||||
|
|
||||||
|
QProcess qp;
|
||||||
|
qp.start("awk", QStringList() << "/MemAvailable/ {print $2}" << "/proc/meminfo");
|
||||||
|
qp.waitForFinished();
|
||||||
|
QString AvailableMemory = qp.readAllStandardOutput();
|
||||||
|
compilation_info += "<br>" + QString("RAM Available : %1 MB").arg(AvailableMemory.toLong() / 1024);
|
||||||
|
qp.close();
|
||||||
|
|
||||||
|
QProcess linuxgpuinfo;
|
||||||
|
linuxgpuinfo.start("bash", QStringList() << "-c" << "lspci | grep VGA | cut -d : -f 3");
|
||||||
|
linuxgpuinfo.waitForFinished();
|
||||||
|
QString linuxGPUOutput = linuxgpuinfo.readAllStandardOutput();
|
||||||
|
compilation_info += "<br>"" GPU : " + QString(linuxGPUOutput.toLocal8Bit().constData());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
compilation_info += "<br>" " OS : " + QString(QSysInfo::kernelType());
|
compilation_info += "<br>" " OS : " + QString(QSysInfo::kernelType());
|
||||||
compilation_info += " - " + QString(QSysInfo::currentCpuArchitecture());
|
compilation_info += " - " + QString(QSysInfo::currentCpuArchitecture());
|
||||||
compilation_info += " - Version : " + QString(QSysInfo::prettyProductName());
|
compilation_info += " - Version : " + QString(QSysInfo::prettyProductName());
|
||||||
compilation_info += "</br>" " - Kernel : " + QString(QSysInfo::kernelVersion());
|
compilation_info += "</br>" " - Kernel : " + QString(QSysInfo::kernelVersion());
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
compilation_info += "<br> *** Qt screens *** </br>";
|
||||||
|
const auto screens = qApp->screens();
|
||||||
|
for (int ii = 0; ii < screens.count(); ++ii) {
|
||||||
|
compilation_info += "<br> ( "
|
||||||
|
+ QString::number(ii + 1)
|
||||||
|
+ " : "
|
||||||
|
+ QString::number(screens[ii]->geometry().width() * screens[ii]->devicePixelRatio())
|
||||||
|
+ " x "
|
||||||
|
+ QString::number(screens[ii]->geometry().height() * screens[ii]->devicePixelRatio())
|
||||||
|
+ " ) </br>";
|
||||||
|
}
|
||||||
ui->m_version_label->setText(str + compilation_info);
|
ui->m_version_label->setText(str + compilation_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief AboutQETDialog::setLibraries
|
||||||
|
*/
|
||||||
void AboutQETDialog::setLibraries()
|
void AboutQETDialog::setLibraries()
|
||||||
{
|
{
|
||||||
addLibrary(ui->m_libraries_label, "KDE lib", "https://api.kde.org");
|
addLibrary(ui->m_libraries_label, "KDE lib", "https://api.kde.org");
|
||||||
@@ -156,19 +232,22 @@ void AboutQETDialog::setLibraries()
|
|||||||
addLibrary(ui->m_libraries_label, "pugixml", "https://pugixml.org");
|
addLibrary(ui->m_libraries_label, "pugixml", "https://pugixml.org");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief AboutQETDialog::setLicence
|
||||||
|
*/
|
||||||
void AboutQETDialog::setLicence()
|
void AboutQETDialog::setLicence()
|
||||||
{
|
{
|
||||||
ui->m_license_text_edit->setPlainText(QET::license());
|
ui->m_license_text_edit->setPlainText(QET::license());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief AboutQETDialog::addAuthor
|
@brief AboutQETDialog::addAuthor
|
||||||
* Adds a person to the list of authors
|
Adds a person to the list of authors
|
||||||
* @param label : QLabel which will add the person
|
@param label : QLabel which will add the person
|
||||||
* @param name : Name of person
|
@param name : Name of person
|
||||||
* @param email : E-mail address of the person
|
@param email : E-mail address of the person
|
||||||
* @param work : Function / work done by the person
|
@param work : Function / work done by the person
|
||||||
*/
|
*/
|
||||||
void AboutQETDialog::addAuthor(QLabel *label, const QString &name, const QString &email, const QString &work)
|
void AboutQETDialog::addAuthor(QLabel *label, const QString &name, const QString &email, const QString &work)
|
||||||
{
|
{
|
||||||
QString new_text = label->text();
|
QString new_text = label->text();
|
||||||
@@ -180,6 +259,12 @@ void AboutQETDialog::addAuthor(QLabel *label, const QString &name, const QString
|
|||||||
label->setText(new_text);
|
label->setText(new_text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief AboutQETDialog::addLibrary
|
||||||
|
@param label
|
||||||
|
@param name
|
||||||
|
@param link
|
||||||
|
*/
|
||||||
void AboutQETDialog::addLibrary(QLabel *label, const QString &name, const QString &link)
|
void AboutQETDialog::addLibrary(QLabel *label, const QString &name, const QString &link)
|
||||||
{
|
{
|
||||||
QString new_text = label->text();
|
QString new_text = label->text();
|
||||||
|
|||||||
@@ -26,6 +26,9 @@ namespace Ui {
|
|||||||
class AboutQETDialog;
|
class AboutQETDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief The AboutQETDialog class
|
||||||
|
*/
|
||||||
class AboutQETDialog : public QDialog
|
class AboutQETDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -42,8 +45,13 @@ class AboutQETDialog : public QDialog
|
|||||||
void setVersion();
|
void setVersion();
|
||||||
void setLibraries();
|
void setLibraries();
|
||||||
void setLicence();
|
void setLicence();
|
||||||
void addAuthor(QLabel *label, const QString &name, const QString &email, const QString &work);
|
void addAuthor(QLabel *label,
|
||||||
void addLibrary(QLabel *label, const QString &name, const QString &link);
|
const QString &name,
|
||||||
|
const QString &email,
|
||||||
|
const QString &work);
|
||||||
|
void addLibrary(QLabel *label,
|
||||||
|
const QString &name,
|
||||||
|
const QString &link);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::AboutQETDialog *ui;
|
Ui::AboutQETDialog *ui;
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ BOMExportDialog::BOMExportDialog(QETProject *project, QWidget *parent) :
|
|||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) // ### Qt 6: remove
|
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) // ### Qt 6: remove
|
||||||
connect(&m_button_group, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), [this](int id)
|
connect(&m_button_group, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), [this](int id)
|
||||||
#else
|
#else
|
||||||
|
#pragma message("@TODO remove code for QT 5.15 or later")
|
||||||
connect(&m_button_group, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::idClicked), [this](int id)
|
connect(&m_button_group, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::idClicked), [this](int id)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
@@ -154,6 +155,7 @@ int BOMExportDialog::exec()
|
|||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) // ### Qt 6: remove
|
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) // ### Qt 6: remove
|
||||||
stream << getBom() << endl;
|
stream << getBom() << endl;
|
||||||
#else
|
#else
|
||||||
|
#pragma message("@TODO remove code for QT 5.15 or later")
|
||||||
stream << getBom() << &Qt::endl(stream);
|
stream << getBom() << &Qt::endl(stream);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ CompositeTextEditDialog::CompositeTextEditDialog(DynamicElementTextItem *text, Q
|
|||||||
m_default_text = m_text->compositeText();
|
m_default_text = m_text->compositeText();
|
||||||
ui->m_plain_text_edit->setPlainText(m_default_text);
|
ui->m_plain_text_edit->setPlainText(m_default_text);
|
||||||
#if QT_VERSION >= 0x050300
|
#if QT_VERSION >= 0x050300
|
||||||
|
#pragma message("@TODO remove code for QT 5.3 or later")
|
||||||
ui->m_plain_text_edit->setPlaceholderText(tr("Entrée votre texte composé ici, en vous aidant des variables disponible"));
|
ui->m_plain_text_edit->setPlaceholderText(tr("Entrée votre texte composé ici, en vous aidant des variables disponible"));
|
||||||
#endif
|
#endif
|
||||||
setUpComboBox();
|
setUpComboBox();
|
||||||
@@ -29,6 +30,7 @@ CompositeTextEditDialog::CompositeTextEditDialog(QString text, QWidget *parent)
|
|||||||
m_default_text = std::move(text);
|
m_default_text = std::move(text);
|
||||||
ui->m_plain_text_edit->setPlainText(m_default_text);
|
ui->m_plain_text_edit->setPlainText(m_default_text);
|
||||||
#if QT_VERSION >= 0x050300
|
#if QT_VERSION >= 0x050300
|
||||||
|
#pragma message("@TODO remove code for QT 5.3 or later")
|
||||||
ui->m_plain_text_edit->setPlaceholderText(tr("Entrée votre texte composé ici, en vous aidant des variables disponible"));
|
ui->m_plain_text_edit->setPlaceholderText(tr("Entrée votre texte composé ici, en vous aidant des variables disponible"));
|
||||||
#endif
|
#endif
|
||||||
setUpComboBox();
|
setUpComboBox();
|
||||||
|
|||||||
@@ -25,11 +25,11 @@
|
|||||||
#include <linkelementcommand.h>
|
#include <linkelementcommand.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief MasterPropertiesWidget::MasterPropertiesWidget
|
@brief MasterPropertiesWidget::MasterPropertiesWidget
|
||||||
* Default constructor
|
Default constructor
|
||||||
* @param elmt
|
@param elmt
|
||||||
* @param parent
|
@param parent
|
||||||
*/
|
*/
|
||||||
MasterPropertiesWidget::MasterPropertiesWidget(Element *elmt, QWidget *parent) :
|
MasterPropertiesWidget::MasterPropertiesWidget(Element *elmt, QWidget *parent) :
|
||||||
AbstractElementPropertiesEditorWidget(parent),
|
AbstractElementPropertiesEditorWidget(parent),
|
||||||
ui(new Ui::MasterPropertiesWidget),
|
ui(new Ui::MasterPropertiesWidget),
|
||||||
@@ -43,10 +43,16 @@ MasterPropertiesWidget::MasterPropertiesWidget(Element *elmt, QWidget *parent) :
|
|||||||
QStringList list;
|
QStringList list;
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
if (settings.value("genericpanel/folio", false).toBool()) {
|
if (settings.value("genericpanel/folio", false).toBool()) {
|
||||||
list << tr("Vignette") << tr("Label de folio") << tr("Titre de folio") << tr("Position");
|
list << tr("Vignette")
|
||||||
|
<< tr("Label de folio")
|
||||||
|
<< tr("Titre de folio")
|
||||||
|
<< tr("Position");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
list << tr("Vignette") << tr("N° de folio") << tr("Titre de folio") << tr("Position");
|
list << tr("Vignette")
|
||||||
|
<< tr("N° de folio")
|
||||||
|
<< tr("Titre de folio")
|
||||||
|
<< tr("Position");
|
||||||
}
|
}
|
||||||
ui->m_free_tree_widget->setHeaderLabels(list);
|
ui->m_free_tree_widget->setHeaderLabels(list);
|
||||||
ui->m_link_tree_widget->setHeaderLabels(list);
|
ui->m_link_tree_widget->setHeaderLabels(list);
|
||||||
@@ -58,15 +64,22 @@ MasterPropertiesWidget::MasterPropertiesWidget(Element *elmt, QWidget *parent) :
|
|||||||
m_show_element = new QAction(tr("Montrer l'élément maître"), this);
|
m_show_element = new QAction(tr("Montrer l'élément maître"), this);
|
||||||
m_save_header_state = new QAction(tr("Enregistrer la disposition"), this);
|
m_save_header_state = new QAction(tr("Enregistrer la disposition"), this);
|
||||||
|
|
||||||
connect(ui->m_free_tree_widget, &QTreeWidget::itemDoubleClicked, this, &MasterPropertiesWidget::showElementFromTWI);
|
connect(ui->m_free_tree_widget, &QTreeWidget::itemDoubleClicked,
|
||||||
connect(ui->m_link_tree_widget, &QTreeWidget::itemDoubleClicked, this, &MasterPropertiesWidget::showElementFromTWI);
|
this, &MasterPropertiesWidget::showElementFromTWI);
|
||||||
|
connect(ui->m_link_tree_widget, &QTreeWidget::itemDoubleClicked,
|
||||||
|
this, &MasterPropertiesWidget::showElementFromTWI);
|
||||||
|
|
||||||
connect(ui->m_free_tree_widget, &QTreeWidget::customContextMenuRequested, [this](QPoint point) {this->customContextMenu(point, 1);});
|
connect(ui->m_free_tree_widget, &QTreeWidget::customContextMenuRequested,
|
||||||
connect(ui->m_link_tree_widget, &QTreeWidget::customContextMenuRequested, [this](QPoint point) {this->customContextMenu(point, 2);});
|
[this](QPoint point) {this->customContextMenu(point, 1);});
|
||||||
|
connect(ui->m_link_tree_widget, &QTreeWidget::customContextMenuRequested,
|
||||||
|
[this](QPoint point) {this->customContextMenu(point, 2);});
|
||||||
|
|
||||||
connect(m_link_action, &QAction::triggered, this, &MasterPropertiesWidget::on_link_button_clicked);
|
connect(m_link_action, &QAction::triggered,
|
||||||
connect(m_unlink_action, &QAction::triggered, this, &MasterPropertiesWidget::on_unlink_button_clicked);
|
this, &MasterPropertiesWidget::on_link_button_clicked);
|
||||||
connect(m_show_qtwi, &QAction::triggered, [this]() {this->showElementFromTWI(this->m_qtwi_at_context_menu,0);});
|
connect(m_unlink_action, &QAction::triggered,
|
||||||
|
this, &MasterPropertiesWidget::on_unlink_button_clicked);
|
||||||
|
connect(m_show_qtwi, &QAction::triggered,
|
||||||
|
[this]() {this->showElementFromTWI(this->m_qtwi_at_context_menu,0);});
|
||||||
|
|
||||||
connect(m_show_element, &QAction::triggered, [this]()
|
connect(m_show_element, &QAction::triggered, [this]()
|
||||||
{
|
{
|
||||||
@@ -78,7 +91,8 @@ MasterPropertiesWidget::MasterPropertiesWidget(Element *elmt, QWidget *parent) :
|
|||||||
|
|
||||||
QHeaderView *qhv = ui->m_free_tree_widget->header();
|
QHeaderView *qhv = ui->m_free_tree_widget->header();
|
||||||
qhv->setContextMenuPolicy(Qt::CustomContextMenu);
|
qhv->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
connect(qhv, &QHeaderView::customContextMenuRequested, this, &MasterPropertiesWidget::headerCustomContextMenuRequested);
|
connect(qhv, &QHeaderView::customContextMenuRequested,
|
||||||
|
this, &MasterPropertiesWidget::headerCustomContextMenuRequested);
|
||||||
connect(m_save_header_state, &QAction::triggered, [qhv]()
|
connect(m_save_header_state, &QAction::triggered, [qhv]()
|
||||||
{
|
{
|
||||||
QByteArray qba = qhv->saveState();
|
QByteArray qba = qhv->saveState();
|
||||||
@@ -90,9 +104,9 @@ MasterPropertiesWidget::MasterPropertiesWidget(Element *elmt, QWidget *parent) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief MasterPropertiesWidget::~MasterPropertiesWidget
|
@brief MasterPropertiesWidget::~MasterPropertiesWidget
|
||||||
* Destructor
|
Destructor
|
||||||
*/
|
*/
|
||||||
MasterPropertiesWidget::~MasterPropertiesWidget()
|
MasterPropertiesWidget::~MasterPropertiesWidget()
|
||||||
{
|
{
|
||||||
if (m_showed_element)
|
if (m_showed_element)
|
||||||
@@ -105,10 +119,10 @@ MasterPropertiesWidget::~MasterPropertiesWidget()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief MasterPropertiesWidget::setElement
|
@brief MasterPropertiesWidget::setElement
|
||||||
* Set the element to be edited
|
Set the element to be edited
|
||||||
* @param element
|
@param element
|
||||||
*/
|
*/
|
||||||
void MasterPropertiesWidget::setElement(Element *element)
|
void MasterPropertiesWidget::setElement(Element *element)
|
||||||
{
|
{
|
||||||
if (m_element == element)
|
if (m_element == element)
|
||||||
@@ -123,32 +137,37 @@ void MasterPropertiesWidget::setElement(Element *element)
|
|||||||
m_element->setHighlighted(false);
|
m_element->setHighlighted(false);
|
||||||
|
|
||||||
if (m_project)
|
if (m_project)
|
||||||
disconnect(m_project, SIGNAL(diagramRemoved(QETProject*,Diagram*)), this, SLOT(diagramWasdeletedFromProject()));
|
disconnect(m_project, SIGNAL(diagramRemoved(QETProject*,Diagram*)),
|
||||||
|
this, SLOT(diagramWasdeletedFromProject()));
|
||||||
|
|
||||||
if(Q_LIKELY(element->diagram() && element->diagram()->project()))
|
if(Q_LIKELY(element->diagram() && element->diagram()->project()))
|
||||||
{
|
{
|
||||||
m_project = element->diagram()->project();
|
m_project = element->diagram()->project();
|
||||||
connect(m_project, SIGNAL(diagramRemoved(QETProject*,Diagram*)), this, SLOT(diagramWasdeletedFromProject()));
|
connect(m_project, SIGNAL(diagramRemoved(QETProject*,Diagram*)),
|
||||||
|
this, SLOT(diagramWasdeletedFromProject()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_project = nullptr;
|
m_project = nullptr;
|
||||||
|
|
||||||
//Keep up to date this widget when the linked elements of m_element change
|
//Keep up to date this widget when the linked elements of m_element change
|
||||||
if (m_element)
|
if (m_element)
|
||||||
disconnect(m_element.data(), &Element::linkedElementChanged, this, &MasterPropertiesWidget::updateUi);
|
disconnect(m_element.data(), &Element::linkedElementChanged,
|
||||||
|
this, &MasterPropertiesWidget::updateUi);
|
||||||
|
|
||||||
m_element = element;
|
m_element = element;
|
||||||
connect(m_element.data(), &Element::linkedElementChanged, this, &MasterPropertiesWidget::updateUi);
|
connect(m_element.data(), &Element::linkedElementChanged,
|
||||||
|
this, &MasterPropertiesWidget::updateUi);
|
||||||
|
|
||||||
updateUi();
|
updateUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief MasterPropertiesWidget::apply
|
@brief MasterPropertiesWidget::apply
|
||||||
* If link betwen edited element and other change,
|
If link betwen edited element and other change,
|
||||||
* apply the change with a QUndoCommand (got with method associatedUndo)
|
apply the change with a QUndoCommand (got with method associatedUndo)
|
||||||
* pushed to the stack of element project.
|
pushed to the stack of element project.
|
||||||
* Return true if link change, else false
|
Return true if link change, else false
|
||||||
|
@note is void no Return ???
|
||||||
*/
|
*/
|
||||||
void MasterPropertiesWidget::apply() {
|
void MasterPropertiesWidget::apply() {
|
||||||
if (QUndoCommand *undo = associatedUndo())
|
if (QUndoCommand *undo = associatedUndo())
|
||||||
@@ -156,9 +175,9 @@ void MasterPropertiesWidget::apply() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief MasterPropertiesWidget::reset
|
@brief MasterPropertiesWidget::reset
|
||||||
* Reset curent widget, clear eveything and rebuild widget.
|
Reset curent widget, clear eveything and rebuild widget.
|
||||||
*/
|
*/
|
||||||
void MasterPropertiesWidget::reset()
|
void MasterPropertiesWidget::reset()
|
||||||
{
|
{
|
||||||
foreach (QTreeWidgetItem *qtwi, m_qtwi_hash.keys())
|
foreach (QTreeWidgetItem *qtwi, m_qtwi_hash.keys())
|
||||||
@@ -169,12 +188,12 @@ void MasterPropertiesWidget::reset()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief MasterPropertiesWidget::associatedUndo
|
@brief MasterPropertiesWidget::associatedUndo
|
||||||
* If link between the edited element and other change,
|
If link between the edited element and other change,
|
||||||
* return a QUndoCommand with this change.
|
return a QUndoCommand with this change.
|
||||||
* If no change return nullptr.
|
If no change return nullptr.
|
||||||
* @return
|
@return
|
||||||
*/
|
*/
|
||||||
QUndoCommand* MasterPropertiesWidget::associatedUndo() const
|
QUndoCommand* MasterPropertiesWidget::associatedUndo() const
|
||||||
{
|
{
|
||||||
QList <Element *> to_link;
|
QList <Element *> to_link;
|
||||||
@@ -207,11 +226,11 @@ QUndoCommand* MasterPropertiesWidget::associatedUndo() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief MasterPropertiesWidget::setLiveEdit
|
@brief MasterPropertiesWidget::setLiveEdit
|
||||||
* @param live_edit = true : live edit is enable
|
@param live_edit = true : live edit is enable
|
||||||
* else false : live edit is disable.
|
else false : live edit is disable.
|
||||||
* @return always true because live edit is handled by this editor widget
|
@return always true because live edit is handled by this editor widget
|
||||||
*/
|
*/
|
||||||
bool MasterPropertiesWidget::setLiveEdit(bool live_edit)
|
bool MasterPropertiesWidget::setLiveEdit(bool live_edit)
|
||||||
{
|
{
|
||||||
m_live_edit = live_edit;
|
m_live_edit = live_edit;
|
||||||
@@ -219,9 +238,9 @@ bool MasterPropertiesWidget::setLiveEdit(bool live_edit)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief MasterPropertiesWidget::updateUi
|
@brief MasterPropertiesWidget::updateUi
|
||||||
* Build the interface of the widget
|
Build the interface of the widget
|
||||||
*/
|
*/
|
||||||
void MasterPropertiesWidget::updateUi()
|
void MasterPropertiesWidget::updateUi()
|
||||||
{
|
{
|
||||||
ui->m_free_tree_widget->clear();
|
ui->m_free_tree_widget->clear();
|
||||||
@@ -245,17 +264,24 @@ void MasterPropertiesWidget::updateUi()
|
|||||||
if(settings.value("genericpanel/folio", false).toBool())
|
if(settings.value("genericpanel/folio", false).toBool())
|
||||||
{
|
{
|
||||||
autonum::sequentialNumbers seq;
|
autonum::sequentialNumbers seq;
|
||||||
QString F =autonum::AssignVariables::formulaToLabel(elmt->diagram()->border_and_titleblock.folio(), seq, elmt->diagram(), elmt);
|
QString F =autonum::AssignVariables::formulaToLabel(
|
||||||
|
elmt->diagram()->border_and_titleblock.folio(),
|
||||||
|
seq,
|
||||||
|
elmt->diagram(),
|
||||||
|
elmt);
|
||||||
qtwi->setText(1, F);
|
qtwi->setText(1, F);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qtwi->setText(1, QString::number(elmt->diagram()->folioIndex() + 1));
|
qtwi->setText(1, QString::number(
|
||||||
|
elmt->diagram()->folioIndex()
|
||||||
|
+ 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
qtwi->setText(2, elmt->diagram()->title());
|
qtwi->setText(2, elmt->diagram()->title());
|
||||||
qtwi->setText(4, elmt->diagram()->convertPosition(elmt->scenePos()).toString());
|
qtwi->setText(4, elmt->diagram()->convertPosition(
|
||||||
|
elmt->scenePos()).toString());
|
||||||
items_list.append(qtwi);
|
items_list.append(qtwi);
|
||||||
m_qtwi_hash.insert(qtwi, elmt);
|
m_qtwi_hash.insert(qtwi, elmt);
|
||||||
}
|
}
|
||||||
@@ -273,16 +299,23 @@ void MasterPropertiesWidget::updateUi()
|
|||||||
if(settings.value("genericpanel/folio", false).toBool())
|
if(settings.value("genericpanel/folio", false).toBool())
|
||||||
{
|
{
|
||||||
autonum::sequentialNumbers seq;
|
autonum::sequentialNumbers seq;
|
||||||
QString F =autonum::AssignVariables::formulaToLabel(elmt->diagram()->border_and_titleblock.folio(), seq, elmt->diagram(), elmt);
|
QString F =autonum::AssignVariables::formulaToLabel(
|
||||||
|
elmt->diagram()->border_and_titleblock.folio(),
|
||||||
|
seq,
|
||||||
|
elmt->diagram(),
|
||||||
|
elmt);
|
||||||
qtwi->setText(1, F);
|
qtwi->setText(1, F);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qtwi->setText(1, QString::number(elmt->diagram()->folioIndex() + 1));
|
qtwi->setText(1, QString::number(
|
||||||
|
elmt->diagram()->folioIndex()
|
||||||
|
+ 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
qtwi->setText(2, elmt->diagram()->title());
|
qtwi->setText(2, elmt->diagram()->title());
|
||||||
qtwi->setText(3, elmt->diagram()->convertPosition(elmt->scenePos()).toString());
|
qtwi->setText(3, elmt->diagram()->convertPosition(
|
||||||
|
elmt->scenePos()).toString());
|
||||||
items_list.append(qtwi);
|
items_list.append(qtwi);
|
||||||
m_qtwi_hash.insert(qtwi, elmt);
|
m_qtwi_hash.insert(qtwi, elmt);
|
||||||
}
|
}
|
||||||
@@ -298,6 +331,10 @@ void MasterPropertiesWidget::updateUi()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief MasterPropertiesWidget::headerCustomContextMenuRequested
|
||||||
|
@param pos
|
||||||
|
*/
|
||||||
void MasterPropertiesWidget::headerCustomContextMenuRequested(const QPoint &pos)
|
void MasterPropertiesWidget::headerCustomContextMenuRequested(const QPoint &pos)
|
||||||
{
|
{
|
||||||
m_context_menu->clear();
|
m_context_menu->clear();
|
||||||
@@ -306,16 +343,17 @@ void MasterPropertiesWidget::headerCustomContextMenuRequested(const QPoint &pos)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief MasterPropertiesWidget::on_link_button_clicked
|
@brief MasterPropertiesWidget::on_link_button_clicked
|
||||||
* move curent item in the free_list to linked_list
|
move curent item in the free_list to linked_list
|
||||||
*/
|
*/
|
||||||
void MasterPropertiesWidget::on_link_button_clicked()
|
void MasterPropertiesWidget::on_link_button_clicked()
|
||||||
{
|
{
|
||||||
//take the curent item from free_list and push it to linked_list
|
//take the curent item from free_list and push it to linked_list
|
||||||
QTreeWidgetItem *qtwi = ui->m_free_tree_widget->currentItem();
|
QTreeWidgetItem *qtwi = ui->m_free_tree_widget->currentItem();
|
||||||
if (qtwi)
|
if (qtwi)
|
||||||
{
|
{
|
||||||
ui->m_free_tree_widget->takeTopLevelItem(ui->m_free_tree_widget->indexOfTopLevelItem(qtwi));
|
ui->m_free_tree_widget->takeTopLevelItem(
|
||||||
|
ui->m_free_tree_widget->indexOfTopLevelItem(qtwi));
|
||||||
ui->m_link_tree_widget->insertTopLevelItem(0, qtwi);
|
ui->m_link_tree_widget->insertTopLevelItem(0, qtwi);
|
||||||
|
|
||||||
if(m_live_edit)
|
if(m_live_edit)
|
||||||
@@ -324,16 +362,17 @@ void MasterPropertiesWidget::on_link_button_clicked()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief MasterPropertiesWidget::on_unlink_button_clicked
|
@brief MasterPropertiesWidget::on_unlink_button_clicked
|
||||||
* move curent item in linked_list to free_list
|
move curent item in linked_list to free_list
|
||||||
*/
|
*/
|
||||||
void MasterPropertiesWidget::on_unlink_button_clicked()
|
void MasterPropertiesWidget::on_unlink_button_clicked()
|
||||||
{
|
{
|
||||||
//take the curent item from linked_list and push it to free_list
|
//take the curent item from linked_list and push it to free_list
|
||||||
QTreeWidgetItem *qtwi = ui->m_link_tree_widget->currentItem();
|
QTreeWidgetItem *qtwi = ui->m_link_tree_widget->currentItem();
|
||||||
if(qtwi)
|
if(qtwi)
|
||||||
{
|
{
|
||||||
ui->m_link_tree_widget->takeTopLevelItem(ui->m_link_tree_widget->indexOfTopLevelItem(qtwi));
|
ui->m_link_tree_widget->takeTopLevelItem(
|
||||||
|
ui->m_link_tree_widget->indexOfTopLevelItem(qtwi));
|
||||||
ui->m_free_tree_widget->insertTopLevelItem(0, qtwi);
|
ui->m_free_tree_widget->insertTopLevelItem(0, qtwi);
|
||||||
|
|
||||||
if(m_live_edit)
|
if(m_live_edit)
|
||||||
@@ -342,17 +381,18 @@ void MasterPropertiesWidget::on_unlink_button_clicked()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief MasterPropertiesWidget::showElementFromTWI
|
@brief MasterPropertiesWidget::showElementFromTWI
|
||||||
* Show the element corresponding to the given QTreeWidgetItem
|
Show the element corresponding to the given QTreeWidgetItem
|
||||||
* @param qtwi
|
@param qtwi
|
||||||
* @param column
|
@param column
|
||||||
*/
|
*/
|
||||||
void MasterPropertiesWidget::showElementFromTWI(QTreeWidgetItem *qtwi, int column)
|
void MasterPropertiesWidget::showElementFromTWI(QTreeWidgetItem *qtwi, int column)
|
||||||
{
|
{
|
||||||
Q_UNUSED(column);
|
Q_UNUSED(column);
|
||||||
if (m_showed_element)
|
if (m_showed_element)
|
||||||
{
|
{
|
||||||
disconnect(m_showed_element, SIGNAL(destroyed()), this, SLOT(showedElementWasDeleted()));
|
disconnect(m_showed_element, SIGNAL(destroyed()),
|
||||||
|
this, SLOT(showedElementWasDeleted()));
|
||||||
m_showed_element -> setHighlighted(false);
|
m_showed_element -> setHighlighted(false);
|
||||||
}
|
}
|
||||||
if (m_element)
|
if (m_element)
|
||||||
@@ -361,39 +401,44 @@ void MasterPropertiesWidget::showElementFromTWI(QTreeWidgetItem *qtwi, int colum
|
|||||||
m_showed_element = m_qtwi_hash[qtwi];
|
m_showed_element = m_qtwi_hash[qtwi];
|
||||||
m_showed_element->diagram()->showMe();
|
m_showed_element->diagram()->showMe();
|
||||||
m_showed_element->setHighlighted(true);
|
m_showed_element->setHighlighted(true);
|
||||||
connect(m_showed_element, SIGNAL(destroyed()), this, SLOT(showedElementWasDeleted()));
|
connect(m_showed_element, SIGNAL(destroyed()),
|
||||||
|
this, SLOT(showedElementWasDeleted()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief MasterPropertiesWidget::showedElementWasDeleted
|
@brief MasterPropertiesWidget::showedElementWasDeleted
|
||||||
* Set to nullptr the current showed element when he was deleted
|
Set to nullptr the current showed element when he was deleted
|
||||||
*/
|
*/
|
||||||
void MasterPropertiesWidget::showedElementWasDeleted() {
|
void MasterPropertiesWidget::showedElementWasDeleted() {
|
||||||
m_showed_element = nullptr;
|
m_showed_element = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief MasterPropertiesWidget::diagramWasdeletedFromProject
|
@brief MasterPropertiesWidget::diagramWasdeletedFromProject
|
||||||
* This slot is called when a diagram is removed from the parent project of edited element
|
This slot is called when a diagram is removed from the parent project
|
||||||
* to update the content of this widget
|
of edited element to update the content of this widget
|
||||||
*/
|
*/
|
||||||
void MasterPropertiesWidget::diagramWasdeletedFromProject()
|
void MasterPropertiesWidget::diagramWasdeletedFromProject()
|
||||||
{
|
{
|
||||||
//We use a timer because if the removed diagram contain slave element linked to the edited element
|
// We use a timer because if the removed diagram
|
||||||
//we must to wait for this elements be unlinked, else the linked list provide deleted elements.
|
// contain slave element linked to the edited element
|
||||||
|
// we must to wait for this elements be unlinked,
|
||||||
|
// else the linked list provide deleted elements.
|
||||||
QTimer::singleShot(10, this, SLOT(updateUi()));
|
QTimer::singleShot(10, this, SLOT(updateUi()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief MasterPropertiesWidget::customContextMenu
|
@brief MasterPropertiesWidget::customContextMenu
|
||||||
* Display a context menu
|
Display a context menu
|
||||||
* @param pos
|
@param pos
|
||||||
* @param i : the tree widget where the context menu was requested.
|
@param i : the tree widget where the context menu was requested.
|
||||||
*/
|
*/
|
||||||
void MasterPropertiesWidget::customContextMenu(const QPoint &pos, int i)
|
void MasterPropertiesWidget::customContextMenu(const QPoint &pos, int i)
|
||||||
{
|
{
|
||||||
//add the size of the header to display the topleft of the QMenu at the position of the mouse.
|
// add the size of the header to display the topleft of the QMenu
|
||||||
//See doc about QWidget::customContextMenuRequested section related to QAbstractScrollArea
|
// at the position of the mouse.
|
||||||
|
// See doc about QWidget::customContextMenuRequested
|
||||||
|
// section related to QAbstractScrollArea
|
||||||
QPoint point = pos;
|
QPoint point = pos;
|
||||||
point.ry()+=ui->m_free_tree_widget->header()->height();
|
point.ry()+=ui->m_free_tree_widget->header()->height();
|
||||||
|
|
||||||
|
|||||||
@@ -35,24 +35,30 @@ namespace Ui {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The MasterPropertiesWidget class
|
@brief The MasterPropertiesWidget class
|
||||||
* This class is a widget for make link between a master element with several slave element.
|
This class is a widget for make link between a master element
|
||||||
* This class embenddedthe undo/redo command when apply new connection.
|
with several slave element.
|
||||||
*/
|
This class embenddedthe undo/redo command when apply new connection.
|
||||||
|
*/
|
||||||
class MasterPropertiesWidget : public AbstractElementPropertiesEditorWidget
|
class MasterPropertiesWidget : public AbstractElementPropertiesEditorWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit MasterPropertiesWidget(Element *elmt, QWidget *parent = nullptr);
|
explicit MasterPropertiesWidget(Element *elmt,
|
||||||
|
QWidget *parent = nullptr);
|
||||||
~MasterPropertiesWidget() override;
|
~MasterPropertiesWidget() override;
|
||||||
|
|
||||||
void setElement (Element *element) override;
|
void setElement (Element *element) override;
|
||||||
void apply() override;
|
void apply() override;
|
||||||
void reset() override;
|
void reset() override;
|
||||||
QUndoCommand *associatedUndo () const override;
|
QUndoCommand *associatedUndo () const override;
|
||||||
QString title() const override {return tr("Référence croisée (maître)");}
|
/**
|
||||||
|
* @brief title
|
||||||
|
* @return QString title
|
||||||
|
*/
|
||||||
|
QString title() const override {
|
||||||
|
return tr("Référence croisée (maître)");}
|
||||||
bool setLiveEdit(bool live_edit) override;
|
bool setLiveEdit(bool live_edit) override;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ m_diagram(diagram)
|
|||||||
#if QT_VERSION >= 0x050900
|
#if QT_VERSION >= 0x050900
|
||||||
else
|
else
|
||||||
setObsolete(true);
|
setObsolete(true);
|
||||||
|
#pragma message("@TODO remove code for QT 5.9 or later")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -135,6 +136,7 @@ void RotateTextsCommand::openDialog()
|
|||||||
#if QT_VERSION >= 0x050900
|
#if QT_VERSION >= 0x050900
|
||||||
else
|
else
|
||||||
setObsolete(true);
|
setObsolete(true);
|
||||||
|
#pragma message("@TODO remove code for QT 5.9 or later")
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user