Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix styling on PySide6 #263

Closed
wants to merge 1 commit into from

Conversation

meowmeowahr
Copy link

Issue

QWidget.setStyle on PySide6 only accepts a QStyle class, while PyQt5, PyQt6, and PySide2 can accept a QStyle or a string. This causes qtawesome.dark() / qtawesome.light() to fail on PySide6.

Change

This change fixes the issue by using QStyleFactory.create() to set the application style in styles.py

@dalthviz
Copy link
Member

dalthviz commented Sep 7, 2024

Hi @meowmeowahr thank you for submitting a fix! Do this issue raise with a specific version of PySide6? I tried to see if running things from master using PySide6 6.7.2 caused any issue related with the style but seems like I was unable to reproduce 🤔 Could you explain a little bit more how setting the app style was raising an issue for you or add some before/after screenshot preview to better understand how this change affects how things look? Thank you again for proposing changes and let us know!

@meowmeowahr
Copy link
Author

I can't seem to reproduce the issue anymore. I have tried all versions of PySide6 on both Linux and WIndows and it works fine with the code on master and my fork.

Here is my test code

from PySide6.QtCore import Qt, qVersion
from PySide6.QtWidgets import QWidget, QApplication, QPushButton, QVBoxLayout
import sys

import qtawesome

print("Qt", qVersion())

class TestWindow(QWidget):
    def __init__(self) -> None:
        super().__init__()
        
        self.vlayout = QVBoxLayout()
        self.setLayout(self.vlayout)

        self.light = QPushButton("Light")
        self.light.clicked.connect(lambda: qtawesome.light(app))
        self.vlayout.addWidget(self.light)

        self.dark = QPushButton("Dark")
        self.dark.clicked.connect(lambda: qtawesome.dark(app))
        self.vlayout.addWidget(self.dark)

        self.show()


if __name__ == "__main__":
    app = QApplication(sys.argv)
    win = TestWindow()
    app.exec()

@dalthviz
Copy link
Member

dalthviz commented Sep 7, 2024

Oh thank you for the check! In that case it seems like the change is not needed, right? I would say we could close this one for now, but if you find a way to reproduce the issue let us know to be able to restart checking this work!

@meowmeowahr
Copy link
Author

Thanks, I don't think the change is needed as of now. I will close the PR.

@meowmeowahr meowmeowahr closed this Sep 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants