Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. When to use .qml and when to use .ui.qml ?
Forum Updated to NodeBB v4.3 + New Features

When to use .qml and when to use .ui.qml ?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 3 Posters 1.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Alan B
    wrote on last edited by
    #1

    Hi

    I'm new to Qt Quick/QML and struggling to understand when I should be using a straight QML file and when to use the Qt Quick UI File option.

    I've watched various videos and some developers seem to use a UI File when developing a reusable component and others use a plain .qml when adding a form/view.

    These almost seem interchangeable, in fact the UI File option just seems to append 'Form' to the name and use the .qml file almost like a header.

    Are there any advantages/disadvantages of using either in certain situations (e.g. creating a reusable component or adding a form/page to an app) ?

    Also, is there a 'best practice' to help decide which to use ?

    Thanks in advance

    Alan

    J.HilkJ 1 Reply Last reply
    0
    • fcarneyF Offline
      fcarneyF Offline
      fcarney
      wrote on last edited by fcarney
      #2

      They can be used identically. The .ui. in the name just affects how Qt Creator will treat the file. It opens .ui. files in the designer instead of the text editor by default. At least that is how I understand them.

      Edit:
      As for "best practices" I am not sure what that would be.

      C++ is a perfectly valid school of magic.

      1 Reply Last reply
      0
      • A Alan B

        Hi

        I'm new to Qt Quick/QML and struggling to understand when I should be using a straight QML file and when to use the Qt Quick UI File option.

        I've watched various videos and some developers seem to use a UI File when developing a reusable component and others use a plain .qml when adding a form/view.

        These almost seem interchangeable, in fact the UI File option just seems to append 'Form' to the name and use the .qml file almost like a header.

        Are there any advantages/disadvantages of using either in certain situations (e.g. creating a reusable component or adding a form/page to an app) ?

        Also, is there a 'best practice' to help decide which to use ?

        Thanks in advance

        Alan

        J.HilkJ Offline
        J.HilkJ Offline
        J.Hilk
        Moderators
        wrote on last edited by
        #3

        @Alan-B
        In the end it's totally up to you, use what gives you the most overview, or that what you have the most mastery over.

        I personally have, in my 3 years of active QML usage never used a single .ui.qml file nor a single Qt Quick Layout

        anchors and x/y bindings for life 🤘


        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


        Q: What's that?
        A: It's blue light.
        Q: What does it do?
        A: It turns blue.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved