QDarkStyleSheet icon indicating copy to clipboard operation
QDarkStyleSheet copied to clipboard

Feature Request: PySide6 support

Open seriousm4x opened this issue 4 years ago • 8 comments

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.

seriousm4x avatar Dec 09 '20 10:12 seriousm4x

Same error occurs when using PyQt6. Some styles are not correctly applied, there is overlap between widgets.

krisfris avatar Jan 25 '21 21:01 krisfris

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_())

olivierdalang avatar Feb 13 '21 00:02 olivierdalang

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

seriousm4x avatar May 12 '21 08:05 seriousm4x

@ColinDuquesnoy looks like qtpy is getting close to rolling out PyQt6 support! https://github.com/spyder-ide/qtpy/issues/233 ❤️

jaymegordo avatar Dec 03 '21 18:12 jaymegordo

qtpy 2.0.0 released https://github.com/spyder-ide/qtpy/releases/tag/v2.0.0

jwaschkau avatar Dec 27 '21 11:12 jwaschkau

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?

rimpy-custom avatar Mar 08 '22 04:03 rimpy-custom

@dpizetta Could you create a release with the changes from the develop branch?

zariiii9003 avatar Dec 26 '22 02:12 zariiii9003

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.

Gracecr avatar Mar 27 '23 17:03 Gracecr