UN-GCPDS / qt-material

Material inspired stylesheet for PySide2, PySide6, PyQt5 and PyQt6
https://qt-material.readthedocs.io/en/latest/
BSD 2-Clause "Simplified" License
2.27k stars 241 forks source link

PySide6 - Incompatibility with "from __feature__ import snake_case" #21

Open corykinney opened 3 years ago

corykinney commented 3 years ago

Hello, I appreciate all the work that's been put into this package, and I'd love to help contribute, but I'm not sure how to fix this issue on my own.

In PySide6 you can use from __feature__ import snake_case to switch to more Python-friendly naming. If you attempt this import before import qt-material, it will be overridden by qt-material's internal PySide6 imports. If you attempt this import after importing qt-material, you receive the error AttributeError: type object 'PySide6.QtGui.QFontDatabase' has no attribute 'addApplicationFont' which is of course thrown by the first line in qt-material that calls a function with camel case.

It would be nice if we didn't have to choose between PySide6's snake_case and qt-material theming, but if there isn't a good fix for this, I understand.

EDIT: Currently the only workaround I've found is to switch to snake case after applying the style sheet like so

if __name__ == '__main__':
    app = QApplication()

    apply_stylesheet(app, theme='dark_blue.xml')
    from __feature__ import snake_case
    ...