0
votes

I want create a Table based on QGridLayout that consist my custom widgets with different amount of columns in each row, for example: http://urls.by/tbl

How i can do it?

When i change widgets width in first row, another rows also change width.

1
You can find your solution by this google query: google.com/search?q=column+span+in+grid+layout+qt - Donotalo
Yes. I knew about span property. But when i spanning second cell in first row, next cells don't shift to right. For example: u.to/QHpDBA How I can shift next cells? - Дмитрий Дмитрийq
please show some code that doesn't work as expected. - Donotalo

1 Answers

0
votes

The format of adding a widget or layout to your QGridLayout is as follows:

myGridLayout->addWidget( QWidget*, row, column, rowspan, columnspan );
myGridLayout->addLayout( QLayout*, row, column, rowspan, columnspan );

You can put your rowspan and columnspan as required by you. For example, if you want the widget to span 4 columns, you just need to put 4 in the required field.

EDIT: Ofcourse there are other optional fields for alignment etc but I haven't mentioned those in the above format.

EDIT 2: So what I understand is that you want to be able to insert or magnify cells in any row and the rest of the cells should shift accordingly.

In that case I think a QHBoxLayout for each row would be more suitable. You can then align these QHBoxLayouts in a single QVBoxLayout