You also need to store the widget using addChildWidget(). So the additional functions should look like the following:
void FlowLayout
::insertItem(int index,
QLayoutItem *item
) {
itemList.insert(index, item);
}
void FlowLayout
::insertWidget(int index,
QWidget *widget
) {
addChildWidget(widget);
insertItem(index, item);
}
void FlowLayout::insertItem(int index, QLayoutItem *item)
{
itemList.insert(index, item);
}
void FlowLayout::insertWidget(int index, QWidget *widget)
{
addChildWidget(widget);
QWidgetItem *item = new QWidgetItem(widget);
insertItem(index, item);
}
To copy to clipboard, switch view to plain text mode
P.S. this works for me.
Bookmarks