summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-09-09 04:48:03 -0300
committerGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-09-09 04:48:03 -0300
commit6a7256fdd5609b3792b2b0e6a3e85203d0ee8206 (patch)
treeeed5bd5a1ca7cdfe99a426e13a29a5c81087a35f
parent2e700f2dde6cd43cdb3ff53b56eb5e8699125444 (diff)
downloadsubsurface-6a7256fdd5609b3792b2b0e6a3e85203d0ee8206.tar.gz
Fix QString Usage
Fixes QString Usage. to return a Empty QString, one should return a QString() and not a QString(""), and to check if the string is empty, one should check for string.isEmpty() instead of "string != "" ", because the latter will create a new QString, then call the != operator, less function calls, better code. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
-rw-r--r--qt-gui.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/qt-gui.cpp b/qt-gui.cpp
index e1587ddfe..eb199f0ab 100644
--- a/qt-gui.cpp
+++ b/qt-gui.cpp
@@ -159,8 +159,8 @@ const QString get_dc_nickname(const char *model, uint32_t deviceid)
{
const DiveComputerNode *existNode = dcList.getExact(model, deviceid);
if (!existNode)
- return QString("");
- if (existNode->nickName != "")
+ return QString();
+ else if (!existNode->nickName.isEmpty())
return existNode->nickName;
else
return model;