Difference between QML and UI

  • Hey everyone,

    Please excuse my stupid questions but i am new with Qt and i don't understand how to use qml. It is possible to use qml and a file .ui in the same time? For example is possible to make a button in qml and after that to add the button to your .ui file?
    In exemple from the internet is used qml or .ui file. I have not find an example with both.

    Thank you in advice,

  • Lifetime Qt Champion

    No , you cannot insert a QML button directly.
    It must be shown in its own view
    So you can have QML in an area inside your UI.
    You could make area as small as the button and somewhat get the effect..

    Note, that normally, you write all user interface in QML.
    Then for calculations or other heavy stuff , c++ is used as backbone.

    Can I ask why you want to use QML in UI.
    If you use the Qt Quick controls, then you also have full Designer etc so
    Im not sure why you want to do it the other way?

    You could use this book to get a overview

  • Hi @mrjj

    I want to use QML because i can create nice controls. I have try to use Qt Quick controls but it can not customize very well my widgets. If i drag and drop a control from Qt Quick controls doesn't look very well. I don't have experience in creating UI so i thought it will be better to use QML.
    Thanks for the replay @mrjj .

  • Lifetime Qt Champion

    You are welcome.
    Well Qt Quick Controls 2 offer
    delegates to change the look of them.
    I think Qt Quick 1 Controls also offer styling too.
    QWidgets offer styling too.

    So there are many options. But it all depends on what you do
    when you "customize" them and what was lacking with Qt Quick for you.

  • I don't think i will use delegates. I am trying to make a simple application and to customize same buttons, labels, tabs. I want something more then just change the background color and border. i have search on the internet after same example i didn't find nothing useful.
    For example i would like to make a tab and same buttons like here : link text

  • Lifetime Qt Champion

    Ok, well yes I guess using plain QML is the fastest way.

    QWidgets and stylesheets does go a long way though
    ![alt text](0_1480668376916_upload-a063862e-9e6c-49f3-bbc8-7cec8a193ebf image url)

Log in to reply