BUG: Displaying icons on the dive list

Willem Ferguson willemferguson at zoology.up.ac.za
Fri Nov 18 23:01:49 PST 2016


Here are two snippets of code, with reference to 
subsurface/qt-models/divetripmodel.cpp. The first part (A), below is the 
existing code. It is the part that adds the globe icon (filename 
:Emblem-earth.svg) that appears in the Location field of the dive list. 
The actual icon referred to in the code below is actually satellite.svg. 
So there appears to be a bug in the existing code and that the 
appropriate icon is shown by accident?? If I change the icon name below 
to :star, then the star icon is shown. But the satellite icon in the 
existing code is not shown.

(A)
   case Qt::DecorationRole:
         switch (column) {
         case LOCATION:
             if (dive_has_gps_location(dive)) {
                 IconMetrics im = defaultIconMetrics();
                 retVal = QIcon(":satellite").pixmap(im.sz_small, 
im.sz_small);
             }
             break;

Here is an addition that I am working with (B, below). But it does not 
matter which new icon name I specify, it is not shown. There are a few 
icons that are, however, displayed e.g. star.svg in the subsurface/icons 
folder. If I take a foreign icon and name it star.svg, then this foreign 
icon IS shown correctly.

(B)
         case PHOTOS:
             if (dive->picture_list)
             {
                 IconMetrics im = defaultIconMetrics();
                 retVal = 
QIcon(icon_names[countPhotos(dive)]).pixmap(im.sz_small, im.sz_small);
             }
             break;
         }

This leads me to believe that the problem is that the new icons 
(including satellite.svg) need to be declared as resources. But I have 
no idea where.

Any suggestions?
Kind regards,
willem



More information about the subsurface mailing list