QTabWidget/QTabBar



  • I want to add an different image to each of the tabs of my tab widget. I could do the setting of an image using style sheets :

    @QTabBar::tab {
    background-image: url(:/Images/medication.png);
    }@

    But this applies to all tabs. How do I select each tab of a tabbar separately?



  • You can use @int QTabBar::addTab ( const QIcon & icon, const QString & text); @



  • I would like to do it in the style sheet editor in designer mode. Is it possible ?



  • [quote author="filipv" date="1284641514"]I would like to do it in the style sheet editor in designer mode. Is it possible ?[/quote]

    Might not be possible directly using style sheet. Is your intention to avoid writing code? If so, then you can use the designer and specify individual icons for the tabs using the "CurrentTabIcon" property of the QTabWidget in the designer. Is that what you were looking for?



  • [quote author="filipv" date="1284636041"]I want to add an different image to each of the tabs of my tab widget. I could do the setting of an image using style sheets :

    @QTabBar::tab {
    background-image: url(:/Images/medication.png);
    }@

    But this applies to all tabs. How do I select each tab of a tabbar separately?[/quote]

    Your original question was it to set background image to each tab page or is it to set individual icons for each tab page?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.