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. QML Previous selector
Forum Updated to NodeBB v4.3 + New Features

QML Previous selector

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 3 Posters 1.1k 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.
  • S Offline
    S Offline
    Spez
    wrote on last edited by
    #1

    If you would like to.. let's say.. set a margin on the left side of an object, you would need to give every object a unique identifier and select objects using this identifier:

    @Rectangle { id: rect1; ... }
    Rectangle { id: rect2; anchors.left: rect1.right; anchors.leftMargin: 5; ... }@

    But actually it would be much more comfortable to have an automatic selector for this, just like the "parent" selector identifies the object's parent object, the "previous" selector should select the previously declared object, don't you think so? For example:

    @Rectangle { ... }
    Rectangle { anchors.left: previous.right; anchors.leftMargin: 5; ... }@

    This could indeed cause a problem if there's no previous object though...
    Can you somehow do this in QML?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      You're on the wrong channel to discuss such things. You should rather post this question on the interest mailing list. You'll find Qt's developers/maintainers (this forum is more user oriented) Don't forget to subscribe first

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Spez
        wrote on last edited by
        #3

        [quote author="SGaist" date="1403380452"]Hi and welcome to devnet,

        You're on the wrong channel to discuss such things.[/quote]

        I was asking myself whether it's possible in QML right now, isn't it?

        1 Reply Last reply
        0
        • JKSHJ Offline
          JKSHJ Offline
          JKSH
          Moderators
          wrote on last edited by
          #4

          Hi,

          Selecting the "previous" object not currently possible in QML.

          I'm not sure this feature makes sense however, because QML has a declarative structure and the order in which you declare your components should not matter.

          Anyway, it looks like what you need is a "layout manager":http://qt-project.org/doc/qt-5/qtquicklayouts-index.html

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          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