I've got the following problem: a gui i created is started by a c++-thread. now i want to assign own icons to certain menu entries, but the icons aren't shown in the application, but their functionality works fine.
I created another application with a main.cpp that has the following line included:
Q_INIT_RESOURCE(resource_file);
Q_INIT_RESOURCE(resource_file);
To copy to clipboard, switch view to plain text mode
with that line, the icons are shown. both applications have the same ressource file and the same icon folder. so i think i need the q_init_resource in the thread-driven application too.
here's the code of the thread which starts the gui:
void S::run(){
int argc = 0;
char** argv = 0;
m_MainWidget = new MainWindow(this);
if(m_MainWidget){
m_MainWidget->show();
m_Application->exec();
}else{
cout << "GUIThread::run: Could not start Qt-application." << endl;
}
}
void S::run(){
int argc = 0;
char** argv = 0;
m_Application = new QApplication(argc, argv);
m_MainWidget = new MainWindow(this);
if(m_MainWidget){
m_MainWidget->show();
m_Application->exec();
}else{
cout << "GUIThread::run: Could not start Qt-application." << endl;
}
}
To copy to clipboard, switch view to plain text mode
neither Q_INIT_RESOURCE(resource_file); nor m_MainWidget->Q_INIT_RESOURCE(resource_file); nor m_Application->Q_INIT_RESOURCE(resource_file); worked, so how can i include the line Q_INIT_RESOURCE(resource_file); to my application so that the icons are displayed correctely? or is there another way(even better?) to add icons to a QAction?
thanks in advance for your help
Bookmarks