Hide an Icon in a Tab
-
Hi,
I have a tabWidget where I added an icon to a tab which was very simple to do. The problem is when the user clicks on the tab I change the text on the tab but I also would like to hide the icon. I did subclass QTabWidget and QTabBar so I do have a paintEvent capability if I need it. Can someone explain to me how I can hide the icon or remove it, either is okay. I searched hi and low but there doesn't seem to be any threads on the subject.
Any help is appreciated.
-
So how did you add it?
-
QIcon icon(":Warning.gif");
customTabWidget_->setTabText(alertsTabIndex_, "* Alerts *"); //add the text
customTabWidget_->setTabIcon(alertsTabIndex_, icon); //add the iconBut how can I hide or remove it if I need to?
@leinad said in Hide an Icon in a Tab:
But how can I hide or remove it if I need to?
Did you try to set a null icon if you want to hide the icon?
-
QIcon(NULL) will not compile
Simply pass an empty QIcon() to setTabIcon()