void ContextModel::loadEnded( QSettings &pSettings, bool pPartial ) { Q_UNUSED( pSettings ) Q_UNUSED( pPartial ) changePersistentIndex( createIndex( 0, 0, mRootItem ), createIndex( mRootItem->rowCount(), 0, mRootItem ) ); emit layoutChanged(); }
void SensorModel::moveUpSensor(const QModelIndex &sindex) { int row = sindex.row(); if(row <= 0) return; mSensors.move(row, row-1); for( int i = 0; i < columnCount(); i++) changePersistentIndex(index(row, i), index(row-1, i)); emit dataChanged(sindex, index(row-1, columnCount()-1)); }
void ObjectListModel:: objectChanged() { WoolzObject* obj = qobject_cast<WoolzObject*>(sender()); if(obj) { int row=-1; row = objects.indexOf(obj); if(row >= 0) { changePersistentIndex(QModelIndex(), createIndex(row, columnCount(QModelIndex())-1, 0)); //update changed columns } emit layoutChanged(); } }
void QtTestModel::setPersistent(const QModelIndex &from, const QModelIndex &to) { changePersistentIndex(from, to); }
void DhQDirModel::DvhchangePersistentIndex(const QModelIndex& x1, const QModelIndex& x2) { return changePersistentIndex(x1, x2); }
void CombinedModel::update(const android::Vector<android::ConfiguredStation>& update) { QMutexLocker locker(&sWifiMutex); // Mark stations with a non-negative network id QListIterator<Station *> it(mStations); while (it.hasNext()) { Station *s = it.next(); if (s->network_id != -1) s->network_id = -2; } for (size_t i = 0 ; i < update.size() ; i++) { const android::ConfiguredStation& config(update[i]); Station *s = findBySsid(QString::fromLocal8Bit(config.ssid.string())); s->network_id = config.network_id; s->status = static_cast<Station::Status>(config.status); s->key_mgmt = Station::flagsToKeyMgmt(QString::fromLocal8Bit(config.key_mgmt.string())); s->pre_shared_key = config.pre_shared_key; int row = mStations.indexOf(s); emit dataChanged(createIndex(row, 0), createIndex(row, 0)); } // Remove stations that didn't show up in the list and don't have scan results int row = 0; while (row < mStations.size()) { Station *s = mStations[row]; if (s->network_id == -2) { if (s->rssi != -9999) { s->network_id = -1; s->status = Station::UNKNOWN; row += 1; } else { beginRemoveRows(QModelIndex(), row, row); delete mStations.takeAt(row); endRemoveRows(); } } else { row += 1; } } emit layoutAboutToBeChanged(); QList<Station *> mOldList(mStations); qStableSort(mStations.begin(), mStations.end(), Station::lessThan); for (int row = 0 ; row < mStations.size() ; row++) { int old_row = mOldList.indexOf(mStations[row]); if (row != old_row) changePersistentIndex(createIndex(old_row, 0), createIndex(row, 0)); } emit layoutChanged(); // qDebug() << " > After update, combined list is"; // for (int row = 0 ; row < mStations.size() ; row++) { // Station *s = mStations[row]; // qDebug(" id=%d ssid='%s' rssi=%d status=%d", s->network_id, // s->ssid.toLocal8Bit().constData(), s->rssi, s->status); // } }
void CombinedModel::update(const android::Vector<android::ScannedStation>& update) { // qDebug() << "[" << Q_FUNC_INFO; QMutexLocker locker(&sWifiMutex); // Remove all current RSSI values QListIterator<Station *> it(mStations); while (it.hasNext()) { Station *s = it.next(); s->rssi = -9999; s->station_count = 0; } for (size_t i = 0 ; i < update.size() ; i++) { const android::ScannedStation& scanned(update[i]); Station *s = findBySsid(QString::fromLocal8Bit(scanned.ssid.string())); QSet<int> changed; changed << CombinedModel::RssiRole << CombinedModel::SignalLevelRole << CombinedModel::StationCountRole; if (scanned.rssi > s->rssi) s->rssi = scanned.rssi; // Might be more than one station if (s->frequency != scanned.frequency) { s->frequency = scanned.frequency; changed << CombinedModel::FrequencyRole; } if (s->flags != scanned.flags) { s->flags = scanned.flags; s->key_mgmt = Station::flagsToKeyMgmt(QString::fromLocal8Bit(scanned.flags.string())); changed << CombinedModel::FlagsRole << CombinedModel::KeyMgmtRole; } s->station_count += 1; int row = mStations.indexOf(s); // qDebug() << " ...data changed row" << row; emit dataChanged(createIndex(row, 0), createIndex(row, 0), changed); } // Remove stations that didn't show up on the scan int row = 0; while (row < mStations.size()) { Station *s = mStations[row]; if (s->rssi == -9999 && s->network_id == -1) { beginRemoveRows(QModelIndex(), row, row); delete mStations.takeAt(row); // qDebug() << " ...remove row" << row; endRemoveRows(); } else { row += 1; } } emit layoutAboutToBeChanged(); QList<Station *> mOldList(mStations); qStableSort(mStations.begin(), mStations.end(), Station::lessThan); for (int row = 0 ; row < mStations.size() ; row++) { int old_row = mOldList.indexOf(mStations[row]); if (row != old_row) { changePersistentIndex(createIndex(old_row, 0), createIndex(row, 0)); // qDebug() << " ...move row" << old_row << "to" << row; } } emit layoutChanged(); // qDebug() << " > After scan update, combined list is"; // for (int row = 0 ; row < mStations.size() ; row++) { // Station *s = mStations[row]; // qDebug(" id=%d ssid='%s' rssi=%d status=%d", s->network_id, // s->ssid.toLocal8Bit().constData(), s->rssi, s->status); // } }
void DhQAbstractTableModel::DvhchangePersistentIndex(const QModelIndex& x1, const QModelIndex& x2) { return changePersistentIndex(x1, x2); }