Search code examples
c++macosqtqt5osx-elcapitan

QT tab widget - tab text behaviour on focus


enter image description here

I am using Qt to create a QT tab widget for a GUI. I cant figure out why the tab currently in focus changes the text to white ? It only happens on the currently selected tab. If I open another window in the same GUI, The text goes back to black.

How can I always force the text to remain black, even when under focus ?

I am using Qt 5.8.0 on a mac OS X running El Capitan 10.11.6.

this is my current style sheet

tabWidget1->setStyleSheet("QTabBar::tab { background-color: #ACB6B6; }"
                              "QTabBar::tab:focus { color: #000000; }");

I've also tried to use this code but it didnt do anything

tabWidget1->setFocusPolicy(Qt::NoFocus);

Solution

  • tabWidget1->setStyleSheet("QTabBar::tab:selected {color: #000000;}");
    

    Resolved using the above stylesheet.