Widgets flowlayout example: Fix crash on startup
The flowlayout example crashes on startup because the last change removed a c-style cast which converted -1 to ~0U ... Fixes: QTBUG-78861 Change-Id: I0dbed4472b4f68a92b3f92763d00d28baa186f9a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
parent
74abe98320
commit
26d626436b
@ -62,7 +62,7 @@ FlowLayout::FlowLayout(QGraphicsLayoutItem *parent) : QGraphicsLayout(parent)
|
|||||||
void FlowLayout::insertItem(int index, QGraphicsLayoutItem *item)
|
void FlowLayout::insertItem(int index, QGraphicsLayoutItem *item)
|
||||||
{
|
{
|
||||||
item->setParentLayoutItem(this);
|
item->setParentLayoutItem(this);
|
||||||
if (index > m_items.count())
|
if (index > m_items.count() || index < 0)
|
||||||
index = m_items.count();
|
index = m_items.count();
|
||||||
m_items.insert(index, item);
|
m_items.insert(index, item);
|
||||||
invalidate();
|
invalidate();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user