Important: Please read the Qt Code of Conduct -

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:/ TypeError: Property 'styleFont' of object QQuickRectangle(0x7fd7a97e1c00) is not a function (unknown-qrc:/
    15:34:49.842  qrc:/ TypeError: Type error (unknown-qrc:/
    15:34:50.124  qrc:/ TypeError: Type error (unknown-qrc:/

    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:

    Accesses indicator.styleFont when setting font.pixelSize which does not exist on Rectangle

    Button.qml, ProgressBar.qml, Slider.qml, and TextField.qml:
    Accesses background.styleFont when setting font.pixelSize which still does not exist on Rectangle

    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?

  • This post is deleted!

  • For anyone who comes to this in the future, I found the issue in the Qt bug tracker:

    Hopefully it'll get handled soon.

  • I am facing the same issue.
    It seems that the macOS style is broken.
    The workaround to get rid of these warnings is to force the Basic style via:


Log in to reply