Qt Resources or Directory Structure for icons?

Tomaz Canabrava tcanabrava at kde.org
Fri Apr 12 08:56:36 PDT 2013


Heya People.:

while trying to hack on the Qt version I tried to set the icon for the main
application. The code for Qt , with the resource system, is this:

window->setWindowIcon(QIcon(":/icons/subsurface"));

While the current code, in gtk, is as follows:

    screen = gdk_screen_get_default();
    if (screen)
        icon_theme = gtk_icon_theme_get_for_screen(screen);
    if (icon_theme) {
        if (gtk_icon_theme_has_icon(icon_theme, "subsurface")) {
            need_icon = FALSE;
            gtk_window_set_default_icon_name ("subsurface");
        }
    }
    if (need_icon) {
        const char *icon_name = subsurface_icon_name();
        if (!access(icon_name, R_OK))
            gtk_window_set_icon_from_file(GTK_WINDOW(win), icon_name, NULL);
    }

the Qt resource system gets the contents of a XML file and includes it on
the binary ( by passing to a xml -> cpp compiler ), so if we use it another
rule on the Makefiles needs to be written.


Tomaz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20130412/a83cdf98/attachment.html>


More information about the subsurface mailing list