KConfigDialogManager support for QButtonGroup does not work
Albert Astals Cid
aacid at kde.org
Sun Sep 21 22:48:16 BST 2008
A Dijous 18 Setembre 2008, Adeodato Simó va escriure:
> Hello,
>
> I'm finishing porting my application to KDE4, and I was getting trouble
> getting KConfigDialog + KConfigSkeleton to play nice with my QButtonGroup
> (it would work just fine in KDE3).
>
> I started reading kconfigdialogmanager.cpp, and it looked to me that
> QButtonGroup is supported: it is defined in s_changedMap, and special
> cased in several places.
>
> I asked Pino Toscano to take a look as well, and he immediately
> discovered that support for QButtonGroup is simply broken:
>
> <pinotree> QButtonGroup *bg = qobject_cast<QButtonGroup *>(w);
> <pinotree> w is a QWidget*, but QButtonGroup inherit QObject,
> so that qobject_cast won't ever success
The problem is not that cast is wrong, the problem is that
KConfigDialogManager tracks widgets. We could do two things:
* Drop support for QButtonGroup and tell people to use KButtonGroup
(groupbox+buttongroup), makes some sense as we expect people to name
KConfigDialogManager as kcfg_foo, that's easy when you design using Designer
if you have a widget, but is not as straight-fordware for QObjects that have
to be created in code.
* Try to support QButtonGroup, that means tracking QObjects and finding a way
to "find" the QButtonGroup. Tracking QObjects needs the API to change (bad)
and as QButtonGroup can have no parent, find it is not trivial either (bad)
So with my quick (maybe wrong) analysis i suggest us to drop support for
QButtonGroup in KConfigDialogManager
Albert
>
> He suggested I mailed here to bring up this issue. My application now
> uses KButtonGroup (which works like a charm), so as far as I'm concerned
> QButtonGroup support could get fixed, or dropped with a note in the
> documentation that a KButtonGroup should be used instead.
>
> Cheers,
>
> P.S.: Please CC me if you expect me to reply, I'm not subscribed.
More information about the kde-core-devel
mailing list