[Interest] Where are the USER properties of Qt-provided QObjects documented?

K. Frank kfrank29.c at gmail.com
Thu Jun 28 21:32:50 CEST 2012


Hi Andreas!

On Thu, Jun 28, 2012 at 1:16 PM, Andreas Pakulat <apaku at gmx.de> wrote:
> Hi,
>
> Am Donnerstag, 28. Juni 2012 schrieb K. Frank :
>>
>> Hi Bo and André!
>>
>> It seems that the take-away is that which property is the USER
>> property isn't documented (in the standard documentation).
>
> I suggest to override setModelData and not rely on the user property, since
> Qt may change which property this is in minor releases. In fact the one for
> QComboBox did change already once in the Qt4 lifetime, I guess the reason
> for them not being documented is exactly this freedom to change them when
> necessary.

Yes, overriding setModelData is probably the way to proceed.  Better
safe than sorry, so to speak.

(For the record, in my case I did override setModelData because I
needed QComboBox::currentText for my data, rather than the (at least
for now in 4.8.0-rc1) USER property, namely QComboBox::currentIndex.)

Thanks for the historical note that the choice of USER property has
changed in practice (not just in theory), and for QComboBox, at that.

(At least let me gripe about the choice of name, here.  If the USER
property is to be understood as an internal implementation detail,
and not part of the public interface that client code can rely on,
then maybe we should call it the SECRET_PRIVATE_QT property,
rather than the USER property.  Hmm ...)

> Andreas

Thanks for these details.


K. Frank



More information about the Interest mailing list