I know, thats a beginners question but I have to tried to solve it with goolge / stackoverflow, but I haven't found a good answer. The problem is, I want to add a icon to a qpushbutton. But it doesnt work / the file is not found?!, where is the problem?
...pro-File
[...]OTHER_FILES += \
Readme.txt \
icons/newFolder.png \
icons/newFile.png
class.cpp
//toolbar
QToolBar *tool = new QToolBar();
QPushButton *btn = new QPushButton();
btn->setIcon(QIcon(":/icons/newFile.png"));
tool->addWidget(btn);
addToolBar(tool);
Best regards :D Chris
Adding PNG files to your project doesn't have any effect. You need to create a resource file and add your files to it. After doing this you can access resource data using ":/icons/newFile.png"
notation.