[Qt-interest] signal itemClicked and signal itemChanged of QTreeWidgetItem
e.jokisch at orange-moon.de
e.jokisch at orange-moon.de
Tue Mar 2 12:33:46 CET 2010
On Tuesday 02 March 2010 10:47:34 yanqzhi at gmail.com wrote:
> CProductTreeWidget::CProductTreeWidget(QWidget *parent)
>
> : QTreeWidget(parent)
>
> {
> ui.setupUi(this);
> mSelectedItem = NULL;
> connect( this, SIGNAL( itemClicked( QTreeWidgetItem*, int ) ),
> this, SLOT( itemSelect( QTreeWidgetItem*, int ) ) );
> connect( this, SIGNAL( itemChanged( QTreeWidgetItem*, int ) ),
> this, SLOT( updateCheckState( QTreeWidgetItem*, int ) ) );
> }
>
> When I click the checkbox of a QTreeWidgetItem of the CProductTreeWidget, I
> found that the slot updateCheckState will be excuted firstly and the slot
> itemSelect will be excuted secondly. But I want that the slot ItemSelect
> be excuted firstly.
>
> How can I do?
>
> Thanks a lot!
>
> Sincerely yours,
> Yan
>
> yanqzhi at gmail.com
> 2010-03-02
The order of the slots being called is random.
As it is never certain which slot will called first you have to maybe use a
different approach:
only connect only the slot itemSelect
>From inside the itenSelect slot do whatever you need to do. You may even
define an own SIGNAL, connect it to the updateCheckState() and emit that
SIGNAL from inside the itemSelect slot.
Hope this helps
Eckhard
More information about the Qt-interest-old
mailing list