Well its not that simple. I created a small example but it works on both machines. Here is the example:
#include <QtGui>
int main(int argc, char *argv[])
{
w.show();
QToolBar* toolbar
= w.
addToolBar("Test");
w.setWindowTitle(icon_path);
toolbar->addAction(action);
return a.exec();
}
#include <QtGui>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QMainWindow w;
w.show();
QToolBar* toolbar = w.addToolBar("Test");
QString icon_path = QApplication::applicationDirPath() + "/xml_icon_16x16.png";
QIcon icon(icon_path);
w.setWindowTitle(icon_path);
QAction* action = new QAction(icon,"Action",0);
toolbar->addAction(action);
return a.exec();
}
To copy to clipboard, switch view to plain text mode
After playing around with it more, I realized that it looks like a resource system issue. I found that if I have an application like the one above, the shows the icon in Windows & Ubuntu. However if I link this application to a library which also has a resource file with icons embedded in the library, only icons from one of the two resources will show in Ubuntu but it works in Windows.
I tested this by running an app as shown above then it works. Then I link it against a library with an icon in a resource file and show this icon as well, then it does not work. Then I remove the resource file from the main application and then the icons from the library works.
I am probably missing something in regard with the Qt Resource System but I can't figure out what since it always worked on Windows. I've seen the Q_INIT_RESOURCE() macro but it says that it is only related to static libraries, not dynamic libraries which is used in my case.
Thanks for your time,
Jaco
Bookmarks