Changeset View
Changeset View
Standalone View
Standalone View
gui/SensorBrowser.cpp
Show First 20 Lines • Show All 238 Lines • ▼ Show 20 Line(s) | 215 | void SensorBrowserModel::removeSensor(HostInfo *hostInfo, int parentId, const QString &sensorName) { | |||
---|---|---|---|---|---|
239 | } | 239 | } | ||
240 | Q_ASSERT(parentModelIndex.isValid()); | 240 | Q_ASSERT(parentModelIndex.isValid()); | ||
241 | QList<int> &parentTreemap = mTreeMap[parentId]; | 241 | QList<int> &parentTreemap = mTreeMap[parentId]; | ||
242 | beginRemoveRows( parentModelIndex, index, index ); | 242 | beginRemoveRows( parentModelIndex, index, index ); | ||
243 | parentTreemap.removeAll(idCount); | 243 | parentTreemap.removeAll(idCount); | ||
244 | mParentsTreeMap.remove(idCount); | 244 | mParentsTreeMap.remove(idCount); | ||
245 | SensorInfo *sensorInfo = mSensorInfoMap.take(idCount); | 245 | SensorInfo *sensorInfo = mSensorInfoMap.take(idCount); | ||
246 | delete sensorInfo; | 246 | delete sensorInfo; | ||
247 | sensorInfo = nullptr; | ||||
247 | mHostSensorsMap[hostInfo->id()].remove(sensorName); | 248 | mHostSensorsMap[hostInfo->id()].remove(sensorName); | ||
248 | endRemoveRows(); | 249 | endRemoveRows(); | ||
249 | 250 | | |||
250 | if(parentsParentId != -1) | 251 | if(parentsParentId != -1) | ||
251 | removeEmptyParentTreeBranches(hostInfo->id(), parentId, parentsParentId); | 252 | removeEmptyParentTreeBranches(hostInfo->id(), parentId, parentsParentId); | ||
252 | } | 253 | } | ||
253 | void SensorBrowserModel::removeEmptyParentTreeBranches(int hostId, int id, int parentId) { | 254 | void SensorBrowserModel::removeEmptyParentTreeBranches(int hostId, int id, int parentId) { | ||
254 | if(hostId == id) | 255 | if(hostId == id) | ||
▲ Show 20 Lines • Show All 383 Lines • ▼ Show 20 Line(s) | |||||
638 | { | 639 | { | ||
639 | return mDesc; | 640 | return mDesc; | ||
640 | } | 641 | } | ||
641 | 642 | | |||
642 | HostInfo *SensorInfo::hostInfo() const | 643 | HostInfo *SensorInfo::hostInfo() const | ||
643 | { | 644 | { | ||
644 | return mHostInfo; | 645 | return mHostInfo; | ||
645 | } | 646 | } | ||
646 | | ||||
647 | | ||||
648 | | ||||
649 | |