Two API suggestions before freeze

Matthew Woehlke mw_triad at users.sourceforge.net
Fri Apr 27 20:17:37 BST 2007


Mathias Soeken wrote:
> 2. A KCategoryComboBox (could eventually be merged with KComboBox)
> 
> Has a method addCategoryItem( QString ) to add a separator with text.
> Proof of concept: 
> http://websvn.kde.org/trunk/playground/pim/recipientspicker/categorycombobox

There are certainly *potential* uses for that... I'm interested, and 
will probably try to take a look, but I don't maintain any apps so I 
can't speak to including it currently in kdelibs (but I would keep it 
around, it is still useful even if it doesn't make libs in 4.0).

Did you see this thread?

Subject: "comboboxes - sorted lists in KDE4 - idea"
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.

-- 
Matthew
"Request to turn back time / And rectify my wrongs..."
   -- from "Title of the Song", DaVinci's Notebook





More information about the kde-core-devel mailing list