Issue
I am trying to set custom style to my PyQt5 application using the setStyle()
method but it doesn't work.
I am also not entirely sure about where this should be put.
In my main I tried doing :
if __name__ == '__main__':
QApplication.setStyle("mac") #here
app = QApplication(sys.argv)
splash_pix = QPixmap('../resource/logo.png')
start = time.time()
splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint)
splash.show()
while time.time() - start < 1:
time.sleep(0.003)
app.processEvents()
ex = Fy360()
splash.finish(ex)
sys.exit(app.exec_())
Edit : Upon importing from PyQt5.QtWidgets import QStyleFactory
and printing the QStyleFactory.keys()
I gotthe output as:
[u'Windows', u'Fusion']
why are there only these options?
Whats going wrong here?
Solution
Some styles are dependent on the OS, others are not, for example the Mac style is only for Mac OS, or for example fusion is compatible for several OS.
Some styles (for example gtk) can be configured as follows:
Based on the discussion :
- Install
qt5-styleplugins
andqt5ct
- Set environment variable in /etc/environment
QT_QPA_PLATFORMTHEME=qt5ct
- Restart the system
- Start
qt5ct
and selectgtk2
Answered By - eyllanesc
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.