I am using FlowLayout example of qt.
I added a context menu for all items in FlowLayout to enable renaming and removing. Renaming works, but whenever I call Remove, I receive a Segmentation Error.
Here is the removeSlot
call:
QAction *removeAction = new QAction(tr("Remove"), this);
connect(removeAction, SIGNAL(triggered()), this, SLOT(removeSlot()));
Menu->addAction(removeAction);
And emitting signal:
void FlowLayoutWidget::removeSlot()
{
emit removeMe(m_ownId);
}
FlowWindow.cpp catches the signal and executes the following code:
void FlowWindow::removeItemAt(int _index)
{
while(QLayoutItem* item = flowLayout->itemAt(_index))
{
QWidget* widget = item->widget();
flowLayout->removeWidget(widget);
delete widget;
break;
}
}
Whenever this function is called, I receive a segmentation error. How can I solve this?