MacOS: QLineEdit height when changing font-size in stylesheet
Unsolved
Qt for Python
-
Hi,
My Problem is that under MacOS/OSX with the default "macintosh" theme QLineEdits don't change their height when I set a larger font with "setStyleSheet".
It works correctly when setting the fontsize with "setPointSize" or when I'm using another style like "fusion".
Here's a sample script:
import sys from PySide2.QtWidgets import * import PySide2 class Form(QDialog): def __init__(self, parent=None): super(Form, self).__init__(parent) self.edit1 = QLineEdit(PySide2.__version__) self.edit2 = QLineEdit(PySide2.__version__) self.edit3 = QLineEdit(PySide2.__version__) layout = QVBoxLayout() layout.addWidget(self.edit1) layout.addWidget(self.edit2) layout.addWidget(self.edit3) self.setLayout(layout) f = self.edit1.font() f.setPointSize(27) self.edit1.setFont(f) self.edit2.setObjectName("edit2") self.setStyleSheet("QLineEdit#edit2 {font-size: 27pt}") self.edit3.setStyleSheet("font-size: 27pt") if __name__ == "__main__": app = QApplication(sys.argv) form = Form() form.show() sys.exit(app.exec_())
Result without "-style" or with "-style macintosh":
Result with "-style fusion":
Is there anything missing/wrong in my script or is this a bug in QT?
Thanks.