Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QTabWidget - Icons disappear when tab selected



  • Hi all,

    I am using Ui Designer. I am building a QTabWidget. I have added my icons to the tabs, and added an icon for each state, yet when built when the tab is selected, it goes grey and the icon disappears. I could mess about with this for a few hours and make it work, however, i want to know if there is something I am missing in UI designer.

    Any suggestions?



  • Code, we need code!!! More code.

    1. In which way do you link icon (absolute way or resource) - maybe icon's way is broken.
    2. Maybe you have some external code which remove it (review yourself).


  • Hi, sorry, the functionality was created entirely with UI designer so below I include my ui file
    to answer your question, I am using a resource file for the icons

    Below is my UI file

    @<widget class="QWidget" name="tab_2">
    <attribute name="icon">
    <iconset resource="Icons.qrc">
    <normaloff>:/new/prefix1/WorkRules.png</normaloff>
    <normalon>:/new/prefix1/WorkRules.png</normalon>
    <activeoff>:/new/prefix1/WorkRules.png</activeoff>
    <activeon>:/new/prefix1/WorkRules.png</activeon>
    <selectedoff>:/new/prefix1/WorkRules.png</selectedoff>
    <selectedon>:/new/prefix1/WorkRules.png</selectedon>:/new/prefix1/WorkRules.png</iconset>
    </attribute>@


Log in to reply