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. Dynamic z-ordering of items
Qt 6.11 is out! See what's new in the release blog

Dynamic z-ordering of items

Scheduled Pinned Locked Moved QML and Qt Quick
11 Posts 4 Posters 6.3k 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.
  • T Offline
    T Offline
    trollixx
    wrote on last edited by
    #1

    Hi everyone.

    I am currently working on DropDown/ComboBox-like component and got stuck with z-ordering.
    My drop down opens to up and down and I need it to overlay other components in this state. And in case two drop downs are nearby (vertically), they have to overlay each other on opening.

    How to make my two or more components to overflow each other?

    Thanks in advance.

    Oleg

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tucnak
      wrote on last edited by
      #2

      Hi, ~trollixx!

      Why can't you use z-index objects' property? It's works perfectly in QML and it's well described in Qt Assistant.

      1 Reply Last reply
      0
      • T Offline
        T Offline
        trollixx
        wrote on last edited by
        #3

        Hi, tucnak!

        Thanks, that works pretty well when both items are in the same parent item.
        But it does nothing when dropdowns are palced into different parent items, e.g.:
        @
        Column {
        Item {
        Text {...}
        DropDown {...}
        }
        Item {
        Text {...}
        DropDown {...}
        }
        }
        @

        Any ideas?

        Oleg

        1 Reply Last reply
        0
        • T Offline
          T Offline
          tucnak
          wrote on last edited by
          #4

          [quote author="trollixx" date="1352742212"]Hi, tucnak!

          Thanks, that works pretty well when both items are in the same parent item.
          But it does nothing when dropdowns are palced into different parent items, e.g.:
          @
          Column {
          Item {
          Text {...}
          DropDown {...}
          }
          Item {
          Text {...}
          DropDown {...}
          }
          }
          @

          Any ideas?[/quote]

          Try to set z-index in this way: 1000+<global-level>*100+<local-level>. z-index should be global on the whole page.

          1 Reply Last reply
          0
          • T Offline
            T Offline
            trollixx
            wrote on last edited by
            #5

            [quote author="tucnak" date="1352742388"]
            Try to set z-index in this way: 1000+<global-level>*100+<local-level>. z-index should be global on the whole page.[/quote]

            Unfortunately, this does not work.

            Oleg

            1 Reply Last reply
            0
            • A Offline
              A Offline
              aabc
              wrote on last edited by
              #6

              The Z order is just like the X and Y properties - its relative to the element parent.

              1 Reply Last reply
              0
              • T Offline
                T Offline
                trollixx
                wrote on last edited by
                #7

                [quote author="aabc" date="1353330415"]The Z order is just like the X and Y properties - its relative to the element parent.[/quote]

                I understand, but reparenting all widget components doesn't look like a proper solution for my problem.

                Oleg

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  aabc
                  wrote on last edited by
                  #8

                  I agree with you.

                  1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    dmcr
                    wrote on last edited by
                    #9

                    If the two parents items are in the same z level and are not overlay each other, (which is the case till there are placed in a Column element), isnt'it possible to give the z-index to the item instead of the dropdown?

                    dmcr

                    1 Reply Last reply
                    0
                    • T Offline
                      T Offline
                      trollixx
                      wrote on last edited by
                      #10

                      [quote author="dmcr" date="1353333695"]If the two parents items are in the same z level and are not overlay each other, (which is the case till there are placed in a Column element), isnt'it possible to give the z-index to the item instead of the dropdown?[/quote]

                      A component should be universal and be easily integrated in any layout. So, your suggestion sounds like a workaround or hack but not a good solution :(

                      Oleg

                      1 Reply Last reply
                      0
                      • D Offline
                        D Offline
                        dmcr
                        wrote on last edited by
                        #11

                        I've asked a question....
                        For me your component has to be the whole Column or at least the Item (then it would be simple).
                        If not, then you had to implement some javascript to do the job.
                        And/Or....
                        Your dropdown has not to include the z-order, and then the component is still done with "correct style" :)

                        dmcr

                        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