Cleanup: remove unnecessary QRegularExpression copies

A regular expression was generated and then copied twice without
apparent reason. Remove these copies.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-06-06 11:45:02 +02:00 committed by Lubomir I. Ivanov
parent efb98cfd69
commit eefd58a5c8

View file

@ -333,14 +333,13 @@ void BtDeviceSelectionDialog::pairingFinished(const QBluetoothAddress &address,
// Find the items which represent the BTH device and update their state // Find the items which represent the BTH device and update their state
QList<QListWidgetItem *> items = ui->discoveredDevicesList->findItems(remoteDeviceStringAddress, Qt::MatchContains); QList<QListWidgetItem *> items = ui->discoveredDevicesList->findItems(remoteDeviceStringAddress, Qt::MatchContains);
QRegularExpression pairingExpression = QRegularExpression(QString("%1|%2|%3").arg(tr("PAIRED"), QRegularExpression pairingExpression(QString("%1|%2|%3").arg(tr("PAIRED"),
tr("AUTHORIZED_PAIRED"), tr("AUTHORIZED_PAIRED"),
tr("UNPAIRED"))); tr("UNPAIRED")));
for (int i = 0; i < items.count(); ++i) { for (int i = 0; i < items.count(); ++i) {
QListWidgetItem *item = items.at(i); QListWidgetItem *item = items.at(i);
QString updatedDeviceLabel = item->text().replace(QRegularExpression(pairingExpression), QString updatedDeviceLabel = item->text().replace(pairingExpression, pairingStatusLabel);
pairingStatusLabel);
item->setText(updatedDeviceLabel); item->setText(updatedDeviceLabel);
item->setBackgroundColor(pairingColor); item->setBackgroundColor(pairingColor);