Anton Giertli
Anton Giertli

Reputation: 936

Icon not shown on other PC

im developing QT application, and im using few icons

this is my resource.qrc file

<RCC>
    <qresource prefix="/new/prefix1">
        <file>army-officer-icon.png</file>
        <file>uac.png</file>
    </qresource>
</RCC>

then i ofcourse include it in my .pro file

RESOURCES += \
    resource.qrc

and here is the code which takes care of icons:

//this code is part of the mainwindow.cpp
QSystemTrayIcon *trayIcon;
trayIcon = new QSystemTrayIcon(this);
trayIcon->setContextMenu(trayIconMenu);
trayIcon->setIcon(QIcon(":/new/prefix1/army-officer-icon.png"));
trayIcon->show();



//this code is part of the ui_mainwindow.h (generated by QT)
        QLabel *label_5;
        label_5 = new QLabel(centralWidget);
        label_5->setObjectName(QString::fromUtf8("label_5"));
        label_5->setGeometry(QRect(40, 302, 46, 21));
        label_5->setPixmap(QPixmap(QString::fromUtf8(":/new/prefix1/uac.png")));
        label_5->show();

So, this looks reasonable, right ?

===windows 7, developing station, QT installed

also the result effect is as i expected windows 7 - developing station, where qt is installed

i can see both icons :: tray icon & uac shield = awesome

but when i move to the other workstation, somethings strange happens

===windows XP, user work station, QT NOT installed

other workstation, qt not installed

as u can see, the trayicon still has its own icon, but the "uac shield icon" dissapears... its very disturbing, and i really dont get it since both icons are *.png formats, i browsed a lot, and maybe it has connection with qt image plugins (althought i think that i should care about it only when my icon are *.jpeg, *.gif format), but wasnt able to make this solution works...

so any ideas are welcomed. Thanx in advance.

Upvotes: 2

Views: 2066

Answers (1)

Anton Giertli
Anton Giertli

Reputation: 936

Okay, ive found the solution just after ive posted this (actually , i was quite close, but i copied something with wrong path :/)

  1. locate C:\QtSDK\Desktop\Qt\4.8.0\mingw\plugins

  2. copy plugins/imageformats to your application folder

  3. open main.cpp and add this line of codes

    a.addLibraryPath(QCoreApplication::applicationDirPath ()+"/plugins"); 
    
  4. compile, and have a look at your beautiful icons :)

Upvotes: 6

Related Questions