Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Stop disabled tab from greying out icon
Forum Updated to NodeBB v4.3 + New Features

Stop disabled tab from greying out icon

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 295 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    TimoKn
    wrote on last edited by
    #1

    Hello,

    I have a QTabWidget containing multiple different tabs each having their own icons. I have disabled 1 of these tabs using setTabEnabled() but the icon within the tab is now greyed out, is there any way to prevent the icon from being greyed out while still having the tab be disabled?

    The code I use to disable the tab and set the icon:

        ui->tabWidget->setTabEnabled(0, false);    
    
        QIcon QMI_logo;
        QMI_logo.addPixmap(QPixmap(":/images/Images/MI_LOGO_SMALL.svg"), QIcon::Normal);
        ui->tabWidget->setTabIcon(0,QMI_logo);
    

    Thank you.

    JonBJ 1 Reply Last reply
    0
    • T TimoKn

      Hello,

      I have a QTabWidget containing multiple different tabs each having their own icons. I have disabled 1 of these tabs using setTabEnabled() but the icon within the tab is now greyed out, is there any way to prevent the icon from being greyed out while still having the tab be disabled?

      The code I use to disable the tab and set the icon:

          ui->tabWidget->setTabEnabled(0, false);    
      
          QIcon QMI_logo;
          QMI_logo.addPixmap(QPixmap(":/images/Images/MI_LOGO_SMALL.svg"), QIcon::Normal);
          ui->tabWidget->setTabIcon(0,QMI_logo);
      

      Thank you.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @TimoKn
      Not ideal, but if nobody suggests a way of telling QTabWidget not to show disabled tabs' icons as disabled I think you could add

      QMI_logo.addPixmap(QPixmap(":/images/Images/MI_LOGO_SMALL.svg"), QIcon::Disabled);
      

      to make it use that explicitly as-is (instead of greying it) for the Disabled state?

      T 1 Reply Last reply
      2
      • JonBJ JonB

        @TimoKn
        Not ideal, but if nobody suggests a way of telling QTabWidget not to show disabled tabs' icons as disabled I think you could add

        QMI_logo.addPixmap(QPixmap(":/images/Images/MI_LOGO_SMALL.svg"), QIcon::Disabled);
        

        to make it use that explicitly as-is (instead of greying it) for the Disabled state?

        T Offline
        T Offline
        TimoKn
        wrote on last edited by
        #3

        @JonB Yes this works for me, thanks.

        1 Reply Last reply
        0
        • T TimoKn has marked this topic as solved on

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved