QTabWidget selected tab text blank

I’ve used QTabWidget successfully on windows 10 in the past without an issue.
However using on a mac running macOS 11.0.1 I am seeing the text of the selected tab, when it has focus, being blanked out.
QTabWidget_Selected

The tab text (gets unblanked) only appears when the tab looses focus:
QTabWidget_de_Selected

I suspect there is perhaps a style setting to fix this. However I would have expected the default to do sensible things.

Any ideas?

Version data as follows:
PYQT_VERSION = 329986
PYQT_VERSION_STR = 5.9.2
QOpenGLVersionProfile = <class ‘PyQt5.QtGui.QOpenGLVersionProfile’>
QOperatingSystemVersion = <class ‘PyQt5.QtCore.QOperatingSystemVersion’>
QT_VERSION = 329990
QT_VERSION_STR = 5.9.6

Hey there! I’ve made a little test application and ran it on macOS 10.15 (Catalina) and the tabs appear to be working correctly there.

from PyQt5.QtWidgets import QTabWidget, QApplication, QWidget

app = QApplication([])
tab = QTabWidget()

w = QWidget()
tab.addTab(w, 'Hello')

w = QWidget()
tab.addTab(w, 'Test')

w = QWidget()
tab.addTab(w, 'Another')

tab.show()

app.exec_()

…which shows the following (tested dark mode also) –

Screenshot 2021-01-06 at 21.12.06

Can you try this test to rule out any issues specific to your application? If this example doesn’t work I can try upgrading one of my machines to 11.0 myself. Or perhaps you can try PyQt5 5.15.2 (latest) ?

Thanks Martin, with your example I got the same.
Martins_example
I’ll try/attempt the upgrade to PyQt5 5.15.2

Appreciated.

Slightly against my better judgement I pip installed PyQt5 5.15.2 into the failing conda environment.
Martin_example_5.15.2
Which fixed the issue. Not intending to make an installable version for a while, when I might regret this!

Ah great, glad that’s fixed it – I wasn’t looking forward to upgrading my mac! :slight_smile:

I’ve leave a note that you’ve done this in your requirements.txt / docs or similar, so you don’t forget when you come to build. Easy to lose hours on forgotten quick fixes!

1 Like