From 6a7256fdd5609b3792b2b0e6a3e85203d0ee8206 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Mon, 9 Sep 2013 04:48:03 -0300 Subject: [PATCH] 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 --- qt-gui.cpp | 4 ++-- 1 file 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;