[Kde-bindings] Response to "Anyone interested in helping me get KAction and KXMLGUI working?"

Richard Dale rdale at foton.es
Thu Jun 12 10:06:43 UTC 2008


On Thursday 12 June 2008 09:36:43 Gary Greene wrote:
> On Tuesday 10 June 2008 08:44:00 pm Gary Greene wrote:
> > On Tuesday 10 June 2008 02:25:53 am Richard Dale wrote:
> > > On Tuesday 10 June 2008 07:21:32 Gary Greene wrote:
> > > > Note, this is for KDE3:
> > > > After doing some work investigating the cause of KAction and KXMLGUI
> > > > working, I think I've hit on why it doesn't seem to work. As an
> > > > expermiment I tried intraspecting the actionCollection stored by
> > > > KMainWindow to see if it was unable to hold KActions or if it was
> > > > unable to return anything to the KXMLGUIClient provided by
> > > > KMainWindow.
> > > >
> > > > It seems that the main problem is that PerlKDE doesn't implement
> > > > binding KActionPtrList based off the output from the actions method
> > > > in KActionCollection. The code that exhibits this is attached.
> > >
> > > I looked at the PerlQt 3.008 sources and it looks like you just need to
> > > add a macro call to the kde marshalling handlers, something like this:
> > >
> > > MARSHALL_QPTRLIST( KActionPtrList , KActionPtrList , KAction, "
> > > KDE::Action", FALSE )
> > >
> > > -- Richard
> >
> > After adding the attached patch, I get the following error during
> > compilation time of PerlQt:
> >
> > g++ -c  -I/opt/kde3/include -I/usr/include
> > -I/srv/foremand/RPM/BUILD/PerlQt-3.009/PerlKDE
> > -I/srv/foremand/RPM/BUILD/PerlQt-3.009/smoke
> > -I/srv/foremand/RPM/BUILD/PerlQt-3.009/PerlQt -D_REENTRANT -D_GNU_SOURCE
> > -DTHREADS_HAVE_PIDS -DPERL_DISABLE_PMC -fno-strict-aliasing -pipe
> > -Wdeclaration-after-statement -I/usr/local/include -I/opt/local/include
> > -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -pipe
> > -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fomit-frame-pointer -march=i586
> > -mtune=pentiumpro -fasynchronous-unwind-tables   -DVERSION=\"3.009\"
> > -DXS_VERSION=\"3.009\" -fPIC
> > "-I/usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE"  -Wnon-virtual-dtor
> > -Wno-long-long -Wundef -W -Wpointer-arith -O2 -O2 -g -pipe
> > -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4
> > -fexceptions -fomit-frame-pointer -march=i586 -mtune=generic
> > -fasynchronous-unwind-tables -fno-exceptions -fno-check-new -fno-common
> > kde_handlers.cpp
> > cc1plus: warning: command line option "-Wdeclaration-after-statement" is
> > valid for C/ObjC but not for C++
> > /srv/foremand/RPM/BUILD/PerlQt-3.009/PerlQt/handlers.cpp:193: warning:
> > missing initializer for member 'mgvtbl::svt_copy'
> > /srv/foremand/RPM/BUILD/PerlQt-3.009/PerlQt/handlers.cpp:193: warning:
> > missing initializer for member 'mgvtbl::svt_dup'
> > kde_handlers.cpp: In function 'void marshall_KCmdLineOptions(Marshall*)':
> > kde_handlers.cpp:118: warning: comparison between signed and unsigned
> > integer expressions
> > kde_handlers.cpp: In function 'void marshall_KActionPtrList(Marshall*)':
> > kde_handlers.cpp:189: error: 'class QValueList<KAction*>' has no member
> > named 'next'
> > kde_handlers.cpp:189: error: 'class QValueList<KAction*>' has no member
> > named 'next'
> > /opt/kde3/include/qptrlist.h: In member function 'void
> > QPtrList<type>::deleteItem(void*) [with type = KConfigBackEnd]':
> > kde_handlers.cpp:210:   instantiated from here
> > /opt/kde3/include/qptrlist.h:150: warning: possible problem detected in
> > invocation of delete operator:
> > /opt/kde3/include/qptrlist.h:150: warning: invalid use of undefined
> > type 'struct KConfigBackEnd'
> > /opt/kde3/include/kconfigbase.h:38: warning: forward declaration of
> > 'struct KConfigBackEnd'
> > /opt/kde3/include/qptrlist.h:150: note: neither the destructor nor the
> > class-specific operator delete will be called, even if they are declared
> > when the class is defined.
> > make[2]: *** [kde_handlers.o] Error 1
> > make[2]: Leaving directory `/srv/foremand/RPM/BUILD/PerlQt-3.009/PerlKDE'
> > make[1]: *** [all-recursive] Error 1
> > make[1]: Leaving directory `/srv/foremand/RPM/BUILD/PerlQt-3.009'
> > make: *** [all] Error 2
> >
> > I've checked the header for QPtrList, and it does define a *next() member
> > at line 111 of qptrlist.h from Qt 3.3.8 with the following declaration:
> >
> >     type *next()            { return (type *)QGList::next(); }
> >
> > Ideas are welcome.
>
> After studying Korundum, it seems I'll need a custom marshalling shim in
> kde_handlers.cpp. So, to fix this, I'm blatantly borrowing the shim from
> korundum (with appropriate changes, of course to deal with Perl's XS
> system).
Yes, please do. The KDE3 version of QtRuby/Korundum should have a marshaller 
for value lists that you can adapt. Or you can copy the MARSHALL_QPTRLIST 
code in PerlQt to MARSHALL_QVALUELIST and adapt it to work with value lists.

-- Richard


-- Richard




More information about the Kde-bindings mailing list