QDarkStyleSheet
QDarkStyleSheet copied to clipboard
Feature Request: PySide6 support
Add support for PySide6, the successor to PySide2. As Qt6 just got released and PySide6 is in the works, it would be time to add support for the new versions.
Overall its already usable, but I encounter small errors. This python code for example which works fine with PySide2:
import sys
import qdarkstyle
from PySide6.QtWidgets import QApplication
app = QApplication()
app.setStyleSheet(qdarkstyle.load_stylesheet_pyside2())
sys.exit(app.exec_())
Error:
No QCoreApplication instance found. Application patches not applied. You have to call load_stylesheet function after instantiation of QApplication to take effect.
Edit: PySide6 released the first stable version 6.0.0 on 10th Dec.
Same error occurs when using PyQt6. Some styles are not correctly applied, there is overlap between widgets.
As a workaround for now (hack), you can do that :
import sys
import qdarkstyle
from PySide6.QtWidgets import QApplication
app = QApplication()
# hack until proper PySide6 support : https://github.com/ColinDuquesnoy/QDarkStyleSheet/issues/249
sys.modules["PySide2"] = PySide6
app.setStyleSheet(qdarkstyle.load_stylesheet_pyside2())
sys.exit(app.exec_())
I just learned that this project uses qtpy. I'm gonna link these issues here. https://github.com/spyder-ide/qtpy/issues/229 https://github.com/spyder-ide/qtpy/issues/233
@ColinDuquesnoy looks like qtpy is getting close to rolling out PyQt6 support! https://github.com/spyder-ide/qtpy/issues/233 ❤️
qtpy 2.0.0 released https://github.com/spyder-ide/qtpy/releases/tag/v2.0.0
As a workaround for now (hack), you can do that :
import sys import qdarkstyle from PySide6.QtWidgets import QApplication app = QApplication() # hack until proper PySide6 support : https://github.com/ColinDuquesnoy/QDarkStyleSheet/issues/249 sys.modules["PySide2"] = PySide6 app.setStyleSheet(qdarkstyle.load_stylesheet_pyside2()) sys.exit(app.exec_())
Have tried that solution, but widgets get misplaced(overlapped), might be smth on my side. Did you find the way to apply theme in better way?
@dpizetta Could you create a release with the changes from the develop branch?
Installing the develop branch is working for me.
pip install https://github.com/ColinDuquesnoy/QDarkStyleSheet/archive/refs/heads/develop.zip
A PyPi release would be appreciated.