PDA

View Full Version : Layout with internal frames



Wasabi
9th November 2010, 18:57
I am trying to create a table of sorts within my application that displays various bits of information. However, I can't figure out how to make each "cell" have a frame around it using QLayout and its children.

I've been using QGridLayout and it works quite well to create the table itself, but it has no support (as far as I can tell) for frames enclosing all its children. I've thought of wrapping each child in a QFrame and then making the QFrames the children of QGridLayout, but that seems quite overly complex.

Is there some layout class with support for such things? I've looked into QGroupBox, but to my understanding it is a unidimensional layout (either horizontal or vertical) and is thus not practical to display a table.

Any hints?

wysota
10th November 2010, 01:06
Layouts are by definition invisible, they are space managers, not visual items. If you want a grid, you need to have something that draws it.

Wasabi
10th November 2010, 13:38
Of that much I am aware. My question thus becomes "what visual item can perform such a task?"

tbscope
10th November 2010, 13:49
You can probably create a custom layout class that draws borders.

Otherwise, I would do what you already suggested, put each item in a frame.

Or, use QTableView or similar.

Wasabi
10th November 2010, 14:20
Thanks for the hint. QTableView wasn't what I was looking for since I need to have some widgets in the middle of the table (QCheckBox'es and such), but I found QTableWidget on its documentation page, and it is almost perfect for my needs.

Many thanks!