[PyQt] PyQt not using Qt themes on Linux

Alasdair B R Stewart alasdair.b.r.stewart at gmail.com
Mon Jan 8 10:38:21 GMT 2018


Hi,


I am running Ubuntu 17.10 and having difficulty getting PyQt to use the 
system theme. Since Gnome is the default desktop I have used Kvantum 
Manager to specify ArcDark as the system Qt5 theme. This works in the 
majority of applications - including Qt 5 Designer! Though it does not 
appear as an option to preview in, instead only showing: Breeze, 
bb10dark, bb10bright, kvantum-dark, kvantum, cleanlooks, gtk2, cde, 
motif, plastique, Windows, Fusion.

As it is a pre-built wheel PyQt only has Windows and Fusion as inbuilt 
stylesheet options -

 >>> from PyQt5.QtWidgets import QStyleFactory
 >>> print(QStyleFactory.keys())
['Windows', 'Fusion']

Running any scripts I've written using PyQt5 (installed via conda) 
defaults to Windows when run, likely as they built PyQt on a Windows 
machine. I also tried installing PyQt from pip, which overrides the 
conda install. It instead defaults to Fusion style but at least provides 
the error message "QApplication: invalid style override passed, ignoring 
it". Again only Windows and Fusion are recognised QStyleFactory keys for 
some reason.

Installing python3-pyqt* and running pyqt scripts using the 
/usr/bin/python3.6 half works. The colours and some of the layout are 
now ArcDark but there remain a few Fusion elements - guessing there is a 
gtk theming issue here.

Does anyone know a way to fix this? Ideally, I would want this to run 
with the conda version of python. Alternatively, is there anyway to use 
the files from arc-kde github to manually specify the style for each 
script?


Thank you,


Alasdair


P.S. Apologies if this is a duplicate threat - unsure if my first e-mail 
sent correctly.



More information about the PyQt mailing list