
Originally Posted by
high_flyer
Why do you do:
ExObject *parentItem = parentItem = ... // here is the 2nd breakpoint
ExObject *parentItem = parentItem = ... // here is the 2nd breakpoint
To copy to clipboard, switch view to plain text mode
?
Even though it is legal code, it suggests to me you are doing things wrong...
Try clean rebuilding, that would be the first easy thing to do.
Oh, I'm sorry, this line is a missprint, it is of course this:
ExObject *parentItem = getItem(mapToSource(parent));
ExObject *parentItem = getItem(mapToSource(parent));
To copy to clipboard, switch view to plain text mode
Tried to rebuild - no difference.
Added after 4 minutes:

Originally Posted by
wysota
What does getItem() do?
ExObject
*ExTreeProxy
::getItem(const QModelIndex &index
) const{
if (index.isValid()) {
ExObject *item = static_cast<ExObject*>(index.internalPointer());
if (item)
return item;
}
return (static_cast<ExTree
*>
(sourceModel
()))->getItem
(QModelIndex());
}
ExObject *ExTreeProxy::getItem(const QModelIndex &index) const
{
if (index.isValid()) {
ExObject *item = static_cast<ExObject*>(index.internalPointer());
if (item)
return item;
}
return (static_cast<ExTree*>(sourceModel()))->getItem(QModelIndex());
}
To copy to clipboard, switch view to plain text mode
ExObject here is a tree element. ExTree derived from QAbstractItemModel.

Originally Posted by
wysota
What does the implementation of insertRows() in the model look like?
Here is the complete insertRows():
bool ExTreeProxy
::insertRows(int position,
int rows,
const QModelIndex &parent
) {
ExObject *parentItem = getItem(mapToSource(parent));
bool success;
beginInsertRows(parent, position, position + rows - 1);
success = parentItem->insertChildren(position, rows, parentItem->columnCount());
endInsertRows();
if(success) emit layoutChanged();
return success;
}
bool ExTreeProxy::insertRows(int position, int rows, const QModelIndex &parent)
{
ExObject *parentItem = getItem(mapToSource(parent));
bool success;
beginInsertRows(parent, position, position + rows - 1);
success = parentItem->insertChildren(position, rows, parentItem->columnCount());
endInsertRows();
if(success) emit layoutChanged();
return success;
}
To copy to clipboard, switch view to plain text mode
Bookmarks