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. Recommended way to implement properties window in QML
Forum Updated to NodeBB v4.3 + New Features

Recommended way to implement properties window in QML

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 2 Posters 1.7k Views 1 Watching
  • 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.
  • X Offline
    X Offline
    Xetick
    wrote on last edited by
    #1

    What is the recommended/good way to implement a properties window like the one in visual studio and Qt creator. My goal is to convert a winforms based editor into qml and currently I'm looking at how to best rebuild this
    !http://www.plane9.com/content/wiki/portswin.png(property window)!
    So each line on the screenshot is a dynamic control based and the whole window will change based on the node selected in the program.

    1 Reply Last reply
    0
    • jeremy_kJ Offline
      jeremy_kJ Offline
      jeremy_k
      wrote on last edited by
      #2

      That looks like a TableView with the left column holding the property name, and the right a type-dependent editor.

      Asking a question about code? http://eel.is/iso-c++/testcase/

      1 Reply Last reply
      0
      • X Offline
        X Offline
        Xetick
        wrote on last edited by
        #3

        How do you handle the runtime created editor in the best way? The ideal system would be that you have a c++ model that is basically a list of objects. Each object has a name and a type. Then depending on the type of object can also contain other data like a value for a int or a bool for a checkbox.
        You feed that to a control and it would create all rows as shown above and also create a matching editor based on the type.
        This is the part that I wonder what a good way is. How can I let QML create the controls dynamically based on the model and also allow the created controls to update the model objects as the user changes the data (That is clicks the checkbox, enters a new value, ...)

        1 Reply Last reply
        0
        • jeremy_kJ Offline
          jeremy_kJ Offline
          jeremy_k
          wrote on last edited by
          #4

          I would use a Loader in the delegate, setting the source or sourceComponent property to select the correct editor based on the the model element's type property.

          Another option is to include all possible editors directly in the delegate, and hide all but the correct editor depending on the type.

          Asking a question about code? http://eel.is/iso-c++/testcase/

          1 Reply Last reply
          0
          • X Offline
            X Offline
            Xetick
            wrote on last edited by
            #5

            After some digging those are the two recommended ways I have found as well. Even though the hiding option apparently performs quite bad when you start to add more controls to the property window. So the loader seems to be the way to go.

            I did look into the QtCreator source they however seem to build up the control from text strings that are the individual components. Then they send the completed test to the Qml engine to build up all controls. Probably the most efficient way but it certainly doesn't seem to be simple or easy to maintain.

            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