First of all, the code you posted is very weird.
Why do you code the implementation in the header? Are you coming from a C# world?

Quote Originally Posted by csernai.csaba View Post
The problem is when i expand the first top level item, it's crashes.
I copied your code and tried it for myself. It doesn't crash for me.
Post the error you get please.

May i use QTreeWidget improperly?
The use of ui is a little bit strange to me.
And you should include QTreeWidgetItem