[Qt-interest] signal and slot in QTreeView

Arnold Krille arnold at arnoldarts.de
Thu Dec 4 19:37:52 CET 2008


Hi,

On Thursday 04 December 2008 19:17:31 ami guru wrote:
> I have some item arranged in a tree view and i m trying to implement the
> signal and slot
> mechanism for that.
> Clicked() signal is inherited from the abstractitemview class but i cannot
> make that functional
> *******************************
> Object::connect: No such signal QTreeView::clicked()
> Object::connect:  (receiver name: 'MainWindow')
> *********************************

As Qt tells you, there is no clicked() signal in QTreeView or any of its 
inherited classes. And what would you know from that signal? Only that the 
user clicked somewhere in the widget? How useless.
You are probably searching for QAbstractItemView::clicked( const QModelIndex& 
) or for QAbstractItemView::activated( const QModelIndex& )... These two have 
the advantage that they already give you the item that was clicked on, so you 
don't have to determine that yourself.

Have fun,

Arnold



More information about the Qt-interest-old mailing list