resetting entire model by setting to a different value

This commit is contained in:
talksik
2024-02-08 15:17:43 -08:00
parent 24af4f9a67
commit b83f80f7ec
2 changed files with 3 additions and 8 deletions
+3 -3
View File
@@ -50,18 +50,18 @@ QVariant NetworksModel::data(const QModelIndex &index, int role) const
void NetworksModel::scan()
{
beginInsertRows(QModelIndex(), this->rowCount(), this->rowCount());
beginResetModel();
QList<Network> networks = this->m_networkScanner.scanForNetworks();
for (const Network& network: networks)
{
qDebug() << "Got network: " << network.name() << Qt::endl;
this->m_networks << network;
}
this->m_networks = networks;
qDebug() << "now have " << this->m_networks.size() << Qt::endl;
endInsertRows();
endResetModel();
}
QHash<int, QByteArray> NetworksModel::roleNames() const