Deduplicate calls for obtaining model index

Change-Id: I799742a06ce592ab935ee0609d5930a7d26a44e1
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Orgad Shaneh
2019-12-21 22:55:46 +02:00
committed by Orgad Shaneh
parent 9264cebe24
commit 586c6dd92f
4 changed files with 23 additions and 17 deletions

View File

@@ -70,8 +70,10 @@ void SerialDeviceModel::disablePort(const QString &portName)
return info.portName() == portName;
});
if (i >= 0)
emit dataChanged(index(i), index(i), {Qt::DisplayRole});
if (i >= 0) {
const QModelIndex itemIndex = index(i);
emit dataChanged(itemIndex, itemIndex, {Qt::DisplayRole});
}
}
void SerialDeviceModel::enablePort(const QString &portName)