Qt5.7/C++ - Window icon shows, can't show control icons.
Hello,
Windows 10 32 bit
Qt5.7, QtCreator 4.1.0
I can get the QMainWindow showing an icon.
Code:
Pro file
RESOURCES += gui_icons.qrc
RC_ICONS = myApp.ico
Code:
gui_icons.qrc
<RCC>
<qresource prefix="/images">
<file>images/browse.ico</file>
<file>images/myApp.ico</file>
</qresource>
</RCC>
I have a QToolButton on the QMainWindow generated from Designer.
I have in my source code:-
Code:
ui
->tbBrowse
->setIcon
(QIcon ("browse.ico"));
I've also set the icon in Designer.
The icon never shows.
What steps am I missing?
Regards
Re: Qt5.7/C++ - Window icon shows, can't show control icons.
A resource path starts with ":" and your path is also missing the "images" prefix.
Cheers,
_
Re: Qt5.7/C++ - Window icon shows, can't show control icons.
Hello anda_skoa
Code:
ui
->tbBrowse
->setIcon
(QIcon (":/images/images/browse.ico"));
Does the trick, Thanks.
Regards