Merge PR #538: Fix changed signal when new hosts are discovered
This commit is contained in:
commit
0a442d56cc
@ -137,7 +137,7 @@ void ZeroconfDiscovery::serviceEntryAdded(const QZeroConfService &entry)
|
|||||||
if (!host) {
|
if (!host) {
|
||||||
host = new NymeaHost(m_nymeaHosts);
|
host = new NymeaHost(m_nymeaHosts);
|
||||||
host->setUuid(uuid);
|
host->setUuid(uuid);
|
||||||
// qDebug() << "ZeroConf: Adding new host:" << serverName << uuid;
|
qDebug() << "ZeroConf: Adding new host:" << serverName << uuid;
|
||||||
m_nymeaHosts->addHost(host);
|
m_nymeaHosts->addHost(host);
|
||||||
}
|
}
|
||||||
host->setName(serverName);
|
host->setName(serverName);
|
||||||
|
|||||||
@ -71,6 +71,14 @@ void NymeaHosts::addHost(NymeaHost *host)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
host->setParent(this);
|
host->setParent(this);
|
||||||
|
connect(host, &NymeaHost::nameChanged, this, [=](){
|
||||||
|
int idx = m_hosts.indexOf(host);
|
||||||
|
emit dataChanged(index(idx), index(idx), {NameRole});
|
||||||
|
});
|
||||||
|
connect(host, &NymeaHost::versionChanged, this, [=](){
|
||||||
|
int idx = m_hosts.indexOf(host);
|
||||||
|
emit dataChanged(index(idx), index(idx), {VersionRole});
|
||||||
|
});
|
||||||
connect(host, &NymeaHost::connectionChanged, this, &NymeaHosts::hostChanged);
|
connect(host, &NymeaHost::connectionChanged, this, &NymeaHosts::hostChanged);
|
||||||
|
|
||||||
beginInsertRows(QModelIndex(), m_hosts.count(), m_hosts.count());
|
beginInsertRows(QModelIndex(), m_hosts.count(), m_hosts.count());
|
||||||
|
|||||||
Reference in New Issue
Block a user