[Qt-interest] How to differentiate itemClicked() and itemDoubleClicked() signals

Georg Grabler ggrabler at gmail.com
Tue Jul 7 16:29:57 CEST 2009


Hi,

Well, a doubleclick are two clicks, that's why the signal is emitted twice.

I just see two possibilities:
1.) Use another signal than itemClicked() (like currentItemChanged() or
currentRowChanged()) if it's possible , so you only get one signal instead
of two itemClicked() (i don't know which behaviour you want to reach).

2.) Use a QTimer() to time the itemClicked(). This adds a delay though, and
is an ugly hack.

I can't see any other possibility, since usually in a treeview itemClicked()
is thought for selection, and itemDoubleClicked() includes selection +
another task. I think it works as it was intended to do.

I basically see no way of having two completely different actions on click
and doubleclick (and I can't think on a scenario where i would like
itemClicked() to do nothing if itemDoubleClicked() is emitted.

Maybe a little bit more detailed description would help, about the behaviour
you want by your itemClicked and itemDoubleClicked methods.

Kind regards,
Georg

On Tue, Jul 7, 2009 at 3:14 PM, Santhosh Y <santhosh at softjin.com> wrote:

> Hi,
>
> I implemented a custom treewidget and connected the itemClicked() and
> itemDoubleClicked() to some slots in it.
>
> When an item is double clicked  i have observed that, itemClicked()
> signal is also being emitted.
>
> I want to differentiate between a single and double click  signals
> correctly.
>
> Please suggest me how to do this.
>
> --
> ----------------------------------------------------
> Y Santhosh Kumar
> Senior Software Engineer
> SoftJin Technologies Private Limited
> Unit No. 102, Mobius Tower,
> I Floor, SJR I - Park,
> EPIP, White Field,
> Bangalore - 560066, India
> U : www.softjin.com
> E : santhosh at softjin.com
> T : +91-80-41779999
> M : +91-9740535265
> ----------------------------------------------------
>
>
>
> Business Disclaimer
> ____________________________________________________________
> This e-mail message and any files transmitted with it are intended solely
> for  the use  of the  individual or entity  to which they  are  addressed.
> It
> may  contain confidential,  proprietary or legally  privileged
>  information.
> If  you  are  not  the  intended recipient please be advised that you have
> received  this  message in error and any use is strictly prohibited. Please
> immediately  delete it  and all copies of it from your system, destroy any
> hard  copies  of  it and  notify  the  sender  by return mail. You must
> not,
> directly or indirectly, use,  disclose,  distribute, print, or copy any
> part of
> this message if you are not the intended recipient.
> ___________________________________________________________
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090707/a71c0553/attachment.html 


More information about the Qt-interest-old mailing list