[Solved] Problem with Qt Resource System


  • Moderators

    As the title indicates I have an issue with the Qt Resource System.

    I have a very small .qrc file holding the information for one icon file. In my application I am using this icon for display. Everything works as anticipated on my development platform (Windows 7 professional, 64 bit).
    When I deploy my application to Windows Server 2008 64 bit the icon is not displayed.
    I am using Qt 5.1 with MinGW.

    I have not used .qrc very much so far, so I thought I have misinterpret something.
    However the "documentation":http://qt-project.org/doc/qt-5.0/qtcore/resources.html says:
    [quote]
    The Qt resource system is a platform-independent mechanism for storing binary files in the application's executable. This is useful if your application always needs a certain set of files (icons, translation files, etc.) and you don't want to run the risk of losing the files.
    [/quote]

    Anyone an idea what the cause could be?


  • Lifetime Qt Champion

    Hi,

    What size/resolution is your icon ? I've had problem on Windows XP where I had to have a low-res/low-size icon to get it shown.

    IIRC a 32x32 icon


  • Moderators

    Thanks for feedback.

    I had used 16x16. In the meantime I have tested 32x32 and 48x48. Each of these formats are shown on my local machine (development), but not on the server where I am running the application.
    When running on my local machine it is always ok, regardless if through Qt creator or on a deployment folder. The deployment folder is copied with all the dependencies to the server. So, it has the same dlls including the ones required for MinGW. Only a couple of windows dlls as supplied by the system shall be different.


  • Lifetime Qt Champion

    Do you also have the rc (not qrc) file for your application ?


  • Moderators

    Yep, I have.


  • Moderators

    I have removed the .rc file and compiled the same result, but the application icon is missing as well ;(


  • Lifetime Qt Champion

    Well, at least we know that something is working if the icon disappeared...

    Can you post the rc and pro file ?


  • Moderators

    bliblablo.pro
    @
    QT += core gui network
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TEMPLATE = app
    TARGET = bliblablo

    include(../../CompileSettings/blabla.inc)
    INCLUDEPATH += .
    ./Gui

    include(bliblablo.pri)

    win32:RC_FILE = bliblablo.rc

    HEADERS +=
    Gui/blobloProcessInformation.h

    SOURCES +=
    Gui/blobloProcessInformation.cpp
    @

    bliblablo.rc
    @
    IDI_ICON1 ICON DISCARDABLE "bliblablo.ico"
    @

    bliblablo.qrc
    @
    <RCC>
    <qresource prefix="/bliblablo">
    <file>pictograms-road_signs-stop_sign(16x16).ico</file>
    <file>pictograms-road_signs-stop_sign(32x32).ico</file>
    <file>pictograms-road_signs-stop_sign(48x48).ico</file>
    </qresource>
    </RCC>
    @

    The pixel sizes are given in the names. These icons are from open_icon_library. bliblablo.ico is self-generated icon. Do not remember any more how.

    Note: I have anonymized the names, but they are consistent.


  • Lifetime Qt Champion

    Just to rule out the obvious, is bliblablo.ico in the same folder as the rc file ?


  • Moderators

    Yes. All icons are in the same folder as well as the (q)rc files.

    The problem is not bliblablo,ico which is shown in left corner of mainwindow and everywhere where it should appear. The problems are with the stop sign. They are loaded out of the qrc file with
    @
    QIcon icon ( ":/bliblablo/pictograms-road_signs-stop_sign(48x48).ico" );
    QTableWidgetItem *wgt = new QTableWidgetItem (icon, runName );
    ui->twProcessOverview->setItem ( cnt, _ActionCol, wgt );
    @

    No problem on development machine started inside and outside of creator with and without debug mode.
    When bringing to other machine, the application does work as expected. Only the stupid stop icons are not shown.


  • Lifetime Qt Champion

    Woops sorry… I misunderstood you.

    Is your ico plugin missing ?


  • Moderators

    Hpfff...
    You hit the nail on the head.
    Thanks a lot!


  • Lifetime Qt Champion

    You're welcome !

    That's why I use png for images other than the required application icon, no plugin needed :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.