QStandardItem setCheckable(true) & catch any signal when the user click on the checkbox
-
wrote on 11 Oct 2012, 09:10 last edited by
Hello
In my QStrandardItemModel I add a column which all the QStandardItem have setCheckable(true).
When the user click on an checkbox in this column, an signal is emited ?I need an signal to connect with my slot
Best regards
Frédéric -
wrote on 11 Oct 2012, 09:28 last edited by
1, when setCheckable(true), the item can be checked by the user; otherwise, the user cannot check the item.
2, maybe you can try itemChanged as you signal.
3, also you can use QCheckBox::stateChanged ( int state )
void QCheckBox::stateChanged ( int state ) [signal]
This signal is emitted whenever the check box's state changes, i.e. whenever the user checks or unchecks it -
wrote on 11 Oct 2012, 09:30 last edited by
..
-
wrote on 11 Oct 2012, 09:37 last edited by
Helllo
I know 1)
I will try 2)
For 3) how do you know the name of the checkbox in order to connect with the slot ?Best Regards
Frédéric -
wrote on 11 Oct 2012, 10:44 last edited by
Perhaps you can use "QxtListWidget":http://libqxt.bitbucket.org/doc/0.6/qxtlistwidget.html instead? It provides a dedicated signal for this.
-
wrote on 11 Oct 2012, 12:35 last edited by
Other idea.
In the view have the
@void QAbstractItemView::clicked ( const QModelIndex & index ) [signal]@
In the model check the column you use for the checkbox from the argumentlist.
Call your slot as function and you have the same working, but with a small detour.
So it is more the view then the model that calls the slot you want when a item is clicked.
Hope this helps a bit.
greetz -
wrote on 11 Oct 2012, 13:47 last edited by
re
I'll will try first Jeroen idea.
And after Andre idea, but I don"t have Qxt in my program, and I don't want to add only for an componentBest regards
Frédéric -
wrote on 12 Oct 2012, 13:03 last edited by
Hello
The solution from Jeroen is perfect for my use.
Thanks a lot everybody
Best Regards
Frédéric
6/8