Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved QGridLayout Multiple Columns, Ignore Widget height in same row

    General and Desktop
    3
    3
    112
    Loading More Posts
    • 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.
    • Emrecp
      Emrecp last edited by Emrecp

      Hello,
      I have QGridLayout. Adding widgets to left side and right side.
      But When i increase (clicking) widget height, the beside widget's size too increasing so widget going to downside. I don't want this.
      And I don't want use 2widgets for left side and right side. Thanks.

      1.png

      2.png

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

        AFAIK, you can't do what you want directly.

        One possible way would be to have your widgets acts like popup if that make sense or use a combination of horizontal and vertical layouts.

        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 Reply Quote 2
        • Chris Kawa
          Chris Kawa Moderators last edited by

          If you want to stick with QGridLayout (which is not well suited for this), when you click an item you could take it out of the layout and insert back with a vertical span set to number of items you would like to have on the left. This would also mean you'd have to take all the widgets below it out of the layout and put them back lower. Could work but seems silly if you have a lot of items to move around.

          The obvious choice though seems to be to have two vertical layouts side by side. You don't need extra widget for that, just nested layouts.

          1 Reply Last reply Reply Quote 2
          • First post
            Last post