DevHeads.net

QComboBox vs KConfigDialogManager

Hey all, I wanted to document the source of a bug I just found the cause of
and get some input on possible fixes.

The bug I noticed was that using qt 4.8 konversation stopped showing
timestamps in the chat window. After discussing with Eike I realized the
TimestampFormat in my konversationrc was getting saved by KConfigXT as the
Combobox currentIndex (0, 1, or 2) instead of the currentText ("hh:mm",
etc.) So I spent some time debugging in KCoreConfigSkeleton and
KConfigDialogManager and found that KConfigDialogManager::property gets the
property to save by using the following algorithm.

1) Check if the widget has a kcfg_property is set on the widget. If so, use
that property's value as the property to record.
2) Check if the widget has a User property to save (This was not set in
QComboBox in 4.7 but is set in 4.8 to the currentIndex property)
3) Try casting to a combobox and use the current text if the combobox is
editable, otherwise use the currentIndex

Anyone here can guess where the problem lies? So the question is should the
USER property in QComboBox be currentIndex, and if so should we:
a) change all our .ui files KComboBox, QComboBox widgets to have
kcfg_property set if we want to save the currentText as the value of the
config item.
b) change the algorithm in KConfigDialogManager somehow to do the right
thing.

thoughts, opinions, etc. all welcome

Jeremy

Comments

Re: QComboBox vs KConfigDialogManager

By Aaron J. Seigo at 06/01/2011 - 01:13

On Tuesday, May 31, 2011 21:55:59 Jeremy Whiting wrote:
erf!

this doesn't sound like a great solution since it means not only a lot of work
and testing in our own repos (with a high risk of missing something), but it
will affect all third parties as well (which we can't guarantee will notice or
provide a fix on their own). a fix, even if it is a (well documented with
comments ;) work-around, in KConfigDialogManager would probably be more
valuable as a result.

Re: QComboBox vs KConfigDialogManager

By Jeremy Paul Whiting at 06/01/2011 - 15:31

Indeed, I posted that more as an absurd solution than one I would recommend.

I just uploaded a diff to reviewboard that fixes the problem here. Let me
know if it's ok to ship.

Jeremy