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

Font size not applied #57

Closed jgrichard closed 2 years ago

jgrichard commented 2 years ago

Setting font point size does not seem to work. Removing the apply_stylesheet call will show the font in the correct size.

import sys
from PySide6 import QtWidgets, QtCore, QtGui
from qt_material import apply_stylesheet, add_fonts

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

    font = QtGui.QFont()
    font.setPointSize(32)

    label = QtWidgets.QLabel('Test')
    label.setFont(font)
    label.show()

    apply_stylesheet(window, 'dark_cyan.xml')

    app.exec()
    sys.exit()
jgrichard commented 2 years ago

To set the font on the widget, you can remove font-size from material.css.template and then the .setFont() call will function as expected.