[Qt-interest] Mouse double click.

Alexandre Beraud aberaud at infflux.com
Thu Feb 19 11:20:16 CET 2009


Hi again,

In this case, install an event filter for your treeview that redirects 
the events to a function of MyTreeViewImpl. Take a look at this link 
(provided that you use Qt 4):
http://doc.trolltech.com/4.3/qobject.html#installEventFilter
You can get the position of the double click from the QEvent and then 
get the QModelIndex from the indexAt() function of the treeview.
I hope that this is what you're looking for.

Regards,

Alex


Shabd Swarup V a écrit :
> Thanks for the response. I think the problem is slightly different.
>
> I am not deriving from the QTreeView class but actually I am writing a class that will do some operations on a particular QTreeView object.
>
> For example, this is one of the methods in my class:
>
> void MyTreeViewImpl::clickRow(QTreeView* targetObject, int row)
> {
>         QAbstractItemModel* model = targetObject->model();
>         QModelIndex index = QModelIndex();
>         
>         index = model->index(row,0);
>
>         targetObject->setCurrentIndex(index);
> }
>
> I need to write another method for double clicking on a particular row/index.
>
> Please suggest.
>
> Thanks,
> Shabd
>
>   


-- 
BERAUD Alexandre
Ingénieur Développement

Infflux - Informatique & Flux
Tel: 01 49 57 92 00 - Fax : 01 49 57 92 01
Mail: aberaud at infflux.com
Visitez notre site :  www.infflux.com





More information about the Qt-interest-old mailing list