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

How to get theme name after changing theme in runtime? #22

Closed zdposter closed 3 years ago

zdposter commented 3 years ago

I would like to store it to settings, so it can be automatically used at next application run.

class RuntimeStylesheets(QMainWindow, QtStyleTools):

    def __init__(self):
        super().__init__()
        self.main = QUiLoader().load('main_window.ui', self)

        self.add_menu_theme(self.main, self.main.menuStyles)
YeisonCardona commented 3 years ago

Hi @zdposter

The variables for the theme are available as environment variables, for example the theme name is QTMATERIAL_THEME, so in python: os.environ.get('QTMATERIAL_THEME')

zdposter commented 3 years ago

Thanks it works.