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

The font or background color of the table widget does not change. #55

Open cazador4980 opened 2 years ago

cazador4980 commented 2 years ago

If the theme is not applied, the code below will be applied. 'setForeground(0, 0, 255)' It does not apply when the theme is applied. How can I solve this problem?

JohanRain commented 2 years ago

the same problem

YeisonCardona commented 2 years ago

Hi @cazador4980 and @FoolAsphel

If you mean about change theme features, it can be done by changing the stylesheet and add custom-stylesheets.

After apply_stylesheet()

stylesheet = app.styleSheet()
app.setStyleSheet(stylesheet + "QTableView {background-color: #0000ff;}")

The stylesheet can also be changed on runtime by:

stylesheet = app.styleSheet()
with open('custom.css') as file:
    app.setStyleSheet(stylesheet + file.read().format(**os.environ))