[vlc-devel] commit: qt4: selector: switch source on single click (Jakob Leben )

Jakob Leben jakob.leben at gmail.com
Mon Sep 7 09:56:26 CEST 2009


On Mon, Sep 7, 2009 at 8:53 AM, Jean-Baptiste Kempf <jb at videolan.org> wrote:

> > -    int i_type = item->data( 0, TYPE_ROLE ).toInt();
> > +    QVariant type = item->data( 0, TYPE_ROLE );
> > +    if( type == QVariant() ) return;
> > +
> > +    int i_type = type.toInt();
> Why is that necessary?
>

Because when reacting to single-clicks, the function will be called also for
the "Libraries"  item, and that one doesn't have the TYPE_ROLE set, so
item->data(0, TYPE_ROLE) will return QVariant(), and doing toInt() on
"empty" QVariant will return 0, which will be interpreted as PL_ITEM.
Instead, nothing should happen when clicking (or activating...) the
"Libraries" item, which is only a "directory", or a node, if you want...

Best regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20090907/a1e75fb5/attachment.html>


More information about the vlc-devel mailing list