Thanks, very nice patch! Works nicely for me :-) The only minor thing that I noticed when I went through the code is that it might not be obvious what the return value of the function int createItemStatesList(QMap<QString, QVector<ItemState> >& itemStates, const int firstIndex = 0, const int currentExpansionLevel = 0); is, and what its parameters mean. Moreover, the parameter "currentExpansionLevel" seems redundant to me because it's always equal to m_model->expandedParentsCount(firstIndex), right? One could calculate it inside the function by adding const int currentExpansionLevel = m_model->expandedParentsCount(firstIndex); inside the function. It means that expandedParentsCount(int) will be called once more for that index, but it makes the header file easier to read, which I find slightly preferable. It's probably a matter of taste though, so feel free to decide yourself what you think is better. But a comment in the header file that says what the function does, and that its return value is the number of items that have been processed won't hurt. What do you think?