[Kommander-devel] listbox setSelection patch

Silvan Calarco silvan.calarco at mambasoft.it
Thu Mar 27 10:07:31 EDT 2008


Hi Eric,
well looking at the code the setSelection and setCurrentItem call the same 
function (setCurrentItem):

    case DCOP::setSelection:
    {
      QListBoxItem* found = findItem(args[0], Qt::ExactMatch);
      if (found)
        setCurrentItem(index(found));
      break;
    }

    case DCOP::setCurrentItem:
    {
      int index = args[0].toInt();
      if (index < (int)count())
        setCurrentItem(index);
      break;
    }

The only difference is in the argument (the index versus the string). 
As the QT functions name suggests I thought it was more clear that:

setCurrentItem calls QT's setCurrentItem
setSelection calls QT's setSelected

Furthermore the setCurrentItem listbox function just moves the keyboard 
pointer to the item (the listed item is , but does not select it, so 
it's "partially" selected as reported in this old post:

http://mail.kdewebdev.org/pipermail/kommander/2006-September/001436.html
) so I think the current implementation is far as useful as the setSelected 
function and it's different from user expectations. 
Finally adding a "setSelected" function would be ok too, but I still would 
find incoherent the association betweek setSelection and setCurrentItem.
Thank you for your interest in this issue.

Cheers,
Silvan

Alle giovedì 27 marzo 2008, Eric Laffoon ha scritto:
> On Wednesday 26 March 2008 7:23:42 pm Silvan Calarco wrote:
> > Hi,
> > I had to create a listbox with preselected items and wasn't able to do it
> > with any recent release of kommander so I made the simple attached patch
> > that modifies the behaviour of setSelection. Maybe it makes sense to
> > merge it upstream.
> >
> > Cheers,
> > Silvan
>
> Interesting, but wouldn't it make a LOT more sense for an add uniqe item
> entry? I'm open to developer suggestions for adapting this into the KDE4
> version because it is a nice behavior, provided you're expecting it. I'm
> tending to think it needs it's own specific function.
>
> Thanks for the patch! I like seeing creative input. :)



-- 
mambaSoft
Via Barletta 90 - 10136 Torino
Tel: +39 011 5694078
E-mail: silvan.calarco at mambasoft.it
Web: http://www.mambasoft.it

openmamba GNU/Linux development @ http://www.openmamba.org


More information about the Kommander-devel mailing list