Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Set default font for qml controls
I load my qml scene int QQuickWindow using this code:
QQmlComponent *comp = new QQmlComponent(engine, QUrl("qrc:/controllers/sample.qml"), contentItem()); QObject *obj = comp->create(); QQmlProperty::write(obj, "parent", QVariant::fromValue<QObject*>(contentItem()));
But font in labels and text fields is small. Is it possible to specify default font in qml?
A Former User last edited by
QApplication app(argc, argv); // ... QFont fon("Helvetica", 40); app.setFont(fon);
Yeah, but this will affect fonts everywhere in application. Can I specify the font in my QQuickWindow only (that is subwindow in mdi area)?
A Former User last edited by A Former User
I see no possibility to do it with QQuickWindow, but if you use a QWindow instead and place a QQuickWidget on it then you can use
QWidget::setStyleSheet()to set the default font (and maybe other stuff as you like) only for that QQuickWidget.
Thank you, I will try do it on native window container of my QQuickWindow