Newbie question - how to show QML Components in Creator QML Design Window



  • Running Qt Creator 2.0.91 (2.1.0 -Dpre-Beta1) Sep 29

    When I "Explore Qt Quick Examples" and open the ui-components project, then open slideswitch.qml file in slideswitch folder, then switch to Design mode, the Library Items shows the Switch (from the Contents folder in slideswitch) under "QML Components". How did it get there? I want to have a set of components to design with. I just can't find out how to add my own components to the designer Library list.

    Thanks in advance.



  • Hey I don't use the qml designer that much so I never observer your problem but sometimes I take a look at the designer.

    I'm not sure but I believe that my own components were available in the designer.

    I have one sub directory with my qml sources and there I made another sub directory with my custom elements called "elements" as far as I can remember I had the option to use this elements in the designer. But it seems to be depending on which qml source you currently select.

    Lets say you have:

    untitled.qml

    Source1.qml

    source2.qml

    If you select untitled.qml and go to the designer to get the Source1.qml in the list of QML-Components.

    As far as I know the source2.qml will not appear in the list because its first letter is lower case and Components have to be starting with upper case letters.

    I hope that this is helpful.

    Try this yourself.



  • I think the issue is that the project needs to be saved and then re-opened. Now the QML Component shows up as it should. Thanks for the explanation about upper case vs lower case - that saves a lot of head scratching.



  • Hmm I my case I don't had to reopen the project.

    I just added a new qml component and thats it.



  • Do you have a ".qmlproject" file in your project directory? It has a QmlFiles field where it instructs Qt Creator where to find qml files. If you don't have one, it's possible that it's causing the need to reopen the project in order to load the new files, because, like Schneidi said, normally reopening is not necessary.


Log in to reply
 

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