pre-populate the model if needed
since DataModel is a consumer of a consumer, in the case DataSource as already data, populate the model with it without waiting for the signal
This commit is contained in:
parent
ccc5bf7b90
commit
27c857db82
@ -214,6 +214,13 @@ void DataModel::setDataSource(QObject *object)
|
||||
|
||||
disconnect(m_dataSource, 0, this, 0);
|
||||
m_dataSource = source;
|
||||
|
||||
QMap<QString, QVariant>::const_iterator i = source->data().constBegin();
|
||||
while (i != source->data().constEnd()) {
|
||||
dataUpdated(i.key(), i.value().value<Plasma::DataEngine::Data>());
|
||||
++i;
|
||||
}
|
||||
|
||||
connect(m_dataSource, SIGNAL(newData(const QString &, const Plasma::DataEngine::Data &)),
|
||||
this, SLOT(dataUpdated(const QString &, const Plasma::DataEngine::Data &)));
|
||||
connect(m_dataSource, SIGNAL(sourceRemoved(const QString &)), this, SLOT(removeSource(const QString &)));
|
||||
|
Loading…
Reference in New Issue
Block a user