mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-09-14 20:33:05 +02:00
Minor : remove a signal in diagram and use directly a signal of qetproject
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4904 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
parent
4b56501d1e
commit
9792e95e6f
@ -1697,15 +1697,11 @@ void Diagram::setProject(QETProject *project)
|
|||||||
if (m_project == project) return;
|
if (m_project == project) return;
|
||||||
|
|
||||||
if (m_project)
|
if (m_project)
|
||||||
{
|
|
||||||
disconnect (m_project, SIGNAL(reportPropertiesChanged(QString)), this, SIGNAL(reportPropertiesChanged(QString)));
|
|
||||||
disconnect (m_project, SIGNAL(XRefPropertiesChanged()), this, SIGNAL(XRefPropertiesChanged()));
|
disconnect (m_project, SIGNAL(XRefPropertiesChanged()), this, SIGNAL(XRefPropertiesChanged()));
|
||||||
}
|
|
||||||
|
|
||||||
m_project = project;
|
m_project = project;
|
||||||
setParent (project);
|
setParent (project);
|
||||||
|
|
||||||
connect (m_project, SIGNAL(reportPropertiesChanged(QString)), this, SIGNAL(reportPropertiesChanged(QString)));
|
|
||||||
connect (m_project, SIGNAL(XRefPropertiesChanged()), this, SIGNAL(XRefPropertiesChanged()));
|
connect (m_project, SIGNAL(XRefPropertiesChanged()), this, SIGNAL(XRefPropertiesChanged()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,7 +255,6 @@ class Diagram : public QGraphicsScene
|
|||||||
void diagramTitleChanged(Diagram *, const QString &);
|
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 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 editElementRequired(const ElementsLocation &); /// Signal emitted when users wish to edit an element from the diagram
|
||||||
void reportPropertiesChanged(QString);
|
|
||||||
void XRefPropertiesChanged();
|
void XRefPropertiesChanged();
|
||||||
void diagramActivated();
|
void diagramActivated();
|
||||||
};
|
};
|
||||||
|
@ -41,7 +41,7 @@ ReportElement::ReportElement(const ElementsLocation &location, QString link_type
|
|||||||
m_text_field -> setNoEditable();
|
m_text_field -> setNoEditable();
|
||||||
|
|
||||||
link_type == "next_report"? link_type_=NextReport : link_type_=PreviousReport;
|
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
|
//We make these connections, to be always aware about the conductor properties
|
||||||
if (terminals().size())
|
if (terminals().size())
|
||||||
@ -84,14 +84,14 @@ void ReportElement::linkToElement(Element * elmt)
|
|||||||
i = false;
|
i = false;
|
||||||
|
|
||||||
//ensure elmt is an inverse report of this element
|
//ensure elmt is an inverse report of this element
|
||||||
if ((elmt->linkType() == inverse_report) && i)
|
if ((elmt->linkType() == m_inverse_report) && i)
|
||||||
{
|
{
|
||||||
unlinkAllElements();
|
unlinkAllElements();
|
||||||
connected_elements << elmt;
|
connected_elements << elmt;
|
||||||
|
|
||||||
connect(elmt, SIGNAL( xChanged() ), this, SLOT( updateLabel() ));
|
connect(elmt, SIGNAL( xChanged() ), this, SLOT( updateLabel() ));
|
||||||
connect(elmt, SIGNAL( yChanged() ), 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() ));
|
connect(diagram() -> project(), SIGNAL( projectDiagramsOrderChanged(QETProject*,int,int) ), this, SLOT( updateLabel() ));
|
||||||
if (elmt->terminals().size())
|
if (elmt->terminals().size())
|
||||||
{
|
{
|
||||||
@ -99,7 +99,7 @@ void ReportElement::linkToElement(Element * elmt)
|
|||||||
connect(elmt->terminals().first(), &Terminal::conductorWasRemoved, this, &ReportElement::conductorWasRemoved);
|
connect(elmt->terminals().first(), &Terminal::conductorWasRemoved, this, &ReportElement::conductorWasRemoved);
|
||||||
}
|
}
|
||||||
|
|
||||||
label_ = diagram() -> defaultReportProperties();
|
m_label = diagram() -> defaultReportProperties();
|
||||||
|
|
||||||
if (!m_watched_conductor && elmt->conductors().size())
|
if (!m_watched_conductor && elmt->conductors().size())
|
||||||
conductorWasAdded(elmt->conductors().first());
|
conductorWasAdded(elmt->conductors().first());
|
||||||
@ -126,6 +126,7 @@ void ReportElement::unlinkAllElements()
|
|||||||
{
|
{
|
||||||
disconnect(elmt, SIGNAL(xChanged()), this, SLOT(updateLabel()));
|
disconnect(elmt, SIGNAL(xChanged()), this, SLOT(updateLabel()));
|
||||||
disconnect(elmt, SIGNAL(yChanged()), 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()));
|
disconnect(diagram()->project(), SIGNAL(projectDiagramsOrderChanged(QETProject*,int,int)), this, SLOT(updateLabel()));
|
||||||
if (elmt->terminals().size())
|
if (elmt->terminals().size())
|
||||||
{
|
{
|
||||||
@ -202,7 +203,7 @@ void ReportElement::conductorWasRemoved(Conductor *conductor)
|
|||||||
* @param label new label
|
* @param label new label
|
||||||
*/
|
*/
|
||||||
void ReportElement::setLabel(QString label) {
|
void ReportElement::setLabel(QString label) {
|
||||||
label_ = label;
|
m_label = label;
|
||||||
updateLabel();
|
updateLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,7 +219,7 @@ void ReportElement::updateLabel()
|
|||||||
if (!connected_elements.isEmpty())
|
if (!connected_elements.isEmpty())
|
||||||
{
|
{
|
||||||
Element *elmt = connected_elements.at(0);
|
Element *elmt = connected_elements.at(0);
|
||||||
QString label = label_;
|
QString label = m_label;
|
||||||
label = autonum::AssignVariables::formulaToLabel(label, elmt->rSequenceStruct(), elmt->diagram(), elmt);
|
label = autonum::AssignVariables::formulaToLabel(label, elmt->rSequenceStruct(), elmt->diagram(), elmt);
|
||||||
m_text_field -> setPlainText(label);
|
m_text_field -> setPlainText(label);
|
||||||
}
|
}
|
||||||
@ -228,3 +229,9 @@ void ReportElement::updateLabel()
|
|||||||
setTaggedText("function", (m_watched_conductor? m_watched_conductor->properties().m_function : ""));
|
setTaggedText("function", (m_watched_conductor? m_watched_conductor->properties().m_function : ""));
|
||||||
setTaggedText("tension-protocol", (m_watched_conductor? m_watched_conductor->properties().m_tension_protocol : ""));
|
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);
|
||||||
|
}
|
||||||
|
@ -39,8 +39,8 @@ class ReportElement : public CustomElement
|
|||||||
virtual void unlinkElement(Element *elmt);
|
virtual void unlinkElement(Element *elmt);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int inverse_report;
|
int m_inverse_report;
|
||||||
QString label_;
|
QString m_label;
|
||||||
ElementTextItem *m_text_field;
|
ElementTextItem *m_text_field;
|
||||||
Conductor *m_watched_conductor;
|
Conductor *m_watched_conductor;
|
||||||
|
|
||||||
@ -51,6 +51,7 @@ class ReportElement : public CustomElement
|
|||||||
private slots:
|
private slots:
|
||||||
void setLabel (QString label);
|
void setLabel (QString label);
|
||||||
void updateLabel();
|
void updateLabel();
|
||||||
|
void reportPropertiesChange(const QString &old_str, const QString &new_str);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // REPORTELEMENT_H
|
#endif // REPORTELEMENT_H
|
||||||
|
@ -383,12 +383,15 @@ void QETProject::setDefaultConductorProperties(const ConductorProperties &conduc
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString QETProject::defaultReportProperties() const {
|
QString QETProject::defaultReportProperties() const {
|
||||||
return default_report_properties_;
|
return m_default_report_properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QETProject::setDefaultReportProperties(const QString &properties) {
|
void QETProject::setDefaultReportProperties(const QString &properties)
|
||||||
default_report_properties_ = properties;
|
{
|
||||||
emit reportPropertiesChanged(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) {
|
void QETProject::setDefaultXRefProperties(const QString type, const XRefProperties &properties) {
|
||||||
@ -1345,7 +1348,7 @@ void QETProject::readDefaultPropertiesXml(QDomDocument &xml_project)
|
|||||||
default_border_properties_ = BorderProperties:: defaultProperties();
|
default_border_properties_ = BorderProperties:: defaultProperties();
|
||||||
default_titleblock_properties_ = TitleBlockProperties::defaultProperties();
|
default_titleblock_properties_ = TitleBlockProperties::defaultProperties();
|
||||||
default_conductor_properties_ = ConductorProperties:: defaultProperties();
|
default_conductor_properties_ = ConductorProperties:: defaultProperties();
|
||||||
default_report_properties_ = ReportProperties:: defaultProperties();
|
m_default_report_properties = ReportProperties:: defaultProperties();
|
||||||
m_default_xref_properties = XRefProperties:: defaultProperties();
|
m_default_xref_properties = XRefProperties:: defaultProperties();
|
||||||
|
|
||||||
//Read values indicate in project
|
//Read values indicate in project
|
||||||
|
@ -183,7 +183,7 @@ class QETProject : public QObject
|
|||||||
void projectDiagramsOrderChanged(QETProject *, int, int);
|
void projectDiagramsOrderChanged(QETProject *, int, int);
|
||||||
void diagramUsedTemplate(TitleBlockTemplatesCollection *, const QString &);
|
void diagramUsedTemplate(TitleBlockTemplatesCollection *, const QString &);
|
||||||
void readOnlyChanged(QETProject *, bool);
|
void readOnlyChanged(QETProject *, bool);
|
||||||
void reportPropertiesChanged(QString);
|
void reportPropertiesChanged(const QString &old_str, const QString &new_str);
|
||||||
void XRefPropertiesChanged ();
|
void XRefPropertiesChanged ();
|
||||||
void addAutoNumDiagram();
|
void addAutoNumDiagram();
|
||||||
void elementAutoNumAdded(QString name);
|
void elementAutoNumAdded(QString name);
|
||||||
@ -242,7 +242,7 @@ class QETProject : public QObject
|
|||||||
/// Default title block properties for new diagrams created within the project
|
/// Default title block properties for new diagrams created within the project
|
||||||
TitleBlockProperties default_titleblock_properties_;
|
TitleBlockProperties default_titleblock_properties_;
|
||||||
/// Default report properties
|
/// Default report properties
|
||||||
QString default_report_properties_;
|
QString m_default_report_properties;
|
||||||
/// Default xref properties
|
/// Default xref properties
|
||||||
QHash <QString, XRefProperties> m_default_xref_properties;
|
QHash <QString, XRefProperties> m_default_xref_properties;
|
||||||
/// Embedded title block templates collection
|
/// Embedded title block templates collection
|
||||||
|
Loading…
x
Reference in New Issue
Block a user