New Signal Slot Syntax

This commit is contained in:
Simon De Backer 2020-08-02 15:23:38 +02:00
parent 510aa74266
commit 4751934d68
2 changed files with 40 additions and 32 deletions

View File

@ -88,13 +88,25 @@ Diagram::Diagram(QETProject *project) :
pen.setColor(Qt::black); pen.setColor(Qt::black);
conductor_setter_ -> setPen(pen); conductor_setter_ -> setPen(pen);
connect(&border_and_titleblock, SIGNAL(needTitleBlockTemplate(const QString &)), this, SLOT(setTitleBlockTemplate(const QString &))); connect(&border_and_titleblock,
connect(&border_and_titleblock, SIGNAL(diagramTitleChanged(const QString &)), this, SLOT(titleChanged(const QString &))); &BorderTitleBlock::needTitleBlockTemplate,
connect(&border_and_titleblock, SIGNAL(titleBlockFolioChanged(const QString &)), this, SLOT(titleChanged(const QString &))); this, &Diagram::setTitleBlockTemplate);
connect(&border_and_titleblock, SIGNAL(borderChanged(QRectF,QRectF)), this, SLOT(adjustSceneRect())); connect(&border_and_titleblock,
connect(&border_and_titleblock, SIGNAL(titleBlockFolioChanged(const QString &)), this, SLOT(updateLabels())); &BorderTitleBlock::diagramTitleChanged,
connect(this, SIGNAL (diagramActivated()), this, SLOT(loadElmtFolioSeq())); this, &Diagram::titleChanged);
connect(this, SIGNAL (diagramActivated()), this, SLOT(loadCndFolioSeq())); connect(&border_and_titleblock,
&BorderTitleBlock::titleBlockFolioChanged,
this, &Diagram::titleChanged);
connect(&border_and_titleblock,
&BorderTitleBlock::borderChanged,
this, &Diagram::adjustSceneRect);
connect(&border_and_titleblock,
&BorderTitleBlock::titleBlockFolioChanged,
this, &Diagram::updateLabels);
connect(this, &Diagram::diagramActivated,
this, &Diagram::loadElmtFolioSeq);
connect(this, &Diagram::diagramActivated,
this, &Diagram::loadCndFolioSeq);
adjustSceneRect(); adjustSceneRect();
} }

View File

@ -189,13 +189,11 @@ QTreeWidgetItem *GenericPanel::updateProjectItem(QTreeWidgetItem *project_qtwi,
projects_.insert(project, project_qtwi); projects_.insert(project, project_qtwi);
connect( connect(
project, SIGNAL(projectInformationsChanged(QETProject *)), project,&QETProject::projectInformationsChanged,
this, SLOT (projectInformationsChanged(QETProject *)) this,&GenericPanel::projectInformationsChanged);
);
connect( connect(
project, SIGNAL(readOnlyChanged(QETProject *, bool)), project,&QETProject::readOnlyChanged,
this, SLOT (projectInformationsChanged(QETProject *)) this,&GenericPanel::projectInformationsChanged);
);
} }
// text // text
@ -236,17 +234,14 @@ QTreeWidgetItem *GenericPanel::fillProjectItem(QTreeWidgetItem *project_qtwi,
if (options & AddChildDiagrams) { if (options & AddChildDiagrams) {
if (freshly_created) { if (freshly_created) {
connect( connect(
project, SIGNAL(diagramAdded(QETProject *, Diagram *)), project,&QETProject::diagramAdded,
this, SLOT (diagramAdded(QETProject *, Diagram *)) this,&GenericPanel::diagramAdded);
);
connect( connect(
project, SIGNAL(diagramRemoved(QETProject *, Diagram *)), project,&QETProject::diagramRemoved,
this, SLOT (diagramRemoved(QETProject *, Diagram *)) this,&GenericPanel::diagramRemoved);
);
connect( connect(
project, SIGNAL(projectDiagramsOrderChanged(QETProject *, int, int)), project,&QETProject::projectDiagramsOrderChanged,
this, SLOT (projectDiagramsOrderChanged(QETProject *, int, int)) this,&GenericPanel::projectDiagramsOrderChanged);
);
} else { } else {
// remove diagrams unknown to the project (presumably removed) // remove diagrams unknown to the project (presumably removed)
removeObsoleteItems(project -> diagrams(), removeObsoleteItems(project -> diagrams(),
@ -265,9 +260,8 @@ QTreeWidgetItem *GenericPanel::fillProjectItem(QTreeWidgetItem *project_qtwi,
if (options & AddChildTemplatesCollection) { if (options & AddChildTemplatesCollection) {
if (freshly_created) { if (freshly_created) {
connect( connect(
project, SIGNAL(diagramUsedTemplate(TitleBlockTemplatesCollection *, const QString &)), project,&QETProject::diagramUsedTemplate,
this, SLOT (diagramUsedTemplate(TitleBlockTemplatesCollection *, const QString &)) this,&GenericPanel::diagramUsedTemplate);
);
} }
addTemplatesCollection( addTemplatesCollection(
project -> embeddedTitleBlockTemplatesCollection(), project -> embeddedTitleBlockTemplatesCollection(),
@ -388,7 +382,8 @@ QTreeWidgetItem *GenericPanel::updateDiagramItem(QTreeWidgetItem *diagram_qtwi,
QVariant::fromValue(diagram)); QVariant::fromValue(diagram));
diagrams_.insert(diagram, diagram_qtwi); diagrams_.insert(diagram, diagram_qtwi);
connect(diagram, &Diagram::diagramTitleChanged, this, &GenericPanel::diagramTitleChanged); connect(diagram, &Diagram::diagramTitleChanged,
this, &GenericPanel::diagramTitleChanged);
} }
return(updateItem(diagram_qtwi, options, freshly_created)); return(updateItem(diagram_qtwi, options, freshly_created));
@ -528,14 +523,15 @@ QTreeWidgetItem *GenericPanel::fillTemplatesCollectionItem(
if (options & AddChildTemplates) { if (options & AddChildTemplates) {
if (freshly_created) { if (freshly_created) {
connect( connect(
tbt_collection, SIGNAL(changed(TitleBlockTemplatesCollection*,QString)), tbt_collection,
this, SLOT(templatesCollectionChanged(TitleBlockTemplatesCollection*, const QString &)) &TitleBlockTemplatesCollection::changed,
); this,
&GenericPanel::templatesCollectionChanged);
if (QETProject *project = tbt_collection -> parentProject()) { if (QETProject *project = tbt_collection -> parentProject()) {
connect( connect(
project, SIGNAL(diagramUsedTemplate(TitleBlockTemplatesCollection *, const QString &)), project, &QETProject::diagramUsedTemplate,
this, SLOT (templatesCollectionChanged(TitleBlockTemplatesCollection *, const QString &)) this,
); &GenericPanel::templatesCollectionChanged);
} }
} else { } else {
// remove templates unknown to the collection (presumably removed) // remove templates unknown to the collection (presumably removed)