summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilian Wolff <milian.wolff@kdab.com>2013-03-27 17:04:06 +0100
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2013-03-28 00:39:48 +0100
commit4f6ca7f90a88224eb6afc90d289de2d47c3c06a1 (patch)
tree49cf4ab8951a1f137dd111a22742829a099edd5d
parentd05da2c8a6c2a794e9f4372f5b29112b85208f97 (diff)
Add QBluetoothDeviceInfo::operator!= which was missing.
The code just forwards to operator==, as is done as well by e.g. QBluetoothTransferRequest. Change-Id: I4db523124b6bd88bcb1f129d0742fc8ef376c61b Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
-rw-r--r--src/bluetooth/qbluetoothdeviceinfo.cpp10
-rw-r--r--src/bluetooth/qbluetoothdeviceinfo.h1
-rw-r--r--tests/auto/qbluetoothdeviceinfo/tst_qbluetoothdeviceinfo.cpp6
3 files changed, 14 insertions, 3 deletions
diff --git a/src/bluetooth/qbluetoothdeviceinfo.cpp b/src/bluetooth/qbluetoothdeviceinfo.cpp
index 026b695f..7bc5e66a 100644
--- a/src/bluetooth/qbluetoothdeviceinfo.cpp
+++ b/src/bluetooth/qbluetoothdeviceinfo.cpp
@@ -398,6 +398,16 @@ bool QBluetoothDeviceInfo::operator==(const QBluetoothDeviceInfo &other) const
}
/*!
+ Returns true if this object is different from \a other, or false otherwise.
+
+ \sa operator==()
+*/
+bool QBluetoothDeviceInfo::operator!=(const QBluetoothDeviceInfo &other) const
+{
+ return !(*this == other);
+}
+
+/*!
Returns the address of the device.
*/
QBluetoothAddress QBluetoothDeviceInfo::address() const
diff --git a/src/bluetooth/qbluetoothdeviceinfo.h b/src/bluetooth/qbluetoothdeviceinfo.h
index 7593ce35..32765a2d 100644
--- a/src/bluetooth/qbluetoothdeviceinfo.h
+++ b/src/bluetooth/qbluetoothdeviceinfo.h
@@ -208,6 +208,7 @@ public:
QBluetoothDeviceInfo &operator=(const QBluetoothDeviceInfo &other);
bool operator==(const QBluetoothDeviceInfo &other) const;
+ bool operator!=(const QBluetoothDeviceInfo &other) const;
QBluetoothAddress address() const;
QString name() const;
diff --git a/tests/auto/qbluetoothdeviceinfo/tst_qbluetoothdeviceinfo.cpp b/tests/auto/qbluetoothdeviceinfo/tst_qbluetoothdeviceinfo.cpp
index db86342f..d36532c7 100644
--- a/tests/auto/qbluetoothdeviceinfo/tst_qbluetoothdeviceinfo.cpp
+++ b/tests/auto/qbluetoothdeviceinfo/tst_qbluetoothdeviceinfo.cpp
@@ -323,7 +323,7 @@ void tst_QBluetoothDeviceInfo::tst_assignment()
QVERIFY(copyInfo1.isValid());
QVERIFY(copyInfo2.isValid());
- QVERIFY(!(QBluetoothDeviceInfo() == copyInfo1));
+ QVERIFY(QBluetoothDeviceInfo() != copyInfo1);
QCOMPARE(copyInfo1.address(), address);
QCOMPARE(copyInfo2.address(), address);
@@ -355,7 +355,7 @@ void tst_QBluetoothDeviceInfo::tst_serviceUuids()
deviceInfo.setServiceUuids(servicesList, QBluetoothDeviceInfo::DataComplete);
QVERIFY(deviceInfo.serviceUuids().count() > 0);
- QVERIFY(!(deviceInfo == copyInfo));
+ QVERIFY(deviceInfo != copyInfo);
QVERIFY(deviceInfo.serviceUuidsCompleteness() == QBluetoothDeviceInfo::DataComplete);
}
@@ -369,7 +369,7 @@ void tst_QBluetoothDeviceInfo::tst_cached()
QVERIFY(!deviceInfo.isCached());
deviceInfo.setCached(true);
QVERIFY(deviceInfo.isCached());
- QVERIFY(!(deviceInfo == copyInfo));
+ QVERIFY(deviceInfo != copyInfo);
deviceInfo.setCached(false);
QVERIFY(!(deviceInfo.isCached()));