Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QML - Imperative code not supported

Can someone comment on the fact that for QML, any imperative JavaScript code is not executed unless it is part of an extra component. I am facing such kind of problem when I include the following code to my QML:

function qmlSlot(text){
    page.data=text
    if(page.data==="received")
        page.color="black";
}

As the Qt Designer get frozen and shows the following warning:

Imperative code is not supported in the Qt Quick Designer

I read that building qmlpuppet installs an executable for rendering components in the /bin directory of the Qt building it. Qt Quick Designer checks for the Qt of the current project if a qmlpuppet is in the /bin directory. If yes it takes the qmlpuppet provided by the Qt version instead of the one provided by Qt Creator itself. In my case I haven't used the Qt static binary install, but instead built Qt from the source, thus qmlpuppet executable was generated and is already located at:

/usr/local/Qt-5.2.1/qtcreator/bin
-rwxr-xr-x  1 qml2puppet
-rwxr-xr-x  1 qmlpuppet

So, the executable qmlpuppet is placed where is expected to be found and still this annoying message continues.

The workaround I took at moment is to comment out any so called "Imperative code" for when I want to edit the front-end QML using Qt Designer. Then after take out those comments to have the "Imperative code" activated again. But this is very annoying, although the code compile and works as I expected it to behave.

So, should I get worried about this warning? Anyway, there is some mean to get rid of this problem, as it froze the Qt Designer?

like image 314
Viktor Kovaleva Avatar asked Jan 24 '14 05:01

Viktor Kovaleva


Video Answer


1 Answers

This is currently a reported QtCreator Bug :

https://bugreports.qt-project.org/browse/QTCREATORBUG-10940?page=com.atlassian.streams.streams-jira-plugin:activity-stream-issue-tab https://bugreports.qt.io/browse/QTCREATORBUG-10940

So don't be worried about the warning, it will be fix

like image 189
BlueMagma Avatar answered Sep 29 '22 21:09

BlueMagma