http://www.perlmonks.org?node_id=78147

awwaiid has asked for the wisdom of the Perl Monks concerning the following question:

I've scoured the web and even emailed Ashley Winters (the author), but I've yet to discover if there is a current QT binding for perl. The qt on CPAN doesn't seem to work with QT 2.3.0 - or at least I haven't been able to get it to work.

Does anyone know of a current binding, or am I SOL unless I do it myself?

Replies are listed 'Best First'.
Re: QT 2.3.0 Bindings
by perlmonkey (Hermit) on May 05, 2001 at 04:02 UTC
    The QT binding on CPAN are for qt-1.44. The 2.x API has significant changes, so they old bindings wont work. I did some searching a while ago, and it seems we are both SOL. I read a few messages saying the original author was not responding to emails, and that nobody had taken ownership of perl Qt. I had grandiose plans to do it myself, but of course time always runs short. I know there are bindings for python, and I think even ruby, but no perl (that I have found).

      The bindings on CPAN claim to work for qt-2.0 - you have to change the Makefile.PL, but it appears to be a supported feature. I recently installed qt-2.3. Do you know if there are once again major changes, or if perhaps I just didn't compile QT for compatability?

      When compiling PerlQT for qt-2.0 it got really far in the compilation process, which made me hopefull.

        I just played with it again and got it working with my Qt-2.2.2, so I assume it will work with qt-2.3.0 also. To get it to work you have to uncomment out the $MAKE = 'Qt-2.0'; line in the Makefile.PL. Then it did not fully compile for me caused by some missing symbols from $QTDIR/include/qnamespace.h. My errors were:
        pig_Qt.c:355: `WState_FontFixed' is not a member of type `Qt' pig_Qt.c:356: `WState_FontSet' is not a member of type `Qt' pig_Qt.c:361: `WState_PaletteFixed' is not a member of type `Qt' pig_Qt.c:362: `WState_PaletteSet' is not a member of type `Qt' pig_Qt.c:366: `WState_USPositionX' is not a member of type `Qt' pig_Qt.c:368: `WState_Withdrawn' is not a member of type `Qt' pig_Qt.c:378: `WStyle_Reserved2' is not a member of type `Qt' pig_Qt.c:379: `WStyle_Reserved3' is not a member of type `Qt' gmake: *** [pig_Qt.o] Error 1
        To fix these I just had to go into pig_Qt.c and comment out the lines with the missing sybmols listed above. Afterthat, it finished the compile. I did the make install. Then I ran through every one of the tutorial programs in the tutorials-2.0 directory and they all worked perfectly.
        So, delightfully, I was wrong, the author apparently had it working for at least some version so qt-2.x and hopefully it should not take too much tweaking to get your version to work.
        Good luck.
Re: QT 2.3.0 Bindings
by dpatrick (Scribe) on May 22, 2001 at 01:30 UTC
    I am interested in finding out exactly what you did to get this to work as I am facing the same problem. Thanks, dpatrick

      Comment out all the lines with errors in the file pig_Qt.c. So, add "//" in front of line 355,356,361, etc.

Re: QT 2.3.0 Bindings
by httptech (Chaplain) on Nov 25, 2001 at 01:35 UTC
    I found this patch on Usenet that fixes the PerlQt-2.105 distribution to compile for Qt2. I had to also make some manual changes to Makefile.PL to point it to the correct libs/includes for Qt2, since I had both versions 1.44 and 2.2.1 installed.
    diff -uNr PerlQt-2.105/Makefile.PL PerlQt-patched/Makefile.PL --- PerlQt-2.105/Makefile.PL Tue Mar 7 05:58:24 2000 +++ PerlQt-patched/Makefile.PL Sun Aug 13 14:32:12 2000 @@ -23,10 +23,10 @@ $win32 = 1 if $OS =~ /Win/; -$MAKE = 'Qt-1.4'; +#$MAKE = 'Qt-1.4'; # If you want to compile using Qt-2.0, uncomment the next line -#$MAKE = 'Qt-2.0'; +$MAKE = 'Qt-2.0'; $ENV{QTDIR} = $win32 ? "C:\\Qt" : '/usr/lib/qt' unless $ENV{QTDIR}; diff -uNr PerlQt-2.105/Qt-2.0/Qt.pig PerlQt-patched/Qt-2.0/Qt.pig --- PerlQt-2.105/Qt-2.0/Qt.pig Tue Mar 7 01:28:43 2000 +++ PerlQt-patched/Qt-2.0/Qt.pig Tue Aug 15 21:28:15 2000 @@ -36,12 +36,6 @@ WState_AutoMask, WState_Polished, WState_DND, - WState_USPositionX, - WState_PaletteSet, - WState_PaletteFixed, - WState_FontSet, - WState_FontFixed, - WState_Withdrawn }; enum WidgetFlags { WType_TopLevel, @@ -62,8 +56,6 @@ WStyle_Tool, WStyle_StaysOnTop, WStyle_Dialog, - WStyle_Reserved2, - WStyle_Reserved3, WStyle_Mask, WDestructiveClose,

      Nice. Now we need someone to upgrade and maintain the package. Not-it!

      --Brock