Cleanups
This commit is contained in:
parent
95aa0eee7d
commit
a9c022f5b9
@ -436,11 +436,8 @@ QVariant DataModel::data(const QModelIndex &index, int role) const
|
|||||||
|
|
||||||
//is it the reserved role: DataEngineSource ?
|
//is it the reserved role: DataEngineSource ?
|
||||||
//also, if each source is an item DataEngineSource is a role between all the others, otherwise we know it from the role variable
|
//also, if each source is an item DataEngineSource is a role between all the others, otherwise we know it from the role variable
|
||||||
//finally, sub items are some times QVariantMap some times QVariantMaps
|
|
||||||
if (!m_keyRoleFilter.isEmpty() && m_roleNames.value(role) == "DataEngineSource") {
|
if (!m_keyRoleFilter.isEmpty() && m_roleNames.value(role) == "DataEngineSource") {
|
||||||
return source;
|
return source;
|
||||||
} else if (m_items.value(source).value(actualRow).canConvert<QVariantMap>()) {
|
|
||||||
return m_items.value(source).value(actualRow).value<QVariantMap>().value(m_roleNames.value(role));
|
|
||||||
} else {
|
} else {
|
||||||
return m_items.value(source).value(actualRow).value<QVariantMap>().value(m_roleNames.value(role));
|
return m_items.value(source).value(actualRow).value<QVariantMap>().value(m_roleNames.value(role));
|
||||||
}
|
}
|
||||||
@ -494,14 +491,14 @@ int DataModel::columnCount(const QModelIndex &parent) const
|
|||||||
QVariantMap DataModel::get(int row) const
|
QVariantMap DataModel::get(int row) const
|
||||||
{
|
{
|
||||||
QModelIndex idx = index(row, 0);
|
QModelIndex idx = index(row, 0);
|
||||||
QVariantMap hash;
|
QVariantMap map;
|
||||||
|
|
||||||
QHash<int, QByteArray>::const_iterator i;
|
QHash<int, QByteArray>::const_iterator i;
|
||||||
for (i = roleNames().constBegin(); i != roleNames().constEnd(); ++i) {
|
for (i = roleNames().constBegin(); i != roleNames().constEnd(); ++i) {
|
||||||
hash[i.value()] = data(idx, i.key());
|
map[i.value()] = data(idx, i.key());
|
||||||
}
|
}
|
||||||
|
|
||||||
return hash;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DataModel::roleNameToId(const QString &name)
|
int DataModel::roleNameToId(const QString &name)
|
||||||
|
@ -141,8 +141,6 @@ void DataSource::dataUpdated(const QString &sourceName, const Plasma::DataEngine
|
|||||||
//it can arrive also data we don't explicitly connected a source
|
//it can arrive also data we don't explicitly connected a source
|
||||||
if (m_connectedSources.contains(sourceName)) {
|
if (m_connectedSources.contains(sourceName)) {
|
||||||
m_data.insert(sourceName.toLatin1(), data);
|
m_data.insert(sourceName.toLatin1(), data);
|
||||||
|
|
||||||
qDebug() << " new data: " << sourceName; //<< m_data[sourceName.toLatin1()];
|
|
||||||
emit dataChanged();
|
emit dataChanged();
|
||||||
emit newData(sourceName, data);
|
emit newData(sourceName, data);
|
||||||
} else if (m_dataEngine) {
|
} else if (m_dataEngine) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user