Add a changed signal in Aggregation

Use it to change the find and candidate find object in CurrentDocumentFind:
this will allow to replace the IFindSupport object used.

Merge-request: 115
Reviewed-by: con <qtc-committer@nokia.com>
This commit is contained in:
Nicolas Arnaud-Cormos
2010-05-17 09:58:36 +02:00
committed by con
parent e2297e4cbd
commit d3b58c2db3
4 changed files with 68 additions and 17 deletions

View File

@@ -232,15 +232,18 @@ void Aggregate::add(QObject *component)
{
if (!component)
return;
QWriteLocker locker(&lock());
Aggregate *parentAggregation = aggregateMap().value(component);
if (parentAggregation == this)
return;
if (parentAggregation)
parentAggregation->remove(component);
m_components.append(component);
connect(component, SIGNAL(destroyed(QObject*)), this, SLOT(deleteSelf(QObject*)));
aggregateMap().insert(component, this);
{
QWriteLocker locker(&lock());
Aggregate *parentAggregation = aggregateMap().value(component);
if (parentAggregation == this)
return;
if (parentAggregation)
parentAggregation->remove(component);
m_components.append(component);
connect(component, SIGNAL(destroyed(QObject*)), this, SLOT(deleteSelf(QObject*)));
aggregateMap().insert(component, this);
}
emit changed();
}
/*!
@@ -254,8 +257,11 @@ void Aggregate::remove(QObject *component)
{
if (!component)
return;
QWriteLocker locker(&lock());
aggregateMap().remove(component);
m_components.removeAll(component);
disconnect(component, SIGNAL(destroyed(QObject*)), this, SLOT(deleteSelf(QObject*)));
{
QWriteLocker locker(&lock());
aggregateMap().remove(component);
m_components.removeAll(component);
disconnect(component, SIGNAL(destroyed(QObject*)), this, SLOT(deleteSelf(QObject*)));
}
emit changed();
}