Quick Controls 2 Material Theme font (Roboto) problem
-
I created example project containig only one button and Material Theme. (using Wizard in Qt Creator)
Main.cpp:
#include <QGuiApplication> #include <QQmlApplicationEngine> int main(int argc, char *argv[]) { QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QGuiApplication app(argc, argv); QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); if (engine.rootObjects().isEmpty()) return -1; return app.exec(); }
main.qml:
import QtQuick 2.12 import QtQuick.Window 2.12 import QtQuick.Controls 2.12 Window { visible: true width: 640 height: 480 title: qsTr("Hello World") Button{ text: "Test" highlighted: true } }
qtquickcontrols2.conf:
[Controls] Style=Material [Material] Primary=#1976D2 Accent=#FF5722
When I run thisaxample I see this:
Font on the button is very small and it is not Roboto font.
(family MS Shell Dlg 2, pixel size: 8)I have installed Robot font in my system because if I add font family to button all works file.
main.qml:import QtQuick 2.12 import QtQuick.Window 2.12 import QtQuick.Controls 2.12 Window { visible: true width: 640 height: 480 title: qsTr("Hello World") Button{ text: "Test" highlighted: true font.family: "Roboto" font.pixelSize: 14 } }
It is really Roboto font 14 px. But as I see in source code font is set in start of application.
Lets see... Font family and font size are set at startup.
Please tell me this is bug or I missing something?
Thank you.
P.S. My test system is: Qt 5.12.1, MinGW 7.3.0 64 bit, Windows 10
-
I created example project containig only one button and Material Theme. (using Wizard in Qt Creator)
Main.cpp:
#include <QGuiApplication> #include <QQmlApplicationEngine> int main(int argc, char *argv[]) { QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QGuiApplication app(argc, argv); QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); if (engine.rootObjects().isEmpty()) return -1; return app.exec(); }
main.qml:
import QtQuick 2.12 import QtQuick.Window 2.12 import QtQuick.Controls 2.12 Window { visible: true width: 640 height: 480 title: qsTr("Hello World") Button{ text: "Test" highlighted: true } }
qtquickcontrols2.conf:
[Controls] Style=Material [Material] Primary=#1976D2 Accent=#FF5722
When I run thisaxample I see this:
Font on the button is very small and it is not Roboto font.
(family MS Shell Dlg 2, pixel size: 8)I have installed Robot font in my system because if I add font family to button all works file.
main.qml:import QtQuick 2.12 import QtQuick.Window 2.12 import QtQuick.Controls 2.12 Window { visible: true width: 640 height: 480 title: qsTr("Hello World") Button{ text: "Test" highlighted: true font.family: "Roboto" font.pixelSize: 14 } }
It is really Roboto font 14 px. But as I see in source code font is set in start of application.
Lets see... Font family and font size are set at startup.
Please tell me this is bug or I missing something?
Thank you.
P.S. My test system is: Qt 5.12.1, MinGW 7.3.0 64 bit, Windows 10
Addition
But if I compile with Qt 5.9.7 all works fine.
main.qml:
import QtQuick 2.9 import QtQuick.Window 2.3 import QtQuick.Controls 2.2 Window { visible: true width: 640 height: 480 title: qsTr("Hello World") Button{ text: "Test" highlighted: true } }
Only button text in uppercase.
Please tell me what difference and what I miss in new version?