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. Merging Elements in Grid possible?
Forum Updated to NodeBB v4.3 + New Features

Merging Elements in Grid possible?

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

    Hello,

    I am setting up a List of Values, each with an Icon and some Text showing. For Layouting I use Grid in QML with three columns and it looks really nice so far.

    But now I am at a point where I would need an Icon exactly three times as wide as a normal Icon so I was searching for a way to merge the three cells in that row to a single one. I tried to increase the Size of the single Item but this rearranges the other Icons as well.

    Since the Documentation on Grid QML (http://doc.qt.io/qt-5/qml-qtquick-grid.html) don't mention anything I wonder if there is a way to force the single Item to use a whole row alone.

    Thanks in Advance

    1 Reply Last reply
    0
    • AndySA Offline
      AndySA Offline
      AndyS
      Moderators
      wrote on last edited by
      #2

      @Throndar I am afraid it is not possible with Grid. You might want to look at GridLayout as this allows for spanning, so maybe you can use that instead. See http://doc.qt.io/qt-5/qml-qtquick-layouts-gridlayout.html

      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      3
      • J.HilkJ Offline
        J.HilkJ Offline
        J.Hilk
        Moderators
        wrote on last edited by
        #3

        An other option, additional to what @AndyS wrote, would be using GridView.

        By what you wrote, all Items, that are to be displayed, follow the same pattern, Icon & Text. Therefore a GridView with a delegate could be a valid option.
        You can set the width and hight of each item individial. So setting the witdh * 3 times tmore han normal could be easily bound to some property.


        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
        3
        • T Offline
          T Offline
          Throndar
          wrote on last edited by Throndar
          #4

          @AndyS & @J.Hilk

          thank you very much.

          GridLayout seems to be a lot more usable for my existing Design than Grid.

          The GridView itself looks quite promising and I hoped I would have remembered this before building every single Container (each with two Text-Items, one Image, one MouseArea) from hand... but rather late than never ;) I think this definitely calls for a refactoring.

          Once again, thank you. This helped a lot.

          1 Reply Last reply
          1

          • Login

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