Lots of TypeErrors in console when migrating to Qt6
-
Hello,
I'm making a post here because I can't find any information on these lines anywhere and looking up Qt source showing nothing at the lines mentioned.
Basically I'm upgrading from 5.15.2 to 6.2.1. The biggest issue is there are tons of controls that are printing TypeErrors. For example:
15:34:49.842 qrc:/qt-project.org/imports/QtQuick/Controls/macOS/TextField.qml:43: TypeError: Property 'styleFont' of object QQuickRectangle(0x7fd7a97e1c00) is not a function (unknown-qrc:/qt-project.org/imports/QtQuick/Controls/macOS/TextField.qml:43) 15:34:49.842 qrc:/qt-project.org/imports/QtQuick/Controls/macOS/Button.qml:44: TypeError: Type error (unknown-qrc:/qt-project.org/imports/QtQuick/Controls/macOS/Button.qml:44) 15:34:50.124 qrc:/qt-project.org/imports/QtQuick/Controls/macOS/CheckBox.qml:45: TypeError: Type error (unknown-qrc:/qt-project.org/imports/QtQuick/Controls/macOS/CheckBox.qml:45)
For the CheckBox example I've narrowed it down to the
indicator
property. If I set the indicator at all, I get the errors. If I remove it entirely, they are gone. The minimum reproduction in this case is:indicator: Rectangle { } // Comment to remove error
I'm unsure how to debug this further. Is there some new syntax/way to style that I've missed?
-
I dug into this and I found out how to access the sources. The issue seems to be that internal Qt QML files are accessing properties that don't exist. I'm still not sure if this is because I'm missing some new styling syntax or not, but the current Qt 6 custom styling docs seem to be doing what I'm doing (e.g., making a Rectangle for indicator).
Specifically, the issues seem to be:
CheckBox.qml:
Accessesindicator.styleFont
when settingfont.pixelSize
which does not exist onRectangle
Button.qml, ProgressBar.qml, Slider.qml, and TextField.qml:
Accessesbackground.styleFont
when settingfont.pixelSize
which still does not exist onRectangle
If I set
font.pixelSize
manually then I don't get the errors, but I do not want to be setting pixelSize like this since I've have to redo a lot of font sizes everywhere.Does anyone know if this is a bug/issue, or if I'm just doing it wrong?
-
For anyone who comes to this in the future, I found the issue in the Qt bug tracker: https://bugreports.qt.io/browse/QTBUG-98098
Hopefully it'll get handled soon.