Search code examples
qtqlabelqgridlayout

Qgridlayout rowspan with qlabel text over several columns


I would like to achieve the following structure

--------------------
|text text| BUTTON |
|text text----------       
|text text text text| 
|text text text text|
---------------------

Where all that text is contained in a QLabel. I was trying to achieve this through the use of the rowspan property of a QGridLayout

QGridLayout *title_layout = new QGridLayout;
title_layout->addWidget(title_label, 0,0,3,1);
title_layout->addWidget(star_button,0,1,1,1,Qt::AlignRight);

in which i stated that the button could only occupy one row, but the label can occupy 3. The problem is that the text is anyway presented like this:

--------------------
|text text| BUTTON |
|text text|        |
|text text|        | 
|text text|        |
---------------------

Is there any way to achieve the first layout?


Solution

  • It is not possible, widgets can have a rectangular structure within a layout.