Search code examples
macospython-3.xpyqt5macos-sierraqtabwidget

Mac OS Siera PyQt5 QTabWidget Issue


I usually program on windows (at work) or linux (free time). Now im doing a project for my wife, and she uses a mac.

In this project there is a QTabWidget with closeable tabs. On windows the close icon appears properly, and as excepted, however on MAC there is no close icon. When you click far left on the tab title it just closes unexpectedly, because you cant see a close icon, and im not 100% sure why that is.

Anyone seen this before and know of a fix?

Mac is latest Siera os (just updated) Python 3 PyQt5 (installed with pip3)

Thanks very much in advance


Solution

  • This is caused by a bug which has been fixed in Qt-5.9.2 (see QTBUG-61092).

    In the meantime, it should be possible to work around the issue by setting your own icon using a stylesheet. To do this, you would need to use the QTabBar::close-button selector, which is documented in the Qt Style Sheets Reference.