diff options
author | 2019-03-25 09:05:47 +0100 | |
---|---|---|
committer | 2019-03-27 13:58:15 +0100 | |
commit | 40a3e562b01de2827fa6c2c5fd9d46631f91dc36 (patch) | |
tree | 194fa05c48b087220cabd206125cc82eaf439d0d /desktop-widgets/modeldelegates.cpp | |
parent | 04593e8ec4bac2606dec54605c72a6a49cc83f9b (diff) | |
download | subsurface-40a3e562b01de2827fa6c2c5fd9d46631f91dc36.tar.gz |
Cleanup: provide printGPSCoords in C and C++ versions
printGPSCoords() returned a newly allocated C-style string. Most
callers simply made a QString out of it and freed the C-style string.
This is paradoxical, as printGPSCoords internally works with QStrings
and converts them to C-style on return.
Therefore, let printGPSCoords() return a QString and create a
printGPSCoordsC() wrapper for the two C-callers.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/modeldelegates.cpp')
-rw-r--r-- | desktop-widgets/modeldelegates.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/desktop-widgets/modeldelegates.cpp b/desktop-widgets/modeldelegates.cpp index c6405a433..fd6bb2e47 100644 --- a/desktop-widgets/modeldelegates.cpp +++ b/desktop-widgets/modeldelegates.cpp @@ -483,11 +483,8 @@ void LocationFilterDelegate::paint(QPainter *painter, const QStyleOptionViewItem bottomText += QString(ds->taxonomy.category[idx].value); } - if (bottomText.isEmpty()) { - char *gpsCoords = printGPSCoords(&ds->location); - bottomText = QString(gpsCoords); - free(gpsCoords); - } + if (bottomText.isEmpty()) + bottomText = printGPSCoords(&ds->location); if (dive_site_has_gps_location(ds) && currentDiveSiteHasGPS) { // so we are showing a completion and both the current dive site and the completion |