Functions are not supported in a Qt Quick UI form

  • Hi:

    I have a simple Qt Quick application, slightly modified from the template generated by Creator 3.6 to integrate C++ access via a singleton object.

    I invoke C++ from QML to set the text of a button as follows:
    Button {
    id: button1
    text: data_provider.get("button_text")

    This syntax gets underlined red in Creator, and I get the following error message when trying to open the qml file with design:
    "Cannot open this QML document because of an error in the QML file:
    Functions are not supported in a Qt Quick UI form. (M222)"

    Meanwhile, my application seems to run properly (i.e. the C++ function call works just fine and I can properly set the text of the button at run time). The error is very annoying as I basically cannot use Creator to work in the Design window.

    What is this due to? And how to fix it?

    I also updated to Creator 4.1 and it does the same as 3.6.


  • Qt Champions 2016

    Qt Quick UI Form is supposed to be a QML file with only visible element. No business logic should be present.

    When you create a Qt Quick UI Form by Qt Creator. It will create two files.

    1. YourItemForm.ui.qml
    2. YourItem.qml <--- You should write the logic here.



    YourItemForm {
      button1 {
        text: data_provider.get("button_text")


    Item {
      property alias button1 : button1 
      Button {
        id: button1

    p.s You don't need to setup the alias by your self. You may use GUI to do so.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.