Loading the QML Component Library in QtSDK



  • I'm trying to learn QT by reading C++ GUI Programming with QT4, and a long part of Chapter 2 describes how to use Qt Designer. It tells me to drag and drop widgets from the widget box and drop them on the form.

    But I don't have Qt Designer, I have QtSDK. It has a variety of project types you can create, and I've created a dozen different project flavors now, but of those with QML the buttons mentioned in the book do not appear in the library. The library has "Border Image", "Flickable", "Flipable", etc., but no buttons or sliders or checkboxes, etc.

    I've tried setting QML_IMPORT_PATH in the .pro file to the QtSDK subdirectory where I found the buttons (Button.qml, ButtonGroup.qml, ToolButton.qml, etc.), but that didn't work. I tried "File->Open File or Project", but that opens a QML file in the designer rather than adding it to the library so I can drag and drop it.

    Poking around the QtSDK directory tree I can see that there are a large number of QML files that would be nice to be able to drag-n-drop. How do I make them available to new projects?

    If it helps, I'm using Windows 7.

    --Percy



  • There are two worlds, for short Qt Widgets, and QML. The book you have is targeted at Qt Widgets, and the Qt Designer, which is embedded in Qt Creator, which comes with the SDK. There you have buttons, and tree views, and checkboxes and all the stuff mentioned in the book. The .qml files you found are unrelated.



  • Well, now I'm very confused. Perhaps I'm misparsing, so let me ask. Were you really referring to SDK when you said it has "buttons, tree views, checkboxes, and all the stuff mentioned in the book. The .qml files you found are unrelated."

    The reason I'm even more confused now is because in QtSDK the only way I've found to get to the designer is by clicking on "Design" in the left hand navigation bar, and that button only becomes active when a QML file is selected. And that designer does not have checkboxes or buttons or any of that. It does have Image, Item, Text, Flow, Grid, to mention a few, but not the higher level items like buttons and so forth.

    Perhaps I should just ask straight out: Using QtSDK, how do I use the embedded Qt Designer?

    --Percy



  • The "Design Mode" is shared by the Qt Widget Designer (what your book refers to) and the QML Designer. So "Design" mode will open when you select either .ui or .qml files, but you'll get two completely different interfaces. To get the embedded Qt Widget Desiger, open a .ui file.



  • Okay, thanks, that did the trick!

    In case anyone else has the same question, here's how you use Qt Creator to begin a project using the embedded Qt Designer. Click on:

    File > New File or Project > Qt Widget Project > Qt Gui Application > Choose

    --Percy



  • Had to take a brief hiatus and am coming back to this now. It seems very useful that Qt Designer has buttons, combo boxes, frames, a dock widget, etc. Is there a way to get an equivalent library of items for QML Designer?

    --Percy



  • What probably need are the "Qt Quick Desktop Components":http://labs.qt.nokia.com/2011/03/10/qml-components-for-desktop. But they are still in an alpha stage.


Log in to reply
 

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