The only change I made is to appendChild function, it now looks like this:
void RosterItem::appendChild(RosterItem *item)
{
item->m_parent = this;
m_children.append(item);
}
void RosterItem::appendChild(RosterItem *item)
{
item->m_parent = this;
m_children.append(item);
}
To copy to clipboard, switch view to plain text mode
All the previous code is unchanged. I tried adding beginMoveRows but it caused a crash, I tried to use it like so:
beginMoveRows(oldGroup->index(), item->row(), item->row(), newGroup->index(), newGroup->rowCount());
oldGroup->removeChild(item);
newGroup->appendChild(item);
endMoveRows();
beginMoveRows(oldGroup->index(), item->row(), item->row(), newGroup->index(), newGroup->rowCount());
oldGroup->removeChild(item);
newGroup->appendChild(item);
endMoveRows();
To copy to clipboard, switch view to plain text mode
Maybe I should inherit QStandardItem or it's used for something else?
Bookmarks