comboboxes - sorted lists in KDE4 - idea
Matthew Woehlke
mw_triad at users.sourceforge.net
Tue Mar 20 20:11:40 GMT 2007
Matthew Woehlke wrote:
> Ferdinand Gassauer wrote:
>> We introduced one (or more) group levels - separated by
>> "----------------" (like in help)
>> and a "sort number" for each item.
>>
>> the necessary attributes for every item are
>> * group * sort
>> * item text
>>
>> a list is always sorted by group, sort, item text.
>> [snip]
>
> I, for one, think that *having* this is an excellent idea (I won't take
> a stance on whether or not apps should be required to use it, but having
> it *available* would be awesome).
>
> I think Ferdinand has the right idea. 'group' and 'sort' (I would call
> it 'key') should be *non-negative* numbers. Here's why:
>
> const SORT_REUSE = -1;
> const SORT_INC = -2;
> const SORT_GROUP = -3;
>
> ...'reuse' would use the same value that was previously used (i.e. when
> adding items one after another), 'inc' would automatically use the next
> value. 'group' would specify that the item is not a key but the name of
> a group. This way you would have a list that looks like:
>
> -- US sizes
> Letter
> Legal
> -- Metric sizes
> A0
> ...
> A4
>
> ...where the group names are actually displayed (and can be translated,
> of course), and made distinct by being a different color or through some
> other means, and also are not selectable.
>
> So the (pseudo)code to generate the above would look like:
>
> addItem("US sizes", SORT_GROUP, 1);
> addItem("Letter")
> addItem("Legal")
> addItem("Metric sizes", SORT_GROUP, 2);
> addItem("A0");
> ...
> addItem("A4");
>
>
> ...where 'addItem' is:
> <type> addItem(QString name,
> int key = SORT_REUSE,
> int group = SORT_REUSE)
>
> (Note that 'reuse' and 'inc' use 0 for the key after SORT_GROUP.)
>
> You could of course specify a simple separator with e.g. "-" instead of
> needing to provide a group name.
>
> And with this, lists would of course always be sorted. :-) We could even
> fight over the default for 'key' being SORT_INC instead of SORT_REUSE to
> make the 'least typing' behavior more like the current unsorted
> behavior, although I think I would argue against it.
...any word on this making KDE4? Opinions, even? I was thinking about
filing a RFE on bko.
--
Matthew
"What a wonderful smell you've discovered!" -- Princess Leia Organa
More information about the kde-core-devel
mailing list