[PyQt] Parent/Child widget clipping
Hans-Peter Jansen
hpj at urpla.net
Mon Jan 30 23:30:19 GMT 2012
On Tuesday 31 January 2012, 00:07:24 James Polk wrote:
> Greetings All,
>
> Doing some prototyping where I have a simple QTreeWidget with 3
> items. Each item has 3 simple children.
>
> Using QTreeWidget.setItemWidget()....I "set/insert" a simple
> QTableWidget into a child of one of the tree's parent items (first
> column)
>
>
> The problem is that the "child-table" width is wider than the
> "parent-tree"'s first column, so that parent-tree->column2 clips the
> child-table.
>
> This phenomena is pretty much identical to this example on
> stackoverflow (last pix)
>
>
> http://stackoverflow.com/questions/6133367/qtreewidget-with-multiple-
>columns-limits-number-of-child-items
>
> However, in that example, the problem is "solved" by manually (or
> could be automatic) resizing of the parent columns by simply pulling
> it wider,etc..
>
> But in my prototype, I need the entire "child-table" to display in
> it's entirety but I need the columns of the "parent-tree" to remain
> the same width.
>
> In other words, I need to override the default behaviour of having
> the tree define the child's display region.
Excuse me, but I still don't get, what you really want to archive.
If you want your table span the full tree widget width, try this after
setItemWidget:
self.LargeTable.setFirstItemColumnSpanned(self.LargeTable.topLevelItem(0).child(1),
True)
Pete
More information about the PyQt
mailing list