Reputation: 7845
MigLayout is my layout manager of choice (In Java), and I can't find similar functionality in Qt (Tutorials in PyQt only consider QBoxLayout and QGridLayout). From the Qt list of layout managers, is there something similar to Mig?
Example from the guide (Java):
panel.add(comp1)
panel.add(comp2, "span 2") // The component will span two cells.
panel.add(comp3, "wrap") // Wrap to next row
panel.add(comp4, "span")
I love how it's possible to expand an individual cell, instead of spacing them equally within a "grid". It allows you to build really complex UIs.
Upvotes: 0
Views: 123
Reputation: 2444
QGridLayout does this. The addItem
method has rowSpan
and columnSpan
parameters that allows the cell you're creating to span across, down, or both. It's very easy and works great.
ADDITION:
For inserting a widget, use addWidget. Note that there are two versions, and one of them allows for column and row spanning.
Upvotes: 1