Important: Please read the Qt Code of Conduct -

QGridLayout Multiple Columns, Ignore Widget height in same row

  • 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.



  • Lifetime Qt Champion


    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.

  • Moderators

    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.

Log in to reply