Why itemChanged of QStandardItemModel is invoked on all items on my model when creating the QStandardItemModel subclass
-
wrote on 3 Aug 2011, 08:47 last edited by
Hi i have model subclass m_model ( of QStandardItemModel ) it contains QStandardItem's that one of its column has setCheckable(true)
in the subclass in the constructor i have this single/slot wired:
@connect(m_model, SIGNAL(itemChanged(QStandardItem*)), this,
SLOT(tree_itemChanged(QStandardItem*))); @why each time i create the m_model and it happen only once it iterate all the items in my model with the tree_itemChanged method ?
i want it to be invoked only when i check/unchecked the check box. -
wrote on 3 Aug 2011, 09:37 last edited by
bq. why each time i create the m_model and it happen only once it iterate all the items in my model with the tree_itemChanged method ?
i want it to be invoked only when i check/unchecked the check box.If I 'm not wrong you have a QStandardItemModel that you use also for a tree?
What does your SLOT tree_itemChanged do?
You could use a condition to filter only the checked role.Can you elaborate a little more about the structure of your application? Do you use a proxymodel?
-
wrote on 3 Aug 2011, 10:07 last edited by
What do you do in the constructor of your subclassed model? And how and where do you populate it?
Additionally, you can set a breakpoint in you slot and look at the call stack from where the signal was triggered.
-
wrote on 3 Aug 2011, 10:23 last edited by
Hi
Eddy the tree_itemChanged checks if the check box checked or not and i do filter with if/else
Volker i did see the stack , its trigger from where i iniT the object with new operator -
wrote on 3 Aug 2011, 10:26 last edited by
So, what do you do in the constructor?
-
wrote on 3 Aug 2011, 10:52 last edited by
in my main app class i do
@TreeViewWindowContainer* pTreeViewWindowContainer= new TreeViewWindowContainer();@TreeViewWindowContainer is my QStandardItemModel subclass
-
wrote on 3 Aug 2011, 11:26 last edited by
No surprise in that.
How do you populate the model?
1/7