Perl Qt4
Development
Score 77%
Description:

Creating this library we aimed to use the Perl functionality
as much as possible, but to make the syntax similar to C++ Qt4.
This allows to use the original Qt4 documentation.
All the list classes (QVector,QList) are replaced by the Perl arrays.
All the associated arrays (QMap,QHash,QPair) are replaced by Perl hashes.
The classes of modules are completely coincide with the corresponding ones of C++ Qt4.
One can use all the protected functions from the object classes (QObject children)
except of those that use *Private classes as input parameter.

It's advisable to study the examples attached before writing programs.
I have checked the efficiency of Perl Qt4 on Qt4.3.3 (ASP12-i386 (base on Fedora7) ).

Arhive contain several examples of code.

For install need Qt4 headers.
Last changelog:

10 years ago

4.004
- add access to protected enums
- rewrite Makefile.PL
- fix bugs in QListWidget and with WId
- add examples/desktop/snapshot
- add modules into CPAN
4.000
- add access to protected function for object classes
- add call virtual function from C classes into perl
- fix bug with INOUT for static function

kokolamada

8 years ago

much PMs needed :(
is there any package that Makefile.pl depends on?
I searched and failed :(

Report

kokolamada

8 years ago

While installing QTcore source package, I met this error:

Can't locate ExtUtils/MakeMaker.pm in @INC (@INC contains: /usr/lib/perl5/5.10.0/i386-linux-thread-multi /usr/lib/perl5/5.10.0 /usr/local/lib/perl5/site_perl/5.10.0/i386-linux-thread-multi /usr/local/lib/perl5/site_perl/5.10.0 /usr/lib/perl5/vendor_perl/5.10.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.10.0 /usr/lib/perl5/vendor_perl /usr/local/lib/perl5/site_perl /usr/lib/perl5/site_perl .) at Makefile.PL line 2.
BEGIN failed--compilation aborted at Makefile.PL line 2.

Report

gothats

9 years ago

I was trying to get it to work with Qt 4.4.0, which apparently doesn't work. I compiled with Qt 4.3.5, which compiles, but it doesn't seem like all the features are there. $widget->{children} always seems to return an empty array, and $listView->selectionModel() causes a segfault.

Report

gothats

9 years ago

...looks like I'm an idiot. $widget->children() works just fine.

I hate that you can't edit your posts.

Report

gothats

9 years ago

Wow. Perhaps if I want to manipulate a selectionModel, a 'use QItemSelectionModel' is in order.

GD, I really wish I could edit posts.

Report

gothats

9 years ago

It seems like QGraphicsWidget is missing from the typemap in QtGui-4.004. I added it, but now I'm stuck:

g++ -c -I/toast/misc/jets/cburel/apps/Qt-4.4.0/include -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing -pipe -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -fmessage-length=0 -Wall -g -Wall -pipe -DVERSION=\"4.004\" -DXS_VERSION=\"4.004\" -fPIC "-I/usr/lib/perl5/5.8.6/x86_64-linux-thread-multi/CORE" QGraphicsScene.c
QGraphicsScene.xs: In member function `virtual int PerlQGraphicsScene::qt_metacall(QMetaObject::Call, int, void**)':
QGraphicsScene.xs:134: warning: comparison between signed and unsigned integer expressions
QGraphicsScene.xs: In member function `virtual QVariant PerlQGraphicsScene::inputMethodQuery(Qt::InputMethodQuery)':
QGraphicsScene.xs:155: warning: unused variable `PerlInterpreter*my_perl'
QGraphicsScene.xs:181: warning: unused variable `PerlInterpreter*my_perl'
QGraphicsScene.xs: In member function `virtual void PerlQGraphicsScene::contextMenuEvent(QGraphicsSceneContextMenuEvent*)':
QGraphicsScene.xs:199: warning: unused variable `PerlInterpreter*my_perl'
QGraphicsScene.xs:213: warning: unused variable `PerlInterpreter*my_perl'
QGraphicsScene.xs: In member function `virtual void PerlQGraphicsScene::dragEnterEvent(QGraphicsSceneDragDropEvent*)':
QGraphicsScene.xs:231: warning: unused variable `PerlInterpreter*my_perl'
QGraphicsScene.xs:245: warning: unused variable `PerlInterpreter*my_perl'
QGraphicsScene.xs: In member function `virtual void PerlQGraphicsScene::dragMoveEvent(QGraphicsSceneDragDropEvent*)':
QGraphicsScene.xs:263: warning: unused variable `PerlInterpreter*my_perl'
QGraphicsScene.xs:277: warning: unused variable `PerlInterpreter*my_perl'
QGraphicsScene.xs: In member function `virtual void PerlQGraphicsScene::dragLeaveEvent(QGraphicsSceneDragDropEvent*)':
QGraphicsScene.xs:295: warning: unused variable `PerlInterpreter*my_perl'
QGraphicsScene.xs:309: warning: unused variable `PerlInterpreter*my_perl'
QGraphicsScene.xs: In member function `virtual void PerlQGraphicsScene::dropEvent(QGraphicsSceneDragDropEvent*)':
QGraphicsScene.xs:327: warning: unused variable `PerlInterpreter*my_perl'
QGraphicsScene.xs:341: warning: unused variable `PerlInterpreter*my_perl'
QGraphicsScene.xs: In member function `virtual void PerlQGraphicsScene::focusInEvent(QFocusEvent*)':
QGraphicsScene.xs:359: warning: unused variable `PerlInterpreter*my_perl'
QGraphicsScene.xs:373: warning: unused variable `PerlInterpreter*my_perl'
QGraphicsScene.xs: In member function `virtual void PerlQGraphicsScene::focusOutEvent(QFocusEvent*)':
QGraphicsScene.xs:391: warning: unused variable `PerlInterpreter*my_perl'
QGraphicsScene.xs:405: warning: unused variable `PerlInterpreter*my_perl'
QGraphicsScene.xs: In member function `virtual void PerlQGraphicsScene::helpEvent(QGraphicsSceneHelpEvent*)':
QGraphicsScene.xs:423: warning: unused variable `PerlInterpreter*my_perl'
QGraphicsScene.xs:437: warning: unused variable `PerlInterpreter*my_perl'
QGraphicsScene.xs: In member function `virtual void PerlQGraphicsScene::keyPressEvent(QKeyEvent*)':
QGraphicsScene.xs:455: warning: unused variable `PerlInterpreter*my_perl'
QGraphicsScene.xs:469: warning: unused variable `PerlInterpreter*my_perl'
QGraphicsScene.xs: In member function `virtual void PerlQGraphicsScene::keyReleaseEvent(QKeyEvent*)':
QGraphicsScene.xs:487: warning: unused variable `PerlInterpreter*my_perl'
QGraphicsScene.xs:501: warning: unused variable `PerlInterpreter*my_perl'
QGraphicsScene.xs: In member function `virtual void PerlQGraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent*)':
QGraphicsScene.xs:519: warning: unused variable `PerlInterpreter*my_perl'
QGraphicsScene.xs:533: warning: unused variable `PerlInterpreter*my_perl'
QGraphicsScene.xs: In member function `virtual void PerlQGraphicsScene::mouseMoveEvent(QGraphicsSceneMouseEvent*)':
QGraphicsScene.xs:551: warning: unused variable `PerlInterpreter*my_perl'
QGraphicsScene.xs:565: warning: unused variable `PerlInterpreter*my_perl'
QGraphicsScene.xs: In member function `virtual void PerlQGraphicsScene::mouseReleaseEvent(QGraphicsSceneMouseEvent*)':
QGraphicsScene.xs:583: warning: unused variable `PerlInterpreter*my_perl'
QGraphicsScene.xs:597: warning: unused variable `PerlInterpreter*my_perl'
QGraphicsScene.xs: In member function `virtual void PerlQGraphicsScene::mouseDoubleClickEvent(QGraphicsSceneMouseEvent*)':
QGraphicsScene.xs:615: warning: unused variable `PerlInterpreter*my_perl'
QGraphicsScene.xs:629: warning: unused variable `PerlInterpreter*my_perl'
QGraphicsScene.xs: In member function `virtual void PerlQGraphicsScene::wheelEvent(QGraphicsSceneWheelEvent*)':
QGraphicsScene.xs:647: warning: unused variable `PerlInterpreter*my_perl'
QGraphicsScene.xs:661: warning: unused variable `PerlInterpreter*my_perl'
QGraphicsScene.xs: In member function `virtual void PerlQGraphicsScene::inputMethodEvent(QInputMethodEvent*)':
QGraphicsScene.xs:679: warning: unused variable `PerlInterpreter*my_perl'
QGraphicsScene.xs:693: warning: unused variable `PerlInterpreter*my_perl'
QGraphicsScene.xs: In member function `virtual void PerlQGraphicsScene::drawBackground(QPainter*, const QRectF&)':
QGraphicsScene.xs:711: warning: unused variable `PerlInterpreter*my_perl'
QGraphicsScene.xs:726: warning: unused variable `PerlInterpreter*my_perl'
QGraphicsScene.xs: In member function `virtual void PerlQGraphicsScene::drawForeground(QPainter*, const QRectF&)':
QGraphicsScene.xs:744: warning: unused variable `PerlInterpreter*my_perl'
QGraphicsScene.xs:759: warning: unused variable `PerlInterpreter*my_perl'
QGraphicsScene.c: In function `void XS_Qt__QGraphicsScene_new(PerlInterpreter*, CV*)':
QGraphicsScene.c:996: warning: unused variable `SV*RETVAL'
QGraphicsScene.c: In function `void XS_Qt__QGraphicsScene_itemAt(PerlInterpreter*, CV*)':
QGraphicsScene.c:1744: warning: unused variable `SV*RETVAL'
QGraphicsScene.c: In function `void XS_Qt__QGraphicsScene_addEllipse(PerlInterpreter*, CV*)':
QGraphicsScene.c:2097: warning: unused variable `SV*RETVAL'
QGraphicsScene.c: In function `void XS_Qt__QGraphicsScene_addLine(PerlInterpreter*, CV*)':
QGraphicsScene.c:2205: warning: unused variable `SV*RETVAL'
QGraphicsScene.c: In function `void XS_Qt__QGraphicsScene_addPath(PerlInterpreter*, CV*)':
QGraphicsScene.c:2297: warning: unused variable `SV*RETVAL'
QGraphicsScene.c: In function `void XS_Qt__QGraphicsScene_addPolygon(PerlInterpreter*, CV*)':
QGraphicsScene.c:2414: warning: unused variable `SV*RETVAL'
QGraphicsScene.c: In function `void XS_Qt__QGraphicsScene_addRect(PerlInterpreter*, CV*)':
QGraphicsScene.c:2578: warning: unused variable `SV*RETVAL'
QGraphicsScene.c: In function `void XS_Qt__QGraphicsScene_addText(PerlInterpreter*, CV*)':
QGraphicsScene.c:2642: warning: unused variable `SV*RETVAL'
QGraphicsScene.c: In function `void XS_Qt__QGraphicsScene_addSimpleText(PerlInterpreter*, CV*)':
QGraphicsScene.c:2706: warning: unused variable `SV*RETVAL'
QGraphicsScene.c: In function `void XS_Qt__QGraphicsScene_addWidget(PerlInterpreter*, CV*)':
QGraphicsScene.c:2767: warning: unused variable `SV*RETVAL'
QGraphicsScene.xs: In function `void XS_Qt__QGraphicsScene_palette(PerlInterpreter*, CV*)':
QGraphicsScene.xs:1964: error: invalid use of undefined type `struct QPalette'
/toast/misc/jets/cburel/apps/Qt-4.4.0/include/QtCore/qmetatype.h:274: error: forward declaration of `struct QPalette'
QGraphicsScene.xs:1964: error: invalid use of undefined type `struct QPalette'
/toast/misc/jets/cburel/apps/Qt-4.4.0/include/QtCore/qmetatype.h:274: error: forward declaration of `struct QPalette'
make: *** [QGraphicsScene.o] Error 1

Report

gothats

9 years ago

I added it as:
QGraphicsWidget *<tab>O_OBJECT
in QtGui-4.004/typemap

Report

villacampa

9 years ago

I'm trying to compile your librarie with Mandriva Linux 2008.0 (Qt 4.3.3 and Perl 5.8.8) and Mandriva Linux Cooker (development version, Qt 4.3.3 and Perl 5.10).

It fails the same way in both distributions.

The log from compiling in Mandriva Linux Cooker is:
[javier@localhost QtCore-4.004]$ perl Makefile.PL -i /usr/lib/qt4/include/ -qc ../QtCore-4.004
../QtCore-4.004
=====================================================================
found: 4 3 3
found Qt ver = 4 3
== QGlobal ==
??? td: 'typedef QIntForType<void *>::Type qptrdiff;'
= QSysInfo =
enum ??? 'enum Sizes { WordSize = (sizeof(void *)<<3) };'
= QBool =
???? 'operator void *()'
???? '{ return b ? static_cast<void *>(this) : static_cast<void *>(0); }'
= QFlag =
??? td: 'typedef void **Zero;'
??? td: 'typedef Enum enum_type;'
== QPoint ==
= QPoint =
= QPointF =
== QLine ==
= QLine =
= QLineF =
== QSize ==
= QSize =
= QSizeF =
== QRect ==
= QRect =
= QRectF =
== QMutex ==
= QMutex =
= QMutexLocker =
== QWaitCondition ==
= QWaitCondition =
== QReadWriteLock ==
= QReadWriteLock =
= QReadLocker =
= QWriteLocker =
== QSemaphore ==
= QSemaphore =
== QBasicTimer ==
= QBasicTimer =
== QChar ==
= QLatin1Char =
= QChar =
== QByteArray ==
= QByteArray =
??? td: 'typedef Data * DataPtr;'
= QByteRef =
== QBitArray ==
= QBitArray =
??? td: 'typedef QByteArray::DataPtr DataPtr;'
!!! unknown output type 'DataPtr'
= QBitRef =
== QString ==
= QString =
???? ';'
search type SectionFlags in QString
search type SectionFlags in QString
search type SectionFlags in QString
search type SplitBehavior in QString
search type SplitBehavior in QString
search type SplitBehavior in QString
search type NormalizationForm in QString
search type NormalizationForm in QString
??? td: 'typedef Data * DataPtr;'
= QLatin1String =
= QCharRef =
= QStringRef =
== QStringList ==
= QStringList =
== QLocale ==
= QLocale =
= QSystemLocale =
== QTextCodec ==
= QTextCodec =
= QTextCodec::ConverterState =
= QTextEncoder =
= QTextDecoder =
== QStringMatcher ==
= QStringMatcher =
== QRegExp ==
= QRegExp =
== QResource ==
= QResource =
== QUrl ==
= QUrl =
??? td: 'typedef QUrlPrivate * DataPtr;'
!!! unknown type ''
!!! unknown output type 'QList<QPair<QString, QString> >'
!!! unknown output type 'DataPtr'
== QUuid ==
= QUuid =
== QEvent ==
= QEvent =
= QTimerEvent =
= QChildEvent =
= QDynamicPropertyChangeEvent =
== QDateTime ==
= QDate =
= QTime =
= QDateTime =
== QLibraryInfo ==
= QLibraryInfo =
== QObject ==
= QObject =
??? 'QMetaObject staticQtMetaObject;' => 'QMetaObject' 'staticQtMetaObject', curr_class QObject, base QObject
= QObjectUserData =
== QObjectCleanupHandler ==
= QObjectCleanupHandler =
== QLibrary ==
= QLibrary =
== QPluginLoader ==
= QPluginLoader =
== QTimeLine ==
= QTimeLine =
== QTimer ==
= QTimer =
== QEventLoop ==
= QEventLoop =
== QThread ==
= QThread =
== QCoreApplication ==
= QCoreApplication =
== QSignalMapper ==
= QSignalMapper =
== QSocketNotifier ==
= QSocketNotifier =
== QIODevice ==
= QIODevice =
== QFile ==
= QFile =
== QFileInfo ==
= QFileInfo =
== QDir ==
= QDir =
== QAbstractFileEngine ==
= QAbstractFileEngine =
??? 'class ExtensionOption;' => 'class' 'ExtensionOption', curr_class QAbstractFileEngine, base QAbstractFileEngine
??? 'class ExtensionReturn;' => 'class' 'ExtensionReturn', curr_class QAbstractFileEngine, base QAbstractFileEngine
!!! unknown type 'ExtensionOption'
== QFSFileEngine ==
= QFSFileEngine =
!!! unknown type 'ExtensionOption'
== QFileSystemWatcher ==
= QFileSystemWatcher =
== QTemporaryFile ==
= QTemporaryFile =
== QBuffer ==
= QBuffer =
== QProcess ==
= QProcess =
== QTextStream ==
= QTextStream =
??? td: 'typedef QTextStream & (*QTextStreamFunction)(QTextStream &);'
= QTextStreamManipulator =
== QDataStream ==
= QDataStream =
== QMetaType ==
= QMetaType =
== QTranslator ==
= QTranslator =
== QVariant ==
= QVariant =
= QVariant::PrivateShared =
??? 'QAtomic ref;' => 'QAtomic' 'ref', curr_class QVariant::PrivateShared, base QVariant
= QVariant::Private =
= QVariant::Handler =
??? 'Private d;' => 'Private' 'd', curr_class QVariant, base QVariant::Private
??? 'Handler *handler;' => 'Handler' '*handler', curr_class QVariant, base QVariant::Private
??? td: 'typedef Private DataPtr;'
!!! unknown output type 'DataPtr'
= QVariantComparisonHelper =
== QAbstractItemModel ==
= QModelIndex =
= QPersistentModelIndex =
= QAbstractItemModel =
= QAbstractTableModel =
= QAbstractListModel =
== QMimeData ==
= QMimeData =
== QSettings ==
= QSettings =
WARNING: Setting ABSTRACT via file 'lib/QtCore.pm' failed
at /usr/lib/perl5/5.10.0/ExtUtils/MakeMaker.pm line 529
Note (probably harmless): No library found for -lQtCore
Writing Makefile for QtCore


I'm too newbie with perl and don't have a clue what i can do to be successful on this task.

Thank you very much for your efforts to provide Qt4 in Perl!!

Report

karpio

10 years ago

perl Makefile.PL

=====================================================================
found: 4 3 2
found Qt ver = 4 3
== QGlobal ==
??? td: 'typedef QIntForType<void *>::Type qptrdiff;'
= QSysInfo =
enum ??? 'enum Sizes { WordSize = (sizeof(void *)<<3) };'
= QBool =
???? 'operator void *()'
???? '{ return b ? static_cast<void *>(this) : static_cast<void *>(0); }'
= QFlag =
??? td: 'typedef void **Zero;'
??? td: 'typedef Enum enum_type;'
== QPoint ==
= QPoint =
= QPointF =
== QLine ==
= QLine =
= QLineF =
== QSize ==
= QSize =
= QSizeF =
== QRect ==
= QRect =
= QRectF =
== QMutex ==
= QMutex =
= QMutexLocker =
== QWaitCondition ==
= QWaitCondition =
== QReadWriteLock ==
= QReadWriteLock =
= QReadLocker =
= QWriteLocker =
== QSemaphore ==
= QSemaphore =
== QBasicTimer ==
= QBasicTimer =
== QChar ==
= QLatin1Char =
= QChar =
== QByteArray ==
= QByteArray =
??? td: 'typedef Data * DataPtr;'
= QByteRef =
== QBitArray ==
= QBitArray =
??? td: 'typedef QByteArray::DataPtr DataPtr;'
!!! unknown output type 'DataPtr'
= QBitRef =
== QString ==
= QString =
???? ';'
??? td: 'typedef Data * DataPtr;'
= QLatin1String =
= QCharRef =
= QStringRef =
Can not parce create_xs:
Unmatched ) in regex; marked by <-- HERE in m/0) <-- HERE / at create_xs line 1204, <FH> line 1072.

Report

karpio

10 years ago

in up-to-date debian unstable x86_64, with gcc 4.2, Qt 4.3.2 and perl 5.8.8.

Report

C

vadiml

10 years ago

thanks, I will recheck on v.4.3

Report

tonton1664

10 years ago

It get a compilation error :
g++ -c -I/usr/include/qt4 -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBIAN -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -DVERSION=\"4.000\" -DXS_VERSION=\"4.000\" -fPIC "-I/usr/lib/perl/5.8/CORE" QString.c
QString.xs: In function ‘void XS_Qt__QStringRef_unicode(PerlInterpreter*, CV*)’:
QString.xs:1629: error: invalid conversion from ‘const QChar*’ to ‘QChar*’

After adding a const_cast in QString.xs, it compiles, but the tests fails:

t/01_QtCore.....................NOK 1
# Failed test 'use QtCore;'
# in t/01_QtCore.t at line 9.
# Tried to use 'QtCore'.
# Error: Can't load '/home/tonton/QtCore-4.000/blib/arch/auto/QtCore/QtCore.so' for module QtCore: /home/tonton/QtCore-4.000/blib/arch/auto/QtCore/QtCore.so: undefined symbol: _ZN10QByteArray7replaceERK7QStringPKc at /usr/lib/perl/5.8/DynaLoader.pm line 225.
# at (eval 3) line 2

The perl module is linked to QtCore:
$ ldd blib/arch/auto/QtCore/QtCore.so | grep Qt
libQtCore.so.4 => /usr/lib/libQtCore.so.4 (0x00002ac0ab29b000)

This is on an up-to-date debian unstable x86_64, with gcc 4.2, Qt 4.3.2 and perl 5.8.8.

Also, I think there is a typo at line 12 of Makefile.PL:
$QtCore_path = $arcs{-qc};
(but $QtCore_path is not used in the file)

Report

C

vadiml

10 years ago

For const QChar need add
const QChar *<tab>O_OBJECT
in typemap
But this must was see (and make) create_xs script

I install fedora8 today and check it on Qt4.3

PS my email have in arhive.

Report

C

vadiml

10 years ago

> $QtCore_path = $arcs{-qc};
> (but $QtCore_path is not used in the file)

$QtCore_path need for QtGui and other lib

Report

C

vadiml

10 years ago

> $QtCore_path = $arcs{-qc};
> (but $QtCore_path is not used in the file)

$QtCore_path need for QtGui and other lib

Report

C

vadiml

10 years ago

I tested program with Qt4.3.2 (fedora8 i386) and Qt4.2.1 (CentOS5 x86_64). Problem found only with x86_64.

For fix const QChar I updated arhive QtCore-4.000.tar.bz2

Report

10 years ago

4.004
- add access to protected enums
- rewrite Makefile.PL
- fix bugs in QListWidget and with WId
- add examples/desktop/snapshot
- add modules into CPAN
4.000
- add access to protected function for object classes
- add call virtual function from C classes into perl
- fix bug with INOUT for static function

product-maker 9 44

File (click to download) Version Description Filetype Packagetype License Downloads Date Filesize OCS-Install DL
Details
version
4.004
updated Feb 05 2008
added Nov 14 2007
downloads today
0
page views today 1