How set Native text renderer globaly?
-
Hello,
I trying to set native render globaly for my qml app. I tried to use QQuickWindow#setTextRenderType. But there is a problem, that method should be called before main.qml load otherwise it won't work at all (app will use Qt renderer). So i tried to load temporal file, then use setTextRenderType and then load main.qml, as i see it is not a good solution and it is looking bad. So any idea how can i do this in better way? There is a small example of main c++#include <QGuiApplication> #include <QQmlApplicationEngine> #include <QQuickWindow> int main(int argc, char *argv[]) { QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QGuiApplication app(argc, argv); QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:/qml/tempItem.qml"))); QQuickWindow* window = qobject_cast<QQuickWindow*>(engine.rootObjects().first()); window->setTextRenderType(QQuickWindow::TextRenderType::NativeTextRendering); engine.load(QUrl(QStringLiteral("qrc:/qml/main.qml"))); if (engine.rootObjects().isEmpty()) return -1; return app.exec();
tempItem.qml
import QtQuick 2.0 Item { }
main.qml
import QtQuick 2.12 import QtQuick.Window 2.12 import QtQuick.Controls 2.12 ApplicationWindow { visible: true width: 300 height: 300 Label { anchors.centeIn: parent text: "Hello world!" } }
-
@martin_ky, do you know how to invoke that via
python3
(withPyQt6
orPySide6
)? If not, do you know where that information might be available...? https://stackoverflow.com/questions/43369016/can-i-globally-switch-to-native-text-rendering-in-qt-quick-controls-2 doesn't help much. -
https://discuss.kde.org/t/qml-pyqt6-cant-get-native-control-appearance/1240/10?u=rokejulianlockhart
it the solution. How to mark this as solved?
-
@BEEDELL-ROKE-JULIAN-LOCKHART hi, you can use the "Topic Tools" button or the three doted menu beside the answer your deem correct.
-
@BEEDELL-ROKE-JULIAN-LOCKHART my bad, I did not saw that you were not the thread author. As such you cannot mark it solved.