summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-02-11 11:45:40 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2019-02-11 12:54:22 +0000
commita3ffef76acdd4ea4b81bde481948ed4b953289af (patch)
tree602bfde2412899c200195976f2ad11b37f09573d /src
parentca0594270cd2905c904c3a7ac578f5e1ac71f962 (diff)
QDeclarativeBluetoothDiscoveryModel: Fix warnings
Implement QAbstractItemModel::roleNames(), fixing the deprecationw arning: qdeclarativebluetoothdiscoverymodel.cpp:175:27: warning: ‘void QAbstractItemModel::setRoleNames(const QHash<int, QByteArray>&)’ is deprecated [-Wdeprecated-declarations] Add missing overrides to silence new warnings about insconsistent override. Fixes: QTBUG-73717 Change-Id: Iea9bd1d6cccfbecac7e3cf56101a5d65d466c023 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp16
-rw-r--r--src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel_p.h10
2 files changed, 14 insertions, 12 deletions
diff --git a/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp b/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp
index 6b2f32f3..6213355e 100644
--- a/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp
+++ b/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp
@@ -165,14 +165,6 @@ QDeclarativeBluetoothDiscoveryModel::QDeclarativeBluetoothDiscoveryModel(QObject
this,
&QDeclarativeBluetoothDiscoveryModel::errorDiscovery);
d->m_serviceAgent->setObjectName(QStringLiteral("ServiceDiscoveryAgent"));
-
- QHash<int, QByteArray> roleNames;
- roleNames = QAbstractItemModel::roleNames();
- roleNames.insert(Name, "name");
- roleNames.insert(ServiceRole, "service");
- roleNames.insert(RemoteAddress, "remoteAddress");
- roleNames.insert(DeviceName, "deviceName");
- setRoleNames(roleNames);
}
QDeclarativeBluetoothDiscoveryModel::~QDeclarativeBluetoothDiscoveryModel()
@@ -314,6 +306,14 @@ QVariant QDeclarativeBluetoothDiscoveryModel::data(const QModelIndex &index, int
return QVariant();
}
+QHash<int,QByteArray> QDeclarativeBluetoothDiscoveryModel::roleNames() const
+{
+ return {{Name, "name"},
+ {ServiceRole, "service"},
+ {RemoteAddress, "remoteAddress"},
+ {DeviceName, "deviceName"}};
+}
+
/*!
\qmlsignal BluetoothDiscoveryModel::serviceDiscovered(BluetoothService service)
diff --git a/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel_p.h b/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel_p.h
index 0aa134f5..6cbde088 100644
--- a/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel_p.h
+++ b/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel_p.h
@@ -106,13 +106,15 @@ public:
Error error() const;
- void componentComplete();
+ void componentComplete() override;
- void classBegin() { }
+ void classBegin() override { }
// From QAbstractListModel
- int rowCount(const QModelIndex &parent) const;
- QVariant data(const QModelIndex &index, int role) const;
+ int rowCount(const QModelIndex &parent) const override;
+ QVariant data(const QModelIndex &index, int role) const override;
+
+ QHash<int,QByteArray> roleNames() const override;
DiscoveryMode discoveryMode() const;
void setDiscoveryMode(DiscoveryMode discovery);