Inconsistency in graphicsItems.GraphicsLayout.addItem?

13 views
Skip to first unread message

B Tonner

unread,
Nov 29, 2021, 12:26:15 PM11/29/21
to pyqt...@googlegroups.com
The GraphicsLayout.addItem method increments self.currentCol through
self.nextColumn() every time addItem is called, independent of whether
or not there is a 'col' value specified in the method call.

This leads to an inconsistency in the meaning of
GraphicsLayout.currentCol when items are added to specific rows and
columns. The GraphicsLayout.currentCol can exceed the underlying
GraphicsLayout.layout.columnCount() (which is the QGraphicsGridLayout
column count).

This mainly affects cases where an item is added without (row, col),
after one or more items are added using (row,col). It is probably
otherwise not visible. But it still doesn't "feel right".

It seems that the meaning of "currentRow" and "currentCol" is more
closely "maxRow" and "maxCol".

Perhaps a fix would be:

def addItem(self.......
.....
.....
#self.nextColumn()
self.currentCol = self.layout.columnCount()

Brian Tonner
Reply all
Reply to author
Forward
0 new messages