[qet] qet/qet: [4904] Minor : remove a signal in diagram and use directly a signal of qetproject |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 4904
Author: blacksun
Date: 2017-02-09 12:07:45 +0100 (Thu, 09 Feb 2017)
Log Message:
-----------
Minor : remove a signal in diagram and use directly a signal of qetproject
Modified Paths:
--------------
trunk/sources/diagram.cpp
trunk/sources/diagram.h
trunk/sources/qetgraphicsitem/reportelement.cpp
trunk/sources/qetgraphicsitem/reportelement.h
trunk/sources/qetproject.cpp
trunk/sources/qetproject.h
Modified: trunk/sources/diagram.cpp
===================================================================
--- trunk/sources/diagram.cpp 2017-02-06 20:45:55 UTC (rev 4903)
+++ trunk/sources/diagram.cpp 2017-02-09 11:07:45 UTC (rev 4904)
@@ -1697,15 +1697,11 @@
if (m_project == project) return;
if (m_project)
- {
- disconnect (m_project, SIGNAL(reportPropertiesChanged(QString)), this, SIGNAL(reportPropertiesChanged(QString)));
disconnect (m_project, SIGNAL(XRefPropertiesChanged()), this, SIGNAL(XRefPropertiesChanged()));
- }
m_project = project;
setParent (project);
-
- connect (m_project, SIGNAL(reportPropertiesChanged(QString)), this, SIGNAL(reportPropertiesChanged(QString)));
+
connect (m_project, SIGNAL(XRefPropertiesChanged()), this, SIGNAL(XRefPropertiesChanged()));
}
Modified: trunk/sources/diagram.h
===================================================================
--- trunk/sources/diagram.h 2017-02-06 20:45:55 UTC (rev 4903)
+++ trunk/sources/diagram.h 2017-02-09 11:07:45 UTC (rev 4904)
@@ -255,7 +255,6 @@
void diagramTitleChanged(Diagram *, const QString &);
void findElementRequired(const ElementsLocation &); /// Signal emitted when users wish to locate an element from the diagram within elements collection
void editElementRequired(const ElementsLocation &); /// Signal emitted when users wish to edit an element from the diagram
- void reportPropertiesChanged(QString);
void XRefPropertiesChanged();
void diagramActivated();
};
Modified: trunk/sources/qetgraphicsitem/reportelement.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/reportelement.cpp 2017-02-06 20:45:55 UTC (rev 4903)
+++ trunk/sources/qetgraphicsitem/reportelement.cpp 2017-02-09 11:07:45 UTC (rev 4904)
@@ -41,7 +41,7 @@
m_text_field -> setNoEditable();
link_type == "next_report"? link_type_=NextReport : link_type_=PreviousReport;
- link_type == "next_report"? inverse_report=PreviousReport : inverse_report=NextReport;
+ link_type == "next_report"? m_inverse_report=PreviousReport : m_inverse_report=NextReport;
//We make these connections, to be always aware about the conductor properties
if (terminals().size())
@@ -84,7 +84,7 @@
i = false;
//ensure elmt is an inverse report of this element
- if ((elmt->linkType() == inverse_report) && i)
+ if ((elmt->linkType() == m_inverse_report) && i)
{
unlinkAllElements();
connected_elements << elmt;
@@ -91,7 +91,7 @@
connect(elmt, SIGNAL( xChanged() ), this, SLOT( updateLabel() ));
connect(elmt, SIGNAL( yChanged() ), this, SLOT( updateLabel() ));
- connect(diagram(), SIGNAL( reportPropertiesChanged(QString) ), this, SLOT( setLabel(QString) ));
+ connect(diagram()->project(), &QETProject::reportPropertiesChanged, this, &ReportElement::reportPropertiesChange);
connect(diagram() -> project(), SIGNAL( projectDiagramsOrderChanged(QETProject*,int,int) ), this, SLOT( updateLabel() ));
if (elmt->terminals().size())
{
@@ -99,7 +99,7 @@
connect(elmt->terminals().first(), &Terminal::conductorWasRemoved, this, &ReportElement::conductorWasRemoved);
}
- label_ = diagram() -> defaultReportProperties();
+ m_label = diagram() -> defaultReportProperties();
if (!m_watched_conductor && elmt->conductors().size())
conductorWasAdded(elmt->conductors().first());
@@ -126,6 +126,7 @@
{
disconnect(elmt, SIGNAL(xChanged()), this, SLOT(updateLabel()));
disconnect(elmt, SIGNAL(yChanged()), this, SLOT(updateLabel()));
+ disconnect(diagram()->project(), &QETProject::reportPropertiesChanged, this, &ReportElement::reportPropertiesChange);
disconnect(diagram()->project(), SIGNAL(projectDiagramsOrderChanged(QETProject*,int,int)), this, SLOT(updateLabel()));
if (elmt->terminals().size())
{
@@ -202,7 +203,7 @@
* @param label new label
*/
void ReportElement::setLabel(QString label) {
- label_ = label;
+ m_label = label;
updateLabel();
}
@@ -218,7 +219,7 @@
if (!connected_elements.isEmpty())
{
Element *elmt = connected_elements.at(0);
- QString label = label_;
+ QString label = m_label;
label = autonum::AssignVariables::formulaToLabel(label, elmt->rSequenceStruct(), elmt->diagram(), elmt);
m_text_field -> setPlainText(label);
}
@@ -228,3 +229,9 @@
setTaggedText("function", (m_watched_conductor? m_watched_conductor->properties().m_function : ""));
setTaggedText("tension-protocol", (m_watched_conductor? m_watched_conductor->properties().m_tension_protocol : ""));
}
+
+void ReportElement::reportPropertiesChange(const QString &old_str, const QString &new_str)
+{
+ Q_UNUSED(old_str);
+ setLabel(new_str);
+}
Modified: trunk/sources/qetgraphicsitem/reportelement.h
===================================================================
--- trunk/sources/qetgraphicsitem/reportelement.h 2017-02-06 20:45:55 UTC (rev 4903)
+++ trunk/sources/qetgraphicsitem/reportelement.h 2017-02-09 11:07:45 UTC (rev 4904)
@@ -39,8 +39,8 @@
virtual void unlinkElement(Element *elmt);
private:
- int inverse_report;
- QString label_;
+ int m_inverse_report;
+ QString m_label;
ElementTextItem *m_text_field;
Conductor *m_watched_conductor;
@@ -51,6 +51,7 @@
private slots:
void setLabel (QString label);
void updateLabel();
+ void reportPropertiesChange(const QString &old_str, const QString &new_str);
};
#endif // REPORTELEMENT_H
Modified: trunk/sources/qetproject.cpp
===================================================================
--- trunk/sources/qetproject.cpp 2017-02-06 20:45:55 UTC (rev 4903)
+++ trunk/sources/qetproject.cpp 2017-02-09 11:07:45 UTC (rev 4904)
@@ -383,12 +383,15 @@
}
QString QETProject::defaultReportProperties() const {
- return default_report_properties_;
+ return m_default_report_properties;
}
-void QETProject::setDefaultReportProperties(const QString &properties) {
- default_report_properties_ = properties;
- emit reportPropertiesChanged(properties);
+void QETProject::setDefaultReportProperties(const QString &properties)
+{
+ QString old = m_default_report_properties;
+ m_default_report_properties = properties;
+
+ emit reportPropertiesChanged(old, properties);
}
void QETProject::setDefaultXRefProperties(const QString type, const XRefProperties &properties) {
@@ -1345,7 +1348,7 @@
default_border_properties_ = BorderProperties:: defaultProperties();
default_titleblock_properties_ = TitleBlockProperties::defaultProperties();
default_conductor_properties_ = ConductorProperties:: defaultProperties();
- default_report_properties_ = ReportProperties:: defaultProperties();
+ m_default_report_properties = ReportProperties:: defaultProperties();
m_default_xref_properties = XRefProperties:: defaultProperties();
//Read values indicate in project
Modified: trunk/sources/qetproject.h
===================================================================
--- trunk/sources/qetproject.h 2017-02-06 20:45:55 UTC (rev 4903)
+++ trunk/sources/qetproject.h 2017-02-09 11:07:45 UTC (rev 4904)
@@ -183,7 +183,7 @@
void projectDiagramsOrderChanged(QETProject *, int, int);
void diagramUsedTemplate(TitleBlockTemplatesCollection *, const QString &);
void readOnlyChanged(QETProject *, bool);
- void reportPropertiesChanged(QString);
+ void reportPropertiesChanged(const QString &old_str, const QString &new_str);
void XRefPropertiesChanged ();
void addAutoNumDiagram();
void elementAutoNumAdded(QString name);
@@ -242,7 +242,7 @@
/// Default title block properties for new diagrams created within the project
TitleBlockProperties default_titleblock_properties_;
/// Default report properties
- QString default_report_properties_;
+ QString m_default_report_properties;
/// Default xref properties
QHash <QString, XRefProperties> m_default_xref_properties;
/// Embedded title block templates collection