diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-01-01 18:24:37 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-01-01 18:24:37 -0600 |
commit | 4e997a9c6e25689dca65a2ec573a599699ef8170 (patch) | |
tree | fdb5ecac42fb8204df9fc8c9abe1c784d4719e0e /doc/en | |
parent | bfa107694b2507a7116f8856cafe4ab1375da8a9 (diff) | |
download | libtqt-perl-4e997a9c6e25689dca65a2ec573a599699ef8170.tar.gz libtqt-perl-4e997a9c6e25689dca65a2ec573a599699ef8170.zip |
Initial TQt conversion
Diffstat (limited to 'doc/en')
-rw-r--r-- | doc/en/Makefile | 4 | ||||
-rw-r--r-- | doc/en/PerlQt.pod | 386 | ||||
-rw-r--r-- | doc/en/index.html | 396 |
3 files changed, 393 insertions, 393 deletions
diff --git a/doc/en/Makefile b/doc/en/Makefile index 1d300c0..536536a 100644 --- a/doc/en/Makefile +++ b/doc/en/Makefile @@ -1,6 +1,6 @@ -index.html: PerlQt.pod - pod2html --css ../css/pod.css PerlQt.pod > index.html +index.html: PerlTQt.pod + pod2html --css ../css/pod.css PerlTQt.pod > index.html perl -pi -e 's/cgibin/cgi-bin/' index.html perl -pi -e 's/#http/http/g' index.html rm -f pod2*~~ diff --git a/doc/en/PerlQt.pod b/doc/en/PerlQt.pod index b05a0a9..5593aa9 100644 --- a/doc/en/PerlQt.pod +++ b/doc/en/PerlQt.pod @@ -1,39 +1,39 @@ -=head1 Programming PerlQt +=head1 Programming PerlTQt B<Germain Garand> -This document describes a set of Perl bindings for the Qt toolkit. Contact +This document describes a set of Perl bindings for the TQt toolkit. Contact the author at <germain@ebooksfrance.com> =head1 Introduction -PerlQt-3 is Ashley Winters' full featured object oriented interface to -L<Trolltech|"http://www.trolltech.com">'s C++ Qt toolkit v3.0. +PerlTQt-3 is Ashley Winters' full featured object oriented interface to +L<Trolltech|"http://www.trolltech.com">'s C++ TQt toolkit v3.0. It is based on the L<SMOKE|"http://webcvs.kde.org/cgi-bin/cvsweb.cgi/kdebindings/smoke"> -library, a language independent low-level wrapper generated from Qt headers by +library, a language independent low-level wrapper generated from TQt headers by Richard Dale's L<kalyptus|"http://webcvs.kde.org/cgi-bin/cvsweb.cgi/kdebindings/kalyptus"> thanks to David Faure's module. -This document describes the principles of PerlQt programming. +This document describes the principles of PerlTQt programming. It assumes you have some basic Perl Object Oriented programming knowledge. Some C++ knowledge is recommended but not required. -It would mostly help you to find your way through L<Qt's +It would mostly help you to find your way through L<TQt's excellent documentation|"http://doc.trolltech.com"> which is our ultimate and only reference. -If Qt is installed on your system, then you most probably -also have its documentation. Try the C<$QTDIR/bin/assistant> program. +If TQt is installed on your system, then you most probably +also have its documentation. Try the C<$TQTDIR/bin/assistant> program. =head1 Installation =head2 Requirements -To compile and use PerlQt, you'll need : +To compile and use PerlTQt, you'll need : =over 4 @@ -51,25 +51,25 @@ L<Perl E<gt>= v5.6.0|"http://www.perl.org"> =item * -L<Qt E<gt>= +L<TQt E<gt>= v3.0|"http://www.trolltech.com/developer/download/qt-x11.html"> =item * -L<SmokeQt 1.2.1|"http://webcvs.kde.org/cgi-bin/cvsweb.cgi/kdebindings/smoke"> +L<SmokeTQt 1.2.1|"http://webcvs.kde.org/cgi-bin/cvsweb.cgi/kdebindings/smoke"> The SMOKE library (Scripting Meta Object Kompiler) is part of L<KDE|"http://www.kde.org">'s B<kdebindings> module. You may want to check if a precompiled version of this module exists for your system. -PerlQt is packaged with its own copy, so you don't need to check it out. +PerlTQt is packaged with its own copy, so you don't need to check it out. =back -Perl and Qt's installation is out of the scope of this document. Please refer +Perl and TQt's installation is out of the scope of this document. Please refer to those projects' documentation. =head2 Compilation -PerlQt uses GNU's Autoconf framework. However, the standard ./configure script is preferably driven +PerlTQt uses GNU's Autoconf framework. However, the standard ./configure script is preferably driven by the Makefile.PL wrapper. All options are forwarded to ./configure : perl Makefile.PL @@ -81,7 +81,7 @@ Then : make install -This will install PerlQt, Puic and Smoke (if needed), as well as the pqtsh and pqtapi utilities. +This will install PerlTQt, Puic and Smoke (if needed), as well as the pqtsh and pqtapi utilities. The preferred install location for SMOKE and Puic is in the KDE3 file system. If you don't have KDE3 installed, specify a location with C<configure>'s @@ -91,13 +91,13 @@ C<--prefix> option. e.g: =head2 Troubleshooting and Configure Options -If Smoke's linking fails or your Qt library was built with very specific +If Smoke's linking fails or your TQt library was built with very specific options, run Makefile.PL again with: perl Makefile.PL --with-threshold=0 When building smoke, configure will check for OpenGL and try to compile -support for it if it is properly installed and supported by Qt. +support for it if it is properly installed and supported by TQt. You may disable this checking with: @@ -110,9 +110,9 @@ it, specify: --without-Mesa -=head2 How to install PerlQt with user rights +=head2 How to install PerlTQt with user rights -To install PerlQt without super-user rights, simply follow this procedure: +To install PerlTQt without super-user rights, simply follow this procedure: =over 4 @@ -128,11 +128,11 @@ The above would install the Smoke library in ~/lib and the puic binary in ~/bin Reconfigure the Perl module so that it doesn't target the standard perl hierarchy: - cd PerlQt + cd PerlTQt perl Makefile.PL PREFIX=~ cd .. -Beware : this is not the same Makefile.PL as above, but the one located in the ./PerlQt +Beware : this is not the same Makefile.PL as above, but the one located in the ./PerlTQt subdirectory =item * @@ -154,9 +154,9 @@ or at the top of your program: =back -=head1 Anatomy of PerlQt +=head1 Anatomy of PerlTQt -A typical Qt program using GUI components is based on an event loop. +A typical TQt program using GUI components is based on an event loop. This basically means that such a program is no more envisioned as a straight flow where you would need to handle yourself every single events (such as a @@ -168,15 +168,15 @@ define what objects methods need to be called when an event occurs, and then start the main event loop. That's all! -Qt will handle all events and dispatch them to the correct subroutine. +TQt will handle all events and dispatch them to the correct subroutine. -Lets see how this process is implemented in a minimal PerlQt program. +Lets see how this process is implemented in a minimal PerlTQt program. =head2 Hello World - 1: use Qt; - 2: my $a = Qt::Application(\@ARGV); - 3: my $hello = Qt::PushButton("Hello World!", undef); + 1: use TQt; + 2: my $a = TQt::Application(\@ARGV); + 3: my $hello = TQt::PushButton("Hello World!", undef); 4: $hello->resize(160, 25); 5: $a->setMainWidget($hello); 6: $hello->show; @@ -186,16 +186,16 @@ Lets see how this process is implemented in a minimal PerlQt program. <br/> <div class='image'><img src="../images/ex1.png"/></div> -This program first loads the Qt interface [line 1] and creates the application +This program first loads the TQt interface [line 1] and creates the application object, passing it a reference to the command line arguments array C<@ARGV> [l.2]. This application object is unique, and may later be accessed from -anywhere through the B<Qt::app()> pointer. +anywhere through the B<TQt::app()> pointer. At line 3, we create a PushButton, which has no parent (i.e : it won't be contained nor owned by another widget). Therefore, we pass to the constructor an B<undef> value for the parent argument, -which is PerlQt's way of passing a Null pointer. +which is PerlTQt's way of passing a Null pointer. After some layouting at [l.4], we tell the application object that our main widget is this PushButton [l.5]... that way, it will know that closing the @@ -211,51 +211,51 @@ B<Syntax elements summary :> =item 1 -All Qt classes are accessed through the prefix B<Qt::>, which replaces the -initial B<Q> of Qt classes. -When browsing the L<Qt +All TQt classes are accessed through the prefix B<TQt::>, which replaces the +initial B<Q> of TQt classes. +When browsing the L<TQt documentation|"http://doc.trolltech.com>, you simply need to change the -name of classes so that B<QFoo> reads B<Qt::Foo>. +name of classes so that B<TQFoo> reads B<TQt::Foo>. =item 2 An object is created by calling the B<constructor> of the class. It has the same name as the class itself. -You don't need to say C<new Qt::Foo> or C<Qt::Foo-E<gt>new()> as most Perl +You don't need to say C<new TQt::Foo> or C<TQt::Foo-E<gt>new()> as most Perl programmers would have expected. Instead, you just say : - my $object = Qt::<classname>(arg_1, ..., arg_n); + my $object = TQt::<classname>(arg_1, ..., arg_n); If you don't need to pass any argument to the constructor, simply say : - my $object = Qt::<classname>; + my $object = TQt::<classname>; =item 3 Whenever you need to pass a Null pointer as an argument, use Perl's B<undef> keyword. Do not pass zero. - Beware: this is by far the most common error in PerlQt programs. + Beware: this is by far the most common error in PerlTQt programs. Pointers are arguments preceded by an B<*> -character in Qt's documentation (e.g: "C<QWidget * widget>"). +character in TQt's documentation (e.g: "C<TQWidget * widget>"). =back =head2 Inheritance and Objects -Before we can discuss how Perl subroutines can be called back from Qt, we need -to introduce PerlQt's inheritance mechanism. +Before we can discuss how Perl subroutines can be called back from TQt, we need +to introduce PerlTQt's inheritance mechanism. -PerlQt was designed to couple as tightly as possible Qt's simplicity and Perl's +PerlTQt was designed to couple as tightly as possible TQt's simplicity and Perl's power and flexibility. In order to achieve that goal, the classical Object Oriented Perl paradigm had -to be extended, much in the same way than Qt itself +to be extended, much in the same way than TQt itself had to extend C++'s paradigm with B<metaobjects>. =head3 A Custom Widget @@ -266,8 +266,8 @@ of PushButton: 1: use strict; 2: 3: package Button; - 4: use Qt; - 5: use Qt::isa qw(Qt::PushButton); + 4: use TQt; + 5: use TQt::isa qw(TQt::PushButton); 6: 7: sub NEW 8: { @@ -279,29 +279,29 @@ of PushButton: 14: 15: package main; 16: - 17: use Qt; + 17: use TQt; 18: use Button; 19: - 20: my $a = Qt::Application(\@ARGV); + 20: my $a = TQt::Application(\@ARGV); 21: my $w = Button("Hello World!", undef); 22: $a->setMainWidget($w); 23: $w->show; 24: exit $a->exec; Here, we want to create our own version of the PushButton widget. -Therefore, we create a new package for it [l.3] and import Qt [l.4]. +Therefore, we create a new package for it [l.3] and import TQt [l.4]. We now want to declare our widget as subclassing PushButton. -This is done through the use of the C<Qt::isa> pragma [l.5], which accepts a -list of one or more parent Qt classes. +This is done through the use of the C<TQt::isa> pragma [l.5], which accepts a +list of one or more parent TQt classes. It is now time to create a B<constructor> for our new widget. This is done by creating a subroutine called B<NEW> I<(note the capitalized -form, which differentate it from the usual "new" constructor. PerlQt's NEW +form, which differentate it from the usual "new" constructor. PerlTQt's NEW constructor is called >B<implicitly>I< as can be seen on line 21)>. Since we want our widget to call its parent's constructor first, we call the -B<superclass's constructor> (here: Qt::PushButton) on line 9, passing it all +B<superclass's constructor> (here: TQt::PushButton) on line 9, passing it all arguments we received. At this time, a class instance has been created and stored into a special @@ -316,7 +316,7 @@ When building a new composite widget, you may just create its different parts inside B<my> variables, since widgets are only deleted by their parents and not necessarily when their container goes out of scope. -In other words, PerlQt performs clever reference counting to prevent +In other words, PerlTQt performs clever reference counting to prevent indesirable deletion of objects. Now, you'll often want to keep an access to those parts from anywhere inside @@ -328,15 +328,15 @@ checking... Here come B<Attributes>. Attributes are data holders where you can store any kind of properties for your object. -Declaring new attributes is done through the C<use Qt::attributes> pragma, as is +Declaring new attributes is done through the C<use TQt::attributes> pragma, as is demonstrated in the following package implementation : 1: use strict; 2: 3: package Button; - 4: use Qt; - 5: use Qt::isa qw(Qt::PushButton); - 6: use Qt::attributes qw( + 4: use TQt; + 5: use TQt::isa qw(TQt::PushButton); + 6: use TQt::attributes qw( 7: itsTime 8: pData 9: ); @@ -344,7 +344,7 @@ demonstrated in the following package implementation : 11: sub NEW 12: { 13: shift->SUPER::NEW(@_[0..2]); - 14: itsTime = Qt::Time; + 14: itsTime = TQt::Time; 15: itsTime->start; 16: pData = " Foo "; 17: } @@ -362,7 +362,7 @@ demonstrated in the following package implementation : <div class='image'><img src="../images/ex2.png"/></div> -An attribute itsTime is declared at line 7, and loaded with a C<Qt::Time> object +An attribute itsTime is declared at line 7, and loaded with a C<TQt::Time> object at line 14. Since we reimplement the virtual function "resizeEvent" [l.19]. @@ -376,11 +376,11 @@ B<Recapitulation> =item * -In order to inherit a Qt class, a package must contain a -C<use Qt::isa> pragma. +In order to inherit a TQt class, a package must contain a +C<use TQt::isa> pragma. e.g: - use Qt::isa "Qt::widget"; + use TQt::isa "TQt::widget"; =item * @@ -441,7 +441,7 @@ construct is also available, but will pass the object as first argument. Whenever you need to store a contained object in your package, you may define it as an B<Attribute> : - use Qt::attributes qw( + use TQt::attributes qw( firstAttribute ... lastAttribute); @@ -456,21 +456,21 @@ and then use it as a convenient accessor : To reimplement a B<virtual function>, simply create a B<sub> with the same name in your object. -Existing virtual functions are marked as such in Qt's documentation +Existing virtual functions are marked as such in TQt's documentation (they are prefixed with the "virtual" keyword). -You can inspect what virtual function names are being called by Qt at runtime by -putting a C<use Qt::debug qw( virtual )> statement at the top of your program. +You can inspect what virtual function names are being called by TQt at runtime by +putting a C<use TQt::debug qw( virtual )> statement at the top of your program. =back =head2 Signals and Slots -We'll now learn how Qt objects can communicate with each other, +We'll now learn how TQt objects can communicate with each other, allowing an event occuring, for instance, in a given widget to trigger the execution of one or several subroutines anywhere inside your program. -Most other toolkits use callbacks for that purpose, but Qt has a much more +Most other toolkits use callbacks for that purpose, but TQt has a much more powerful and flexible mechanism called B<Signals and Slots>. Signals and slots are used for communication between objects. @@ -482,23 +482,23 @@ recorder deck can start to record when it receives a signal wired to it's input slot, and it doesn't need to know that this signal is also received by a CD recorder device, or listened through headphones. -A Qt component behaves just like that. It has several output B<Signals> and +A TQt component behaves just like that. It has several output B<Signals> and several input B<Slots> - and each signal can be connected to an unlimited number of listening slots of the same type, wether they are inside or outside the component. The general syntax of this connection process is either : -Qt::Object::connect( sender, SIGNAL 'mysignal(arg_type)', -receiver, SLOT 'myslot(arg_type)'); +TQt::Object::connect( sender, TQT_SIGNAL 'mysignal(arg_type)', +receiver, TQT_SLOT 'myslot(arg_type)'); or -myObject->connect( sender, SIGNAL 'mysignal(arg_type)', SLOT +myObject->connect( sender, TQT_SIGNAL 'mysignal(arg_type)', TQT_SLOT 'myslot(arg_type)'); This mechanism can be extended at will by the declaration of custom Signals and -Slots, through the C<use Qt::signals> and C<use Qt::slots> pragma +Slots, through the C<use TQt::signals> and C<use TQt::slots> pragma (see also the other syntax, later on). Each declared slot will call the corresponding subroutine in your object, @@ -509,22 +509,22 @@ B<As an example, lets rewrite again our Button package :> 1: use strict; 2: 3: package Button; - 4: use Qt; - 5: use Qt::isa qw(Qt::PushButton); - 6: use Qt::attributes qw(itsTime); - 7: use Qt::slots + 4: use TQt; + 5: use TQt::isa qw(TQt::PushButton); + 6: use TQt::attributes qw(itsTime); + 7: use TQt::slots 8: wasClicked => [], 9: change => ['int', 'int']; - 10: use Qt::signals + 10: use TQt::signals 11: changeIt => ['int', 'int']; 12: 13: sub NEW 14: { 15: shift->SUPER::NEW(@_[0..2]); - 16: itsTime = Qt::Time; + 16: itsTime = TQt::Time; 17: itsTime->start; - 18: this->connect(this, SIGNAL 'clicked()', SLOT 'wasClicked()'); - 19: this->connect(this, SIGNAL 'changeIt(int,int)', SLOT 'change(int,int)'); + 18: this->connect(this, TQT_SIGNAL 'clicked()', TQT_SLOT 'wasClicked()'); + 19: this->connect(this, TQT_SIGNAL 'changeIt(int,int)', TQT_SLOT 'change(int,int)'); 20: } 21: 22: sub wasClicked @@ -545,7 +545,7 @@ B<As an example, lets rewrite again our Button package :> In this package, we define two extra slots and one extra signal. -We know from the Qt Documentation that a clicked PushButton emits a C<clicked()> +We know from the TQt Documentation that a clicked PushButton emits a C<clicked()> signal, so we connect it to our new slot at line 18. We also connect our signal C<changeIt> to our own C<change> slot- which is @@ -556,9 +556,9 @@ triggers the C<wasClicked()> slot. C<wasClicked> then proceeds to emit the C<changeIt(int,int)> signal [l.27], hence triggering the C<change(int,int)> slot with two arguments. -Finally, since PerlQt-3.008, an alternative syntax can be used to declare Signals and Slots: +Finally, since PerlTQt-3.008, an alternative syntax can be used to declare Signals and Slots: - sub a_slot : SLOT(int, QString) + sub a_slot : TQT_SLOT(int, TQString) { $int = shift; $string = shift; @@ -567,19 +567,19 @@ Finally, since PerlQt-3.008, an alternative syntax can be used to declare Signal and - sub a_signal : SIGNAL(QString); + sub a_signal : TQT_SIGNAL(TQString); This syntax is perfectly compatible with the traditional -C<use Qt::signals> and C<use Qt::slots> declarations. +C<use TQt::signals> and C<use TQt::slots> declarations. Eventually, it can prove good programming practice to mix both syntaxes, by first declaring -Signals/Slots with C<use Qt::slots/signals>, then repeat this declaration +Signals/Slots with C<use TQt::slots/signals>, then repeat this declaration in the actual implementation with the second syntax. Declarations will be checked for consistency at compile time, and any mismatch in arguments would trigger a warning. -=head1 RAD prototyping with Qt Designer and Puic +=head1 RAD prototyping with TQt Designer and Puic =head2 Introduction @@ -587,27 +587,27 @@ in arguments would trigger a warning. =item * Note: -As of PerlQt-3.008, a separate PerlQt plugin for Qt Designer is available, -bringing full integration, syntax highlighting, code completion and allowing to run/debug your PerlQt project +As of PerlTQt-3.008, a separate PerlTQt plugin for TQt Designer is available, +bringing full integration, syntax highlighting, code completion and allowing to run/debug your PerlTQt project entirely from the Designer GUI. Nevertheless, the below is still accurate with regard to puic command line interaction -and with regard to using Qt Designer I<without> the specific plugin. +and with regard to using TQt Designer I<without> the specific plugin. =back -As efficient and intuitive as Qt can be, building a complete GUI from scratch +As efficient and intuitive as TQt can be, building a complete GUI from scratch is often a tedious task. -Hopefully, Qt comes with a very sophisticated GUI Builder named Qt +Hopefully, TQt comes with a very sophisticated GUI Builder named TQt Designer, which is close to a complete integrated development environment. It features Project management, drag'n drop GUI building, a complete object browser, graphical interconnection of signals and slots, and much much more. -Qt Designer's output is XML which can be parsed by several command line tools, -among whose is B<puic> (the PerlQt User Interface Compiler). +TQt Designer's output is XML which can be parsed by several command line tools, +among whose is B<puic> (the PerlTQt User Interface Compiler). Assuming you have already built an interface file with the Designer, -translating it to a PerlQt program is simply a matter of issuing +translating it to a PerlTQt program is simply a matter of issuing one command : puic -x -o program.pl program.ui @@ -632,7 +632,7 @@ If you need to B<embed images or icons>, it can be done in two ways =item * Inline embedding For this, you need to check the "Edit->Form Settings->Pixmaps->Save inline" -checkbox inside Qt Designer. +checkbox inside TQt Designer. Then : puic -x -o F<program.pl> F<program.ui> =item * Image Collection @@ -643,7 +643,7 @@ puic -o F<Collection.pm> -embed F<unique_identifier> F<image-1> ... F<image-n> Then add a C<use Collection.pm> statement to your program's main package. -If you've created a project file in Qt Designer, and added all images +If you've created a project file in TQt Designer, and added all images you want to group (through "Project->Image Collection"), you'll find all those images inside the directory where your project file (*.pro) is stored, under /images. @@ -671,7 +671,7 @@ Instead, you may : =item * Write slots implementation in the Designer -In Qt Designer, select the I<Source> tab of the B<Object Explorer>. +In TQt Designer, select the I<Source> tab of the B<Object Explorer>. There you can see a tree-like representation of your classes. Now if you double-click on the I<Slots/public> entry, you are prompted with a dialog where you can create a new custom slot for @@ -744,8 +744,8 @@ or =head1 More development tools -PerlQt comes bundled with two simple programs that can help you to find your way through -the Qt API: +PerlTQt comes bundled with two simple programs that can help you to find your way through +the TQt API: =head2 pqtapi @@ -756,14 +756,14 @@ pqtapi is a commandline driven introspection tool. options: -r <re> : find all functions matching regular expression/keyword <re> -i : together with -r, performs a case insensitive search - -v : print PerlQt and Qt versions + -v : print PerlTQt and TQt versions -h : print this help message e.g: $>pqtapi -ir 'setpoint.* int' - void QCanvasLine::setPoints(int, int, int, int) - void QPointArray::setPoint(uint, int, int) + void TQCanvasLine::setPoints(int, int, int, int) + void TQPointArray::setPoint(uint, int, int) =head2 pqtsh @@ -780,7 +780,7 @@ Templated classes aren't available yet (classes derived from templated classes a =head1 Credits -PerlQt-3 is (c) 2002 Ashley Winters (and (c) 2003 Germain Garand) +PerlTQt-3 is (c) 2002 Ashley Winters (and (c) 2003 Germain Garand) Kalyptus and the Smoke generation engine are (c) David Faure and Richard Dale @@ -791,9 +791,9 @@ The mentioned software is released under the GNU Public Licence v.2 or later. =head1 Appendix 1 : C++ conventions and their Perl counterpart -Whenever you want to use a class/method described in Qt's -L<documentation|"http://doc.trolltech.com"> (see also the 'assistant' program bundled with Qt) -from PerlQt, you need to follow some simple translation rules. +Whenever you want to use a class/method described in TQt's +L<documentation|"http://doc.trolltech.com"> (see also the 'assistant' program bundled with TQt) +from PerlTQt, you need to follow some simple translation rules. =over 4 @@ -803,9 +803,9 @@ from PerlQt, you need to follow some simple translation rules. =item * -All classnames are changed from a B<Q> prefix in Qt to a B<Qt::> prefix +All classnames are changed from a B<Q> prefix in TQt to a B<TQt::> prefix in Perl. -e.g: QComboBox is named Qt::ComboBox within PerlQt. +e.g: TQComboBox is named TQt::ComboBox within PerlTQt. =back @@ -816,15 +816,15 @@ e.g: QComboBox is named Qt::ComboBox within PerlQt. =item * Functions referenced as B<static> are accessed directly, and not through -an object. Thus the static function Foo in class QBar would be accessed from -PerlQt as +an object. Thus the static function Foo in class TQBar would be accessed from +PerlTQt as - Qt::Bar::Foo( arg-1,...,arg-n); + TQt::Bar::Foo( arg-1,...,arg-n); The only notable exceptions are : - qApp() will map to Qt::app() - qVersion() will map to Qt::version() # not really needed anymore: we have qVersion(). See Global Functions below. + qApp() will map to TQt::app() + qVersion() will map to TQt::version() # not really needed anymore: we have qVersion(). See Global Functions below. =item * @@ -834,7 +834,7 @@ e.g: $widget->show; -There are no fundamental differences between methods and signals, however PerlQt +There are no fundamental differences between methods and signals, however PerlTQt provides the B<emit> keyword as a convenient mnemonic, so that it is clear you are emitting a signal : @@ -849,17 +849,17 @@ are emitting a signal : =item * By value When an argument isn't preceded by the B<&> or B<*> character, it is passed by -value. For all basic types such as int, char, float and double, PerlQt will +value. For all basic types such as int, char, float and double, PerlTQt will automatically convert litteral and scalar values to the corresponding C++ type. Thus for a constructor prototype written as follow in the documentation : - QSize ( int w, int h ) + TQSize ( int w, int h ) You'd say : - Qt::Size(8, 12); + TQt::Size(8, 12); =item * By reference @@ -868,12 +868,12 @@ When an argument is preceded by the B<&> character, it means a reference to an object or to a type is expected. You may either provide a variable name or a temporary object : - $keyseq = Qt::keySequence( &Qt::CTRL + &Qt::F3 ); + $keyseq = TQt::keySequence( &TQt::CTRL + &TQt::F3 ); $widget->setAccel( $keyseq ); or - $widget->setAccel(Qt::keySequence( &Qt::CTRL + &Qt::F3 ); + $widget->setAccel(TQt::keySequence( &TQt::CTRL + &TQt::F3 ); If the argument isn't qualified as B<const> (constant), it means the passed object may be altered during the process - you must then provide a variable. @@ -902,7 +902,7 @@ where C<Strange> is the generic enumeration name, and C<Apple>, C<Orange>, C<Lemon> its possible values, which are only aliases for numbers (here 0, 1 and 2). -Access to enumerations values in Perl Qt is very similar to a static function +Access to enumerations values in Perl TQt is very similar to a static function call. In fact, it B<is> a static function call. Therefore, since you probably want to avoid some readability problems, we @@ -910,110 +910,110 @@ recommend the use of the alternate function call syntax : C<&function>. Lets now go back to our C<Strange> example. -If its definition was encountered in the class C<QFruits>, you'd write from -PerlQt : +If its definition was encountered in the class C<TQFruits>, you'd write from +PerlTQt : - $apple_plus_orange = &Qt::Fruit::Apple + &Qt::Fruit::Orange; + $apple_plus_orange = &TQt::Fruit::Apple + &TQt::Fruit::Orange; =item Operators -Within PerlQt, B<operators overloading> works transparently. -If a given operator is overloaded in a Qt class (which means using it triggers a custom method) -it will behave identically in PerlQt. +Within PerlTQt, B<operators overloading> works transparently. +If a given operator is overloaded in a TQt class (which means using it triggers a custom method) +it will behave identically in PerlTQt. Beware though that due to limitations of the Smoke binding library, not all overloaded operators are -available in PerlQt. +available in PerlTQt. You can check the availability of a given operator by using the pqtapi program. Also, due to outstanding differences between C++'s and Perl's object paradigm, the copy constructor operator (a.k.a '=') has been disabled. e.g-1: '+=' overload - $p1 = Qt::Point(10, 10) - $p2 = Qt::Point(30,40) + $p1 = TQt::Point(10, 10) + $p2 = TQt::Point(30,40) $p2 += $p1; # $p2 becomes (40,50) e.g-2: '<<' overload - $f = Qt::File("example"); + $f = TQt::File("example"); $f->open( IO_WriteOnly ); # see 'Constants' below - $s = Qt::TextStream( $f ); + $s = TQt::TextStream( $f ); $s << "What can I do with " << 12 << " apples?"; =item Constants -Qt doesn't use many constants, but there is at least one place where they are used : for setting +TQt doesn't use many constants, but there is at least one place where they are used : for setting Input/Output flags on files. -In order to avoid the namespace pollution induced by global constants, PerlQt group them in the B<Qt::constants> module. +In order to avoid the namespace pollution induced by global constants, PerlTQt group them in the B<TQt::constants> module. For instance, requesting the importation of all IO constants into the current namespace would be done with: - use Qt::constants; + use TQt::constants; You may also import specific symbols: - use Qt::constants qw( IO_ReadOnly IO_WriteOnly ); + use TQt::constants qw( IO_ReadOnly IO_WriteOnly ); =item Global Functions -Qt has also some utilitarian functions such as bitBlt, qCompress, etc. +TQt has also some utilitarian functions such as bitBlt, qCompress, etc. Those were global scope functions and have been grouped in a common namespace: -C<Qt::GlobalSpace>. +C<TQt::GlobalSpace>. Hence, you shall access this namespace either with a fully qualified call: - Qt::GlobalSpace::qUncompress( $buffer ) + TQt::GlobalSpace::qUncompress( $buffer ) Or directly, after importation in the current namespace: - use Qt::GlobalSpace; + use TQt::GlobalSpace; qUncompress( $buffer ) Of course, you may selectively import a few functions: - use Qt::GlobalSpace qw( qUncompress bitBlt ) + use TQt::GlobalSpace qw( qUncompress bitBlt ) B<Note:> GlobalSpace has also operators, such has the one performing an addition on two -Qt::Point(). Those operators are called automatically. +TQt::Point(). Those operators are called automatically. e.g: - $p1 = Qt::Point(10, 10) + Qt::Point(20, 20) + $p1 = TQt::Point(10, 10) + TQt::Point(20, 20) =back =head1 Appendix 2 : Internationalization -PerlQt handles internationalization by always converting B<QString> back to B<utf8> in Perl. +PerlTQt handles internationalization by always converting B<TQString> back to B<utf8> in Perl. -Conversions from Perl strings to QStrings are made according to context : +Conversions from Perl strings to TQStrings are made according to context : =over 4 =item * If the Perl string is already utf8-encoded -then the string will be converted straight to QString. +then the string will be converted straight to TQString. This is the most convenient and seemless way of internationalizing your application. Typically, one would just enable the use of utf8 in source code with the C<use utf8> pragma and write its application with an utf8 aware editor. =item * If the string isn't tagged as utf8, and the B<use locale> pragma is not set -then the string will be converted to QString's utf8 from B<ISO-Latin-1>. +then the string will be converted to TQString's utf8 from B<ISO-Latin-1>. =item * If the string isn't tagged as utf8 and the B<use locale> pragma is set -then the string will be converted to QString's utf8 according to the currently set B<locale>. +then the string will be converted to TQString's utf8 according to the currently set B<locale>. =back Once a string contains utf8, you can convert it back to any locale by setting up B<converters> : - $tr1=Qt::TextCodec::codecForLocale(); # this one will use current locale - $tr2=Qt::TextCodec::codecForName("KOI8-R"); # that one forces a specific locale (Russian) + $tr1=TQt::TextCodec::codecForLocale(); # this one will use current locale + $tr2=TQt::TextCodec::codecForName("KOI8-R"); # that one forces a specific locale (Russian) - print $tr1->fromUnicode(Qt::DateTime::currentDateTime()->toString)."\n\n"; + print $tr1->fromUnicode(TQt::DateTime::currentDateTime()->toString)."\n\n"; print $tr2->fromUnicode($my_utf8_string); Or, with Perl >= 5.8.0, you may use Perl's B<Encode> modules (see C<perldoc Encode>). @@ -1023,20 +1023,20 @@ Or, with Perl >= 5.8.0, you may use Perl's B<Encode> modules (see C<perldoc Enco Developers who don't want to use UTF-8 or want to temporarily disable UTF-8 marshalling for handling legacy programs may use the B<use bytes> pragma (and the corresponding B<no bytes>). -Within the scope of this pragma, QStrings are marshalled back to ISO-Latin1 (default) or to your locale +Within the scope of this pragma, TQStrings are marshalled back to ISO-Latin1 (default) or to your locale (if B<use locale> has been set). Frivole use of this pragma is strongly discouraged as it ruins worldwide standardization efforts. =head1 Appendix 3 : Debugging Channels -The B<Qt::debug> module offers various debugging channels/features. +The B<TQt::debug> module offers various debugging channels/features. - use Qt::debug; + use TQt::debug; - use Qt::debug qw|calls autoload verbose|; + use TQt::debug qw|calls autoload verbose|; -With the simple C<use Qt::debug> statement, the B<verbose> and B<ambiguous> channels are activated. +With the simple C<use TQt::debug> statement, the B<verbose> and B<ambiguous> channels are activated. If you specify a list of channels within the use statement, then only the specified channels will be enabled. B<Available channels :> @@ -1056,33 +1056,33 @@ Together with B<ambiguous>, tell you the nearest matches in case a method or function call fails. e.g: - use Qt; - use Qt::debug; - $a= Qt::Application(\@ARGV); + use TQt; + use TQt::debug; + $a= TQt::Application(\@ARGV); $a->libraryPath("foo"); --- No method to call for : - QApplication::libraryPath('foo') + TQApplication::libraryPath('foo') Closer candidates are : - static void QApplication::addLibraryPath(const QString&) - static QStringList QApplication::libraryPaths() - static void QApplication::removeLibraryPath(const QString&) - static void QApplication::setLibraryPaths(const QStringList&) + static void TQApplication::addLibraryPath(const TQString&) + static TQStringList TQApplication::libraryPaths() + static void TQApplication::removeLibraryPath(const TQString&) + static void TQApplication::setLibraryPaths(const TQStringList&) =item * calls -For every call, tell what corresponding Qt method is called +For every call, tell what corresponding TQt method is called (detailing the arguments if B<verbose> is on). =item * autoload Track the intermediate code between a method invocation in Perl -and its resolution to either a Qt or Perl call. +and its resolution to either a TQt or Perl call. =item * gc Give informations about garbage collection -whenever a Qt object is deleted and/or a Perl object is destroyed +whenever a TQt object is deleted and/or a Perl object is destroyed =item * virtual @@ -1100,46 +1100,46 @@ Enable all channels A marshaller is a piece of "glue code" translating a given datatype to another. -Within PerlQt, most Qt objects keep their object nature, so that one may invoke methods on them. +Within PerlTQt, most TQt objects keep their object nature, so that one may invoke methods on them. However, some classes and datatypes map so naturally to some Perl types that keeping their object nature would would feel unnatural and clumsy. -For instance, instead of returning a Qt::StringList object, which would require an iterator to retrieve its content, -PerlQt will translate it to an array reference containing all the object's strings. +For instance, instead of returning a TQt::StringList object, which would require an iterator to retrieve its content, +PerlTQt will translate it to an array reference containing all the object's strings. -In the other way, instead of providing a Qt::StringList object as an argument of a method, one would simply +In the other way, instead of providing a TQt::StringList object as an argument of a method, one would simply provide the reference to an array of Perl strings. -Here is the list of Marshallers as of PerlQt-3.008 : +Here is the list of Marshallers as of PerlTQt-3.008 : ----------------------------------------------------------------- float, double <=> Perl real (NV) char, uchar, int, uint, enum long, ulong, short, ushort <=> Perl integer (IV) - QString, -&, -* => Perl string (utf8) - QString, -&, -* <= Perl string (utf8 or iso-latin1 or locale) - QCString, -&, -* <=> Perl string (utf8 or bytes, according to content or "bytes" pragma) - QByteArray, -&, -* <=> Perl string (bytes) - QStringList, -&, -* => Reference to an array of Perl strings (utf8) - QString, -&, -* => Perl string (utf8 or iso-latin1 or locale) + TQString, -&, -* => Perl string (utf8) + TQString, -&, -* <= Perl string (utf8 or iso-latin1 or locale) + TQCString, -&, -* <=> Perl string (utf8 or bytes, according to content or "bytes" pragma) + TQByteArray, -&, -* <=> Perl string (bytes) + TQStringList, -&, -* => Reference to an array of Perl strings (utf8) + TQString, -&, -* => Perl string (utf8 or iso-latin1 or locale) int&, -* <=> Perl integer (IV) bool&, -* <=> Perl boolean char* <=> Perl string (bytes) char** <= Reference to an array of Perl strings (bytes) uchar* <= Perl string (bytes) - QRgb* <= Reference to an array of Perl integers (IV) - QCOORD* <= Reference to an array of Perl integers (IV) + TQRgb* <= Reference to an array of Perl integers (IV) + TQCOORD* <= Reference to an array of Perl integers (IV) void* <=> Reference to a Perl integer (IV) - QValueList<int>, - *, - & <=> Reference to an array of Perl integers (IV) - QCanvasItemList, - *, - & => Reference to an array of Qt::CanvasItem - QWidgetList, - *, - & <=> Reference to an array of Qt::Widget - QObjectList, - *, - & <=> Reference to an array of Qt::Object - QFileInfoList, - *, - & <=> Reference to an array of Qt::FileInfo - QPtrList<QTab>, - *, - & <=> Reference to an array of Qt::Tab - QPtrList<QToolBar>, - *, - & <=> Reference to an array of Qt::ToolBar - QPtrList<QNetworkOperation>, - *, - & <=> Reference to an array of Qt::NetworkOperation - QPtrList<QDockWindow>, - *, - & <=> Reference to an array of Qt::DockWindow - (QUObject*) + TQValueList<int>, - *, - & <=> Reference to an array of Perl integers (IV) + TQCanvasItemList, - *, - & => Reference to an array of TQt::CanvasItem + TQWidgetList, - *, - & <=> Reference to an array of TQt::Widget + TQObjectList, - *, - & <=> Reference to an array of TQt::Object + TQFileInfoList, - *, - & <=> Reference to an array of TQt::FileInfo + TQPtrList<TQTab>, - *, - & <=> Reference to an array of TQt::Tab + TQPtrList<TQToolBar>, - *, - & <=> Reference to an array of TQt::ToolBar + TQPtrList<TQNetworkOperation>, - *, - & <=> Reference to an array of TQt::NetworkOperation + TQPtrList<TQDockWindow>, - *, - & <=> Reference to an array of TQt::DockWindow + (TQUObject*) diff --git a/doc/en/index.html b/doc/en/index.html index 6a4cc7b..4386c5d 100644 --- a/doc/en/index.html +++ b/doc/en/index.html @@ -1,7 +1,7 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> -<title>Programming PerlQt</title> +<title>Programming PerlTQt</title> <link rel="stylesheet" href="../css/pod.css" type="text/css" /> <link rev="made" href="mailto:root@localhost" /> </head> @@ -13,7 +13,7 @@ <ul> - <li><a href="#programming_perlqt">Programming PerlQt</a></li> + <li><a href="#programming_perlqt">Programming PerlTQt</a></li> <li><a href="#introduction">Introduction</a></li> <li><a href="#installation">Installation</a></li> <ul> @@ -21,10 +21,10 @@ <li><a href="#requirements">Requirements</a></li> <li><a href="#compilation">Compilation</a></li> <li><a href="#troubleshooting_and_configure_options">Troubleshooting and Configure Options</a></li> - <li><a href="#how_to_install_perlqt_with_user_rights">How to install PerlQt with user rights</a></li> + <li><a href="#how_to_install_perlqt_with_user_rights">How to install PerlTQt with user rights</a></li> </ul> - <li><a href="#anatomy_of_perlqt">Anatomy of PerlQt</a></li> + <li><a href="#anatomy_of_perlqt">Anatomy of PerlTQt</a></li> <ul> <li><a href="#hello_world">Hello World</a></li> @@ -38,7 +38,7 @@ <li><a href="#signals_and_slots">Signals and Slots</a></li> </ul> - <li><a href="#rad_prototyping_with_qt_designer_and_puic">RAD prototyping with Qt Designer and Puic</a></li> + <li><a href="#rad_prototyping_with_qt_designer_and_puic">RAD prototyping with TQt Designer and Puic</a></li> <ul> <li><a href="#introduction">Introduction</a></li> @@ -74,29 +74,29 @@ <hr /> <p> </p> -<h1><a name="programming_perlqt">Programming PerlQt</a></h1> +<h1><a name="programming_perlqt">Programming PerlTQt</a></h1> <p><strong>Germain Garand</strong></p> -<p>This document describes a set of Perl bindings for the Qt toolkit. Contact +<p>This document describes a set of Perl bindings for the TQt toolkit. Contact the author at <<a href="mailto:germain@ebooksfrance.com">germain@ebooksfrance.com</a>></p> <p> </p> <hr /> <h1><a name="introduction">Introduction</a></h1> -<p>PerlQt-3 is Ashley Winters' full featured object oriented interface to -<a href="http://www.trolltech.com">Trolltech</a>'s C++ Qt toolkit v3.0.</p> +<p>PerlTQt-3 is Ashley Winters' full featured object oriented interface to +<a href="http://www.trolltech.com">Trolltech</a>'s C++ TQt toolkit v3.0.</p> <p>It is based on the <a href="http://webcvs.kde.org/cgi-bin/cvsweb.cgi/kdebindings/smoke">SMOKE</a> -library, a language independent low-level wrapper generated from Qt headers by +library, a language independent low-level wrapper generated from TQt headers by Richard Dale's <a href="http://webcvs.kde.org/cgi-bin/cvsweb.cgi/kdebindings/kalyptus">kalyptus</a> thanks to David Faure's module.</p> -<p>This document describes the principles of PerlQt programming. +<p>This document describes the principles of PerlTQt programming. It assumes you have some basic Perl Object Oriented programming knowledge.</p> <p>Some C++ knowledge is recommended but not required. -It would mostly help you to find your way through <a href="http://doc.trolltech.com">Qt's excellent documentation</a> which is our +It would mostly help you to find your way through <a href="http://doc.trolltech.com">TQt's excellent documentation</a> which is our ultimate and only reference. -If Qt is installed on your system, then you most probably -also have its documentation. Try the <code>$QTDIR/bin/assistant</code> program.</p> +If TQt is installed on your system, then you most probably +also have its documentation. Try the <code>$TQTDIR/bin/assistant</code> program.</p> <p> </p> <hr /> @@ -104,7 +104,7 @@ also have its documentation. Try the <code>$QTDIR/bin/assistant</code> program.< <p> </p> <h2><a name="requirements">Requirements</a></h2> -<p>To compile and use PerlQt, you'll need :</p> +<p>To compile and use PerlTQt, you'll need :</p> <ul> <li></li> a POSIX system @@ -116,21 +116,21 @@ GNU tools : automake(>=1.5), autoconf (>=2.13), aclocal... <a href="http://www.perl.org">Perl >= v5.6.0</a> <p></p> <li></li> -<a href="http://www.trolltech.com/developer/download/qtx11.html">Qt >= v3.0</a> +<a href="http://www.trolltech.com/developer/download/qtx11.html">TQt >= v3.0</a> <p></p> <li></li> -<a href="http://webcvs.kde.org/cgi-bin/cvsweb.cgi/kdebindings/smoke">SmokeQt 1.2.1</a> +<a href="http://webcvs.kde.org/cgi-bin/cvsweb.cgi/kdebindings/smoke">SmokeTQt 1.2.1</a> The SMOKE library (Scripting Meta Object Kompiler) is part of <a href="http://www.kde.org">KDE</a>'s <strong>kdebindings</strong> module. You may want to check if a precompiled version of this module exists for your system. -PerlQt is packaged with its own copy, so you don't need to check it out. +PerlTQt is packaged with its own copy, so you don't need to check it out. <p></p></ul> -<p>Perl and Qt's installation is out of the scope of this document. Please refer +<p>Perl and TQt's installation is out of the scope of this document. Please refer to those projects' documentation.</p> <p> </p> <h2><a name="compilation">Compilation</a></h2> -<p>PerlQt uses GNU's Autoconf framework. However, the standard ./configure script is preferably driven +<p>PerlTQt uses GNU's Autoconf framework. However, the standard ./configure script is preferably driven by the Makefile.PL wrapper. All options are forwarded to ./configure :</p> <pre> perl Makefile.PL</pre> @@ -140,7 +140,7 @@ Then :</p> make</pre> <pre> make install</pre> -<p>This will install PerlQt, Puic and Smoke (if needed), as well as the pqtsh and pqtapi utilities.</p> +<p>This will install PerlTQt, Puic and Smoke (if needed), as well as the pqtsh and pqtapi utilities.</p> <p>The preferred install location for SMOKE and Puic is in the KDE3 file system. If you don't have KDE3 installed, specify a location with <code>configure</code>'s <code>--prefix</code> option. e.g:</p> @@ -149,12 +149,12 @@ If you don't have KDE3 installed, specify a location with <code>configure</code> <p> </p> <h2><a name="troubleshooting_and_configure_options">Troubleshooting and Configure Options</a></h2> -<p>If Smoke's linking fails or your Qt library was built with very specific +<p>If Smoke's linking fails or your TQt library was built with very specific options, run Makefile.PL again with:</p> <pre> perl Makefile.PL --with-threshold=0</pre> <p>When building smoke, configure will check for OpenGL and try to compile -support for it if it is properly installed and supported by Qt.</p> +support for it if it is properly installed and supported by TQt.</p> <p>You may disable this checking with:</p> <pre> --disable-GL</pre> @@ -166,8 +166,8 @@ it, specify:</p> --without-Mesa</pre> <p> </p> -<h2><a name="how_to_install_perlqt_with_user_rights">How to install PerlQt with user rights</a></h2> -<p>To install PerlQt without super-user rights, simply follow this procedure:</p> +<h2><a name="how_to_install_perlqt_with_user_rights">How to install PerlTQt with user rights</a></h2> +<p>To install PerlTQt without super-user rights, simply follow this procedure:</p> <ul> <li></li> Perform a normal configuration, specifying as prefix a directory where you have write permissions : @@ -178,10 +178,10 @@ Perform a normal configuration, specifying as prefix a directory where you have <li></li> Reconfigure the Perl module so that it doesn't target the standard perl hierarchy: <pre> - cd PerlQt + cd PerlTQt perl Makefile.PL PREFIX=~ cd ..</pre> -<p>Beware : this is not the same Makefile.PL as above, but the one located in the ./PerlQt +<p>Beware : this is not the same Makefile.PL as above, but the one located in the ./PerlTQt subdirectory</p> <p></p> <li></li> @@ -200,8 +200,8 @@ This can be done either on the command line:</p> <p> </p> <hr /> -<h1><a name="anatomy_of_perlqt">Anatomy of PerlQt</a></h1> -<p>A typical Qt program using GUI components is based on an event loop.</p> +<h1><a name="anatomy_of_perlqt">Anatomy of PerlTQt</a></h1> +<p>A typical TQt program using GUI components is based on an event loop.</p> <p>This basically means that such a program is no more envisioned as a straight flow where you would need to handle yourself every single events (such as a mouse click or a key press).</p> @@ -210,29 +210,29 @@ uses, define what objects methods need to be called when an event occurs, and then start the main event loop.</p> <p>That's all! -Qt will handle all events and dispatch them to the correct subroutine.</p> -<p>Lets see how this process is implemented in a minimal PerlQt program.</p> +TQt will handle all events and dispatch them to the correct subroutine.</p> +<p>Lets see how this process is implemented in a minimal PerlTQt program.</p> <p> </p> <h2><a name="hello_world">Hello World</a></h2> <pre> - 1: use Qt; - 2: my $a = Qt::Application(\@ARGV); - 3: my $hello = Qt::PushButton("Hello World!", undef); + 1: use TQt; + 2: my $a = TQt::Application(\@ARGV); + 3: my $hello = TQt::PushButton("Hello World!", undef); 4: $hello->resize(160, 25); 5: $a->setMainWidget($hello); 6: $hello->show; 7: exit $a->exec;</pre> <br/> -<div class='image'><img src="../images/ex1.png"/></div><p>This program first loads the Qt interface [line 1] and creates the application +<div class='image'><img src="../images/ex1.png"/></div><p>This program first loads the TQt interface [line 1] and creates the application object, passing it a reference to the command line arguments array <code>@ARGV</code> [l.2]. This application object is unique, and may later be accessed from -anywhere through the <strong>Qt::app()</strong> pointer.</p> +anywhere through the <strong>TQt::app()</strong> pointer.</p> <p>At line 3, we create a PushButton, which has no parent (i.e : it won't be contained nor owned by another widget). Therefore, we pass to the constructor an <strong>undef</strong> value for the parent argument, -which is PerlQt's way of passing a Null pointer.</p> +which is PerlTQt's way of passing a Null pointer.</p> <p>After some layouting at [l.4], we tell the application object that our main widget is this PushButton [l.5]... that way, it will know that closing the window associated with this widget means : <em>quit the application</em>.</p> @@ -242,39 +242,39 @@ to start the application loop [l.7].</p> <p><strong>Syntax elements summary :</strong></p> <ol> <li></li> -All Qt classes are accessed through the prefix <strong>Qt::</strong>, which replaces the -initial <strong>Q</strong> of Qt classes. -When browsing the <a href="http://doc.trolltech.com">Qt documentation</a>, you simply need to change the -name of classes so that <strong>QFoo</strong> reads <strong>Qt::Foo</strong>. +All TQt classes are accessed through the prefix <strong>TQt::</strong>, which replaces the +initial <strong>Q</strong> of TQt classes. +When browsing the <a href="http://doc.trolltech.com">TQt documentation</a>, you simply need to change the +name of classes so that <strong>TQFoo</strong> reads <strong>TQt::Foo</strong>. <p></p> <li></li> An object is created by calling the <strong>constructor</strong> of the class. It has the same name as the class itself. -<p>You don't need to say <code>new Qt::Foo</code> or <code>Qt::Foo->new()</code> as most Perl +<p>You don't need to say <code>new TQt::Foo</code> or <code>TQt::Foo->new()</code> as most Perl programmers would have expected.</p> <p>Instead, you just say :</p> <pre> - my $object = Qt::<classname>(arg_1, ..., arg_n);</pre> + my $object = TQt::<classname>(arg_1, ..., arg_n);</pre> <p>If you don't need to pass any argument to the constructor, simply say :</p> <pre> - my $object = Qt::<classname>;</pre> + my $object = TQt::<classname>;</pre> <p></p> <li></li> Whenever you need to pass a Null pointer as an argument, use Perl's <strong>undef</strong> keyword. Do not pass zero. - Beware: this is by far the most common error in PerlQt programs. + Beware: this is by far the most common error in PerlTQt programs. <p>Pointers are arguments preceded by an <strong>*</strong> -character in Qt's documentation (e.g: ``<code>QWidget * widget</code>'').</p> +character in TQt's documentation (e.g: ``<code>TQWidget * widget</code>'').</p> <p></p></ol> <p> </p> <h2><a name="inheritance_and_objects">Inheritance and Objects</a></h2> -<p>Before we can discuss how Perl subroutines can be called back from Qt, we need -to introduce PerlQt's inheritance mechanism.</p> -<p>PerlQt was designed to couple as tightly as possible Qt's simplicity and Perl's +<p>Before we can discuss how Perl subroutines can be called back from TQt, we need +to introduce PerlTQt's inheritance mechanism.</p> +<p>PerlTQt was designed to couple as tightly as possible TQt's simplicity and Perl's power and flexibility.</p> <p>In order to achieve that goal, the classical Object Oriented Perl paradigm had -to be extended, much in the same way than Qt itself +to be extended, much in the same way than TQt itself had to extend C++'s paradigm with <strong>metaobjects</strong>.</p> <p> </p> @@ -285,8 +285,8 @@ of PushButton:</p> 1: use strict; 2: 3: package Button; - 4: use Qt; - 5: use Qt::isa qw(Qt::PushButton); + 4: use TQt; + 5: use TQt::isa qw(TQt::PushButton); 6: 7: sub NEW 8: { @@ -298,25 +298,25 @@ of PushButton:</p> 14: 15: package main; 16: - 17: use Qt; + 17: use TQt; 18: use Button; 19: - 20: my $a = Qt::Application(\@ARGV); + 20: my $a = TQt::Application(\@ARGV); 21: my $w = Button("Hello World!", undef); 22: $a->setMainWidget($w); 23: $w->show; 24: exit $a->exec;</pre> <p>Here, we want to create our own version of the PushButton widget. -Therefore, we create a new package for it [l.3] and import Qt [l.4].</p> +Therefore, we create a new package for it [l.3] and import TQt [l.4].</p> <p>We now want to declare our widget as subclassing PushButton. -This is done through the use of the <code>Qt::isa</code> pragma [l.5], which accepts a -list of one or more parent Qt classes.</p> +This is done through the use of the <code>TQt::isa</code> pragma [l.5], which accepts a +list of one or more parent TQt classes.</p> <p>It is now time to create a <strong>constructor</strong> for our new widget. This is done by creating a subroutine called <strong>NEW</strong> <em>(note the capitalized -form, which differentate it from the usual ``new'' constructor. PerlQt's NEW +form, which differentate it from the usual ``new'' constructor. PerlTQt's NEW constructor is called </em><strong>implicitly</strong><em> as can be seen on line 21)</em>.</p> <p>Since we want our widget to call its parent's constructor first, we call the -<strong>superclass's constructor</strong> (here: Qt::PushButton) on line 9, passing it all +<strong>superclass's constructor</strong> (here: TQt::PushButton) on line 9, passing it all arguments we received.</p> <p>At this time, a class instance has been created and stored into a special object holder named <strong>this</strong> (not <code>$this</code> but really just <code>this</code>).</p> @@ -328,7 +328,7 @@ indifferently say <code>method()</code> or <code>this->method()</code>;</p> <p>When building a new composite widget, you may just create its different parts inside <strong>my</strong> variables, since widgets are only deleted by their parents and not necessarily when their container goes out of scope.</p> -<p>In other words, PerlQt performs clever reference counting to prevent +<p>In other words, PerlTQt performs clever reference counting to prevent indesirable deletion of objects.</p> <p>Now, you'll often want to keep an access to those parts from anywhere inside your package. @@ -337,15 +337,15 @@ but that isn't really convenient and you don't have any compile time checking...</p> <p>Here come <strong>Attributes</strong>. Attributes are data holders where you can store any kind of properties for your object.</p> -<p>Declaring new attributes is done through the <code>use Qt::attributes</code> pragma, as is +<p>Declaring new attributes is done through the <code>use TQt::attributes</code> pragma, as is demonstrated in the following package implementation :</p> <pre> 1: use strict; 2: 3: package Button; - 4: use Qt; - 5: use Qt::isa qw(Qt::PushButton); - 6: use Qt::attributes qw( + 4: use TQt; + 5: use TQt::isa qw(TQt::PushButton); + 6: use TQt::attributes qw( 7: itsTime 8: pData 9: ); @@ -353,7 +353,7 @@ demonstrated in the following package implementation :</p> 11: sub NEW 12: { 13: shift->SUPER::NEW(@_[0..2]); - 14: itsTime = Qt::Time; + 14: itsTime = TQt::Time; 15: itsTime->start; 16: pData = " Foo "; 17: } @@ -366,7 +366,7 @@ demonstrated in the following package implementation :</p> 24: 25: 1;</pre> <br/> -<div class='image'><img src="../images/ex2.png"/></div><p>An attribute itsTime is declared at line 7, and loaded with a <code>Qt::Time</code> object +<div class='image'><img src="../images/ex2.png"/></div><p>An attribute itsTime is declared at line 7, and loaded with a <code>TQt::Time</code> object at line 14.</p> <p>Since we reimplement the virtual function ``resizeEvent'' [l.19]. each time the main widget is resized, this function will be triggered and @@ -375,13 +375,13 @@ attributes we defined [l.22].</p> <p><strong>Recapitulation</strong></p> <ul> <li></li> -In order to inherit a Qt class, a package must contain a -<code>use Qt::isa</code> pragma. +In order to inherit a TQt class, a package must contain a +<code>use TQt::isa</code> pragma. e.g: <pre> - use Qt::isa "Qt::widget";</pre> + use TQt::isa "TQt::widget";</pre> <p></p> <li></li> The object constructor is named <strong>NEW</strong> and is implicitly called. @@ -432,7 +432,7 @@ you'd use the specal attribute SUPER :</p> Whenever you need to store a contained object in your package, you may define it as an <strong>Attribute</strong> : <pre> - use Qt::attributes qw( + use TQt::attributes qw( firstAttribute ... lastAttribute);</pre> @@ -444,18 +444,18 @@ as an <strong>Attribute</strong> : <li></li> To reimplement a <strong>virtual function</strong>, simply create a <strong>sub</strong> with the same name in your object. -<p>Existing virtual functions are marked as such in Qt's documentation +<p>Existing virtual functions are marked as such in TQt's documentation (they are prefixed with the ``virtual'' keyword).</p> -<p>You can inspect what virtual function names are being called by Qt at runtime by -putting a <code>use Qt::debug qw( virtual )</code> statement at the top of your program.</p> +<p>You can inspect what virtual function names are being called by TQt at runtime by +putting a <code>use TQt::debug qw( virtual )</code> statement at the top of your program.</p> <p></p></ul> <p> </p> <h2><a name="signals_and_slots">Signals and Slots</a></h2> -<p>We'll now learn how Qt objects can communicate with each other, +<p>We'll now learn how TQt objects can communicate with each other, allowing an event occuring, for instance, in a given widget to trigger the execution of one or several subroutines anywhere inside your program.</p> -<p>Most other toolkits use callbacks for that purpose, but Qt has a much more +<p>Most other toolkits use callbacks for that purpose, but TQt has a much more powerful and flexible mechanism called <strong>Signals and Slots</strong>.</p> <p>Signals and slots are used for communication between objects.</p> <p>This can be thought off as something similar to the wiring between several Hi-fI @@ -464,18 +464,18 @@ emitted wether a listening device is connected to them or not. Also, a tape recorder deck can start to record when it receives a signal wired to it's input slot, and it doesn't need to know that this signal is also received by a CD recorder device, or listened through headphones.</p> -<p>A Qt component behaves just like that. It has several output <strong>Signals</strong> and +<p>A TQt component behaves just like that. It has several output <strong>Signals</strong> and several input <strong>Slots</strong> - and each signal can be connected to an unlimited number of listening slots of the same type, wether they are inside or outside the component.</p> <p>The general syntax of this connection process is either :</p> -<p>Qt::Object::connect( sender, SIGNAL 'mysignal(arg_type)', -receiver, SLOT 'myslot(arg_type)');</p> +<p>TQt::Object::connect( sender, TQT_SIGNAL 'mysignal(arg_type)', +receiver, TQT_SLOT 'myslot(arg_type)');</p> <p>or</p> -<p>myObject->connect( sender, SIGNAL 'mysignal(arg_type)', SLOT +<p>myObject->connect( sender, TQT_SIGNAL 'mysignal(arg_type)', TQT_SLOT 'myslot(arg_type)');</p> <p>This mechanism can be extended at will by the declaration of custom Signals and -Slots, through the <code>use Qt::signals</code> and <code>use Qt::slots</code> pragma +Slots, through the <code>use TQt::signals</code> and <code>use TQt::slots</code> pragma (see also the other syntax, later on).</p> <p>Each declared slot will call the corresponding subroutine in your object, each declared signal can be raised through the <strong>emit</strong> keyword.</p> @@ -484,22 +484,22 @@ each declared signal can be raised through the <strong>emit</strong> keyword.</p 1: use strict; 2: 3: package Button; - 4: use Qt; - 5: use Qt::isa qw(Qt::PushButton); - 6: use Qt::attributes qw(itsTime); - 7: use Qt::slots + 4: use TQt; + 5: use TQt::isa qw(TQt::PushButton); + 6: use TQt::attributes qw(itsTime); + 7: use TQt::slots 8: wasClicked => [], 9: change => ['int', 'int']; - 10: use Qt::signals + 10: use TQt::signals 11: changeIt => ['int', 'int']; 12: 13: sub NEW 14: { 15: shift->SUPER::NEW(@_[0..2]); - 16: itsTime = Qt::Time; + 16: itsTime = TQt::Time; 17: itsTime->start; - 18: this->connect(this, SIGNAL 'clicked()', SLOT 'wasClicked()'); - 19: this->connect(this, SIGNAL 'changeIt(int,int)', SLOT 'change(int,int)'); + 18: this->connect(this, TQT_SIGNAL 'clicked()', TQT_SLOT 'wasClicked()'); + 19: this->connect(this, TQT_SIGNAL 'changeIt(int,int)', TQT_SLOT 'change(int,int)'); 20: } 21: 22: sub wasClicked @@ -518,7 +518,7 @@ each declared signal can be raised through the <strong>emit</strong> keyword.</p 35: 36: 1;</pre> <p>In this package, we define two extra slots and one extra signal.</p> -<p>We know from the Qt Documentation that a clicked PushButton emits a <code>clicked()</code> +<p>We know from the TQt Documentation that a clicked PushButton emits a <code>clicked()</code> signal, so we connect it to our new slot at line 18.</p> <p>We also connect our signal <code>changeIt</code> to our own <code>change</code> slot- which is quite stupid, but as an example.</p> @@ -526,9 +526,9 @@ quite stupid, but as an example.</p> triggers the <code>wasClicked()</code> slot. <code>wasClicked</code> then proceeds to emit the <code>changeIt(int,int)</code> signal [l.27], hence triggering the <code>change(int,int)</code> slot with two arguments.</p> -<p>Finally, since PerlQt-3.008, an alternative syntax can be used to declare Signals and Slots:</p> +<p>Finally, since PerlTQt-3.008, an alternative syntax can be used to declare Signals and Slots:</p> <pre> - sub a_slot : SLOT(int, QString) + sub a_slot : TQT_SLOT(int, TQString) { $int = shift; $string = shift; @@ -536,40 +536,40 @@ slot with two arguments.</p> }</pre> <p>and</p> <pre> - sub a_signal : SIGNAL(QString);</pre> + sub a_signal : TQT_SIGNAL(TQString);</pre> <p>This syntax is perfectly compatible with the traditional -<code>use Qt::signals</code> and <code>use Qt::slots</code> declarations.</p> +<code>use TQt::signals</code> and <code>use TQt::slots</code> declarations.</p> <p>Eventually, it can prove good programming practice to mix both syntaxes, by first declaring -Signals/Slots with <code>use Qt::slots/signals</code>, then repeat this declaration +Signals/Slots with <code>use TQt::slots/signals</code>, then repeat this declaration in the actual implementation with the second syntax.</p> <p>Declarations will be checked for consistency at compile time, and any mismatch in arguments would trigger a warning.</p> <p> </p> <hr /> -<h1><a name="rad_prototyping_with_qt_designer_and_puic">RAD prototyping with Qt Designer and Puic</a></h1> +<h1><a name="rad_prototyping_with_qt_designer_and_puic">RAD prototyping with TQt Designer and Puic</a></h1> <p> </p> <h2><a name="introduction">Introduction</a></h2> <ul> <li><strong><a name="item_note%3a">Note:</a></strong><br /> </li> -As of PerlQt-3.008, a separate PerlQt plugin for Qt Designer is available, -bringing full integration, syntax highlighting, code completion and allowing to run/debug your PerlQt project +As of PerlTQt-3.008, a separate PerlTQt plugin for TQt Designer is available, +bringing full integration, syntax highlighting, code completion and allowing to run/debug your PerlTQt project entirely from the Designer GUI. Nevertheless, the below is still accurate with regard to puic command line interaction -and with regard to using Qt Designer <em>without</em> the specific plugin. +and with regard to using TQt Designer <em>without</em> the specific plugin. <p></p></ul> -<p>As efficient and intuitive as Qt can be, building a complete GUI from scratch +<p>As efficient and intuitive as TQt can be, building a complete GUI from scratch is often a tedious task.</p> -<p>Hopefully, Qt comes with a very sophisticated GUI Builder named Qt +<p>Hopefully, TQt comes with a very sophisticated GUI Builder named TQt Designer, which is close to a complete integrated development environment. It features Project management, drag'n drop GUI building, a complete object browser, graphical interconnection of signals and slots, and much much more.</p> -<p>Qt Designer's output is XML which can be parsed by several command line tools, -among whose is <strong>puic</strong> (the PerlQt User Interface Compiler).</p> +<p>TQt Designer's output is XML which can be parsed by several command line tools, +among whose is <strong>puic</strong> (the PerlTQt User Interface Compiler).</p> <p>Assuming you have already built an interface file with the Designer, -translating it to a PerlQt program is simply a matter of issuing +translating it to a PerlTQt program is simply a matter of issuing one command :</p> <pre> puic -x -o program.pl program.ui</pre> @@ -589,7 +589,7 @@ program.</p> <li><strong><a name="item_inline_embedding">Inline embedding</a></strong><br /> </li> For this, you need to check the ``Edit->Form Settings->Pixmaps->Save inline'' -checkbox inside Qt Designer. +checkbox inside TQt Designer. Then : puic -x -o <em>program.pl</em> <em>program.ui</em> <p></p> <li><strong><a name="item_image_collection">Image Collection</a></strong><br /> @@ -597,7 +597,7 @@ Then : puic -x -o <em>program.pl</em> <em>program.ui</em> This option is more complex but also far more powerful and clean. <p>puic -o <em>Collection.pm</em> -embed <em>unique_identifier</em> <em>image-1</em> ... <em>image-n</em></p> <p>Then add a <code>use Collection.pm</code> statement to your program's main package.</p> -<p>If you've created a project file in Qt Designer, and added all images +<p>If you've created a project file in TQt Designer, and added all images you want to group (through ``Project->Image Collection''), you'll find all those images inside the directory where your project file (*.pro) is stored, under /images. @@ -619,7 +619,7 @@ up doing lot of copy-paste.</p> <ul> <li><strong><a name="item_write_slots_implementation_in_the_designer">Write slots implementation in the Designer</a></strong><br /> </li> -In Qt Designer, select the <em>Source</em> tab of the <strong>Object Explorer</strong>. +In TQt Designer, select the <em>Source</em> tab of the <strong>Object Explorer</strong>. There you can see a tree-like representation of your classes. Now if you double-click on the <em>Slots/public</em> entry, you are prompted with a dialog where you can create a new custom slot for @@ -682,8 +682,8 @@ parent module, and your child will inherit those changes.</p> </p> <hr /> <h1><a name="more_development_tools">More development tools</a></h1> -<p>PerlQt comes bundled with two simple programs that can help you to find your way through -the Qt API:</p> +<p>PerlTQt comes bundled with two simple programs that can help you to find your way through +the TQt API:</p> <p> </p> <h2><a name="pqtapi">pqtapi</a></h2> @@ -694,13 +694,13 @@ the Qt API:</p> options: -r <re> : find all functions matching regular expression/keyword <re> -i : together with -r, performs a case insensitive search - -v : print PerlQt and Qt versions + -v : print PerlTQt and TQt versions -h : print this help message</pre> <p>e.g:</p> <pre> $>pqtapi -ir 'setpoint.* int' - void QCanvasLine::setPoints(int, int, int, int) - void QPointArray::setPoint(uint, int, int)</pre> + void TQCanvasLine::setPoints(int, int, int, int) + void TQPointArray::setPoint(uint, int, int)</pre> <p> </p> <h2><a name="pqtsh">pqtsh</a></h2> @@ -716,7 +716,7 @@ It is fairly self explanatory and includes an interactive example (<code>Help-&g </p> <hr /> <h1><a name="credits">Credits</a></h1> -<p>PerlQt-3 is (c) 2002 Ashley Winters (and (c) 2003 Germain Garand)</p> +<p>PerlTQt-3 is (c) 2002 Ashley Winters (and (c) 2003 Germain Garand)</p> <p>Kalyptus and the Smoke generation engine are (c) David Faure and Richard Dale</p> <p>Puic is (c) TrollTech AS., Phil Thompson and Germain Garand,</p> <p>The mentioned software is released under the GNU Public Licence v.2 or later.</p> @@ -724,31 +724,31 @@ It is fairly self explanatory and includes an interactive example (<code>Help-&g </p> <hr /> <h1><a name="appendix_1_:_c++_conventions_and_their_perl_counterpart">Appendix 1 : C++ conventions and their Perl counterpart</a></h1> -<p>Whenever you want to use a class/method described in Qt's -<a href="http://doc.trolltech.com">documentation</a> (see also the 'assistant' program bundled with Qt) -from PerlQt, you need to follow some simple translation rules.</p> +<p>Whenever you want to use a class/method described in TQt's +<a href="http://doc.trolltech.com">documentation</a> (see also the 'assistant' program bundled with TQt) +from PerlTQt, you need to follow some simple translation rules.</p> <dl> <dt><strong><a name="item_classnames">Classnames</a></strong><br /> </dt> <ul> <li></li> -All classnames are changed from a <strong>Q</strong> prefix in Qt to a <strong>Qt::</strong> prefix +All classnames are changed from a <strong>Q</strong> prefix in TQt to a <strong>TQt::</strong> prefix in Perl. -e.g: QComboBox is named Qt::ComboBox within PerlQt. +e.g: TQComboBox is named TQt::ComboBox within PerlTQt. <p></p></ul> <dt><strong><a name="item_functions">Functions</a></strong><br /> </dt> <ul> <li></li> Functions referenced as <strong>static</strong> are accessed directly, and not through -an object. Thus the static function Foo in class QBar would be accessed from -PerlQt as +an object. Thus the static function Foo in class TQBar would be accessed from +PerlTQt as <pre> - Qt::Bar::Foo( arg-1,...,arg-n);</pre> + TQt::Bar::Foo( arg-1,...,arg-n);</pre> <p>The only notable exceptions are :</p> <pre> - qApp() will map to Qt::app() - qVersion() will map to Qt::version() # not really needed anymore: we have qVersion(). See Global Functions below.</pre> + qApp() will map to TQt::app() + qVersion() will map to TQt::version() # not really needed anymore: we have qVersion(). See Global Functions below.</pre> <p></p> <li></li> Functions referenced as <strong>members</strong> or <strong>Signals</strong> are accessed through an object @@ -756,7 +756,7 @@ with the <strong>-></strong> operator. e.g: <pre> $widget->show;</pre> -<p>There are no fundamental differences between methods and signals, however PerlQt +<p>There are no fundamental differences between methods and signals, however PerlTQt provides the <strong>emit</strong> keyword as a convenient mnemonic, so that it is clear you are emitting a signal :</p> <pre> @@ -768,14 +768,14 @@ are emitting a signal :</p> <li><strong><a name="item_by_value">By value</a></strong><br /> </li> When an argument isn't preceded by the <strong>&</strong> or <strong>*</strong> character, it is passed by -value. For all basic types such as int, char, float and double, PerlQt will +value. For all basic types such as int, char, float and double, PerlTQt will automatically convert litteral and scalar values to the corresponding C++ type. <p>Thus for a constructor prototype written as follow in the documentation :</p> <pre> - QSize ( int w, int h )</pre> + TQSize ( int w, int h )</pre> <p>You'd say :</p> <pre> - Qt::Size(8, 12);</pre> + TQt::Size(8, 12);</pre> <p></p> <li><strong><a name="item_by_reference">By reference</a></strong><br /> </li> @@ -783,12 +783,12 @@ When an argument is preceded by the <strong>&</strong> character, it means a object or to a type is expected. You may either provide a variable name or a temporary object : <pre> - $keyseq = Qt::keySequence( &Qt::CTRL + &Qt::F3 ); + $keyseq = TQt::keySequence( &TQt::CTRL + &TQt::F3 ); $widget->setAccel( $keyseq ); or</pre> <pre> - $widget->setAccel(Qt::keySequence( &Qt::CTRL + &Qt::F3 );</pre> + $widget->setAccel(TQt::keySequence( &TQt::CTRL + &TQt::F3 );</pre> <p>If the argument isn't qualified as <strong>const</strong> (constant), it means the passed object may be altered during the process - you must then provide a variable.</p> <p></p> @@ -819,7 +819,7 @@ remember otherwise. and 2).</p> </dd> <dd> -<p>Access to enumerations values in Perl Qt is very similar to a static function +<p>Access to enumerations values in Perl TQt is very similar to a static function call. In fact, it <strong>is</strong> a static function call.</p> </dd> <dd> @@ -830,22 +830,22 @@ recommend the use of the alternate function call syntax : <code>&function</c <p>Lets now go back to our <code>Strange</code> example.</p> </dd> <dd> -<p>If its definition was encountered in the class <code>QFruits</code>, you'd write from -PerlQt :</p> +<p>If its definition was encountered in the class <code>TQFruits</code>, you'd write from +PerlTQt :</p> </dd> <dd> <pre> - $apple_plus_orange = &Qt::Fruit::Apple + &Qt::Fruit::Orange;</pre> + $apple_plus_orange = &TQt::Fruit::Apple + &TQt::Fruit::Orange;</pre> </dd> <p></p> <dt><strong><a name="item_operators">Operators</a></strong><br /> </dt> <dd> -Within PerlQt, <strong>operators overloading</strong> works transparently. -If a given operator is overloaded in a Qt class (which means using it triggers a custom method) -it will behave identically in PerlQt. +Within PerlTQt, <strong>operators overloading</strong> works transparently. +If a given operator is overloaded in a TQt class (which means using it triggers a custom method) +it will behave identically in PerlTQt. Beware though that due to limitations of the Smoke binding library, not all overloaded operators are -available in PerlQt. +available in PerlTQt. You can check the availability of a given operator by using the pqtapi program. Also, due to outstanding differences between C++'s and Perl's object paradigm, the copy constructor operator (a.k.a '=') has been disabled. @@ -855,62 +855,62 @@ has been disabled. </dd> <dd> <pre> - $p1 = Qt::Point(10, 10) - $p2 = Qt::Point(30,40) + $p1 = TQt::Point(10, 10) + $p2 = TQt::Point(30,40) $p2 += $p1; # $p2 becomes (40,50) e.g-2: '<<' overload</pre> </dd> <dd> <pre> - $f = Qt::File("example"); + $f = TQt::File("example"); $f->open( IO_WriteOnly ); # see 'Constants' below - $s = Qt::TextStream( $f ); + $s = TQt::TextStream( $f ); $s << "What can I do with " << 12 << " apples?";</pre> </dd> <p></p> <dt><strong><a name="item_constants">Constants</a></strong><br /> </dt> <dd> -Qt doesn't use many constants, but there is at least one place where they are used : for setting +TQt doesn't use many constants, but there is at least one place where they are used : for setting Input/Output flags on files. -In order to avoid the namespace pollution induced by global constants, PerlQt group them in the <strong>Qt::constants</strong> module. +In order to avoid the namespace pollution induced by global constants, PerlTQt group them in the <strong>TQt::constants</strong> module. For instance, requesting the importation of all IO constants into the current namespace would be done with: </dd> <dd> <pre> - use Qt::constants;</pre> + use TQt::constants;</pre> </dd> <dd> <p>You may also import specific symbols:</p> </dd> <dd> <pre> - use Qt::constants qw( IO_ReadOnly IO_WriteOnly );</pre> + use TQt::constants qw( IO_ReadOnly IO_WriteOnly );</pre> </dd> <p></p> <dt><strong><a name="item_global_functions">Global Functions</a></strong><br /> </dt> <dd> -Qt has also some utilitarian functions such as bitBlt, qCompress, etc. +TQt has also some utilitarian functions such as bitBlt, qCompress, etc. </dd> <dd> <p>Those were global scope functions and have been grouped in a common namespace: -<code>Qt::GlobalSpace</code>.</p> +<code>TQt::GlobalSpace</code>.</p> </dd> <dd> <p>Hence, you shall access this namespace either with a fully qualified call:</p> </dd> <dd> <pre> - Qt::GlobalSpace::qUncompress( $buffer )</pre> + TQt::GlobalSpace::qUncompress( $buffer )</pre> </dd> <dd> <p>Or directly, after importation in the current namespace:</p> </dd> <dd> <pre> - use Qt::GlobalSpace; + use TQt::GlobalSpace; qUncompress( $buffer )</pre> </dd> <dd> @@ -918,47 +918,47 @@ Qt has also some utilitarian functions such as bitBlt, qCompress, etc. </dd> <dd> <pre> - use Qt::GlobalSpace qw( qUncompress bitBlt )</pre> + use TQt::GlobalSpace qw( qUncompress bitBlt )</pre> </dd> <dd> <p><strong>Note:</strong> GlobalSpace has also operators, such has the one performing an addition on two -Qt::Point(). Those operators are called automatically.</p> +TQt::Point(). Those operators are called automatically.</p> </dd> <dd> <p>e.g:</p> </dd> <dd> <pre> - $p1 = Qt::Point(10, 10) + Qt::Point(20, 20)</pre> + $p1 = TQt::Point(10, 10) + TQt::Point(20, 20)</pre> </dd> <p></p></dl> <p> </p> <hr /> <h1><a name="appendix_2_:_internationalization">Appendix 2 : Internationalization</a></h1> -<p>PerlQt handles internationalization by always converting <strong>QString</strong> back to <strong>utf8</strong> in Perl.</p> -<p>Conversions from Perl strings to QStrings are made according to context :</p> +<p>PerlTQt handles internationalization by always converting <strong>TQString</strong> back to <strong>utf8</strong> in Perl.</p> +<p>Conversions from Perl strings to TQStrings are made according to context :</p> <ul> <li><strong><a name="item_if_the_perl_string_is_already_utf8%2dencoded">If the Perl string is already utf8-encoded</a></strong><br /> </li> -then the string will be converted straight to QString. +then the string will be converted straight to TQString. <p>This is the most convenient and seemless way of internationalizing your application. Typically, one would just enable the use of utf8 in source code with the <code>use utf8</code> pragma and write its application with an utf8 aware editor.</p> <p></p> <li><strong><a name="item_if_the_string_isn%27t_tagged_as_utf8%2c_and_the_us">If the string isn't tagged as utf8, and the <strong>use locale</strong> pragma is not set</a></strong><br /> </li> -then the string will be converted to QString's utf8 from <strong>ISO-Latin-1</strong>. +then the string will be converted to TQString's utf8 from <strong>ISO-Latin-1</strong>. <p></p> <li><strong><a name="item_if_the_string_isn%27t_tagged_as_utf8_and_the_use_l">If the string isn't tagged as utf8 and the <strong>use locale</strong> pragma is set</a></strong><br /> </li> -then the string will be converted to QString's utf8 according to the currently set <strong>locale</strong>. +then the string will be converted to TQString's utf8 according to the currently set <strong>locale</strong>. <p></p></ul> <p>Once a string contains utf8, you can convert it back to any locale by setting up <strong>converters</strong> :</p> <pre> - $tr1=Qt::TextCodec::codecForLocale(); # this one will use current locale - $tr2=Qt::TextCodec::codecForName("KOI8-R"); # that one forces a specific locale (Russian)</pre> + $tr1=TQt::TextCodec::codecForLocale(); # this one will use current locale + $tr2=TQt::TextCodec::codecForName("KOI8-R"); # that one forces a specific locale (Russian)</pre> <pre> - print $tr1->fromUnicode(Qt::DateTime::currentDateTime()->toString)."\n\n"; + print $tr1->fromUnicode(TQt::DateTime::currentDateTime()->toString)."\n\n"; print $tr2->fromUnicode($my_utf8_string);</pre> <p>Or, with Perl >= 5.8.0, you may use Perl's <strong>Encode</strong> modules (see <code>perldoc Encode</code>).</p> <p> @@ -966,19 +966,19 @@ then the string will be converted to QString's utf8 according to the currently s <h3><a name="disabling_utf8">disabling utf-8</a></h3> <p>Developers who don't want to use UTF-8 or want to temporarily disable UTF-8 marshalling for handling legacy programs may use the <strong>use bytes</strong> pragma (and the corresponding <strong>no bytes</strong>).</p> -<p>Within the scope of this pragma, QStrings are marshalled back to ISO-Latin1 (default) or to your locale +<p>Within the scope of this pragma, TQStrings are marshalled back to ISO-Latin1 (default) or to your locale (if <strong>use locale</strong> has been set).</p> <p>Frivole use of this pragma is strongly discouraged as it ruins worldwide standardization efforts.</p> <p> </p> <hr /> <h1><a name="appendix_3_:_debugging_channels">Appendix 3 : Debugging Channels</a></h1> -<p>The <strong>Qt::debug</strong> module offers various debugging channels/features.</p> +<p>The <strong>TQt::debug</strong> module offers various debugging channels/features.</p> <pre> - use Qt::debug;</pre> + use TQt::debug;</pre> <pre> - use Qt::debug qw|calls autoload verbose|;</pre> -<p>With the simple <code>use Qt::debug</code> statement, the <strong>verbose</strong> and <strong>ambiguous</strong> channels are activated. + use TQt::debug qw|calls autoload verbose|;</pre> +<p>With the simple <code>use TQt::debug</code> statement, the <strong>verbose</strong> and <strong>ambiguous</strong> channels are activated. If you specify a list of channels within the use statement, then only the specified channels will be enabled.</p> <p><strong>Available channels :</strong></p> <ul> @@ -994,33 +994,33 @@ Enable more verbose debugging. a method or function call fails. e.g:</p> <pre> - use Qt; - use Qt::debug; - $a= Qt::Application(\@ARGV); + use TQt; + use TQt::debug; + $a= TQt::Application(\@ARGV); $a->libraryPath("foo");</pre> <pre> --- No method to call for : - QApplication::libraryPath('foo') + TQApplication::libraryPath('foo') Closer candidates are : - static void QApplication::addLibraryPath(const QString&) - static QStringList QApplication::libraryPaths() - static void QApplication::removeLibraryPath(const QString&) - static void QApplication::setLibraryPaths(const QStringList&)</pre> + static void TQApplication::addLibraryPath(const TQString&) + static TQStringList TQApplication::libraryPaths() + static void TQApplication::removeLibraryPath(const TQString&) + static void TQApplication::setLibraryPaths(const TQStringList&)</pre> <p></p> <li><strong><a name="item_calls">calls</a></strong><br /> </li> -For every call, tell what corresponding Qt method is called +For every call, tell what corresponding TQt method is called (detailing the arguments if <strong>verbose</strong> is on). <p></p> <li><strong><a name="item_autoload">autoload</a></strong><br /> </li> Track the intermediate code between a method invocation in Perl -and its resolution to either a Qt or Perl call. +and its resolution to either a TQt or Perl call. <p></p> <li><strong><a name="item_gc">gc</a></strong><br /> </li> Give informations about garbage collection -whenever a Qt object is deleted and/or a Perl object is destroyed +whenever a TQt object is deleted and/or a Perl object is destroyed <p></p> <li><strong><a name="item_virtual">virtual</a></strong><br /> </li> @@ -1036,43 +1036,43 @@ Enable all channels <hr /> <h1><a name="appendix_4_:_marshallers">Appendix 4 : Marshallers</a></h1> <p>A marshaller is a piece of ``glue code'' translating a given datatype to another.</p> -<p>Within PerlQt, most Qt objects keep their object nature, so that one may invoke methods on them. +<p>Within PerlTQt, most TQt objects keep their object nature, so that one may invoke methods on them. However, some classes and datatypes map so naturally to some Perl types that keeping their object nature would would feel unnatural and clumsy.</p> -<p>For instance, instead of returning a Qt::StringList object, which would require an iterator to retrieve its content, -PerlQt will translate it to an array reference containing all the object's strings.</p> -<p>In the other way, instead of providing a Qt::StringList object as an argument of a method, one would simply +<p>For instance, instead of returning a TQt::StringList object, which would require an iterator to retrieve its content, +PerlTQt will translate it to an array reference containing all the object's strings.</p> +<p>In the other way, instead of providing a TQt::StringList object as an argument of a method, one would simply provide the reference to an array of Perl strings.</p> -<p>Here is the list of Marshallers as of PerlQt-3.008 :</p> +<p>Here is the list of Marshallers as of PerlTQt-3.008 :</p> <pre> ----------------------------------------------------------------- float, double <=> Perl real (NV) char, uchar, int, uint, enum long, ulong, short, ushort <=> Perl integer (IV) - QString, -&, -* => Perl string (utf8) - QString, -&, -* <= Perl string (utf8 or iso-latin1 or locale) - QCString, -&, -* <=> Perl string (utf8 or bytes, according to content or "bytes" pragma) - QByteArray, -&, -* <=> Perl string (bytes) - QStringList, -&, -* => Reference to an array of Perl strings (utf8) - QString, -&, -* => Perl string (utf8 or iso-latin1 or locale) + TQString, -&, -* => Perl string (utf8) + TQString, -&, -* <= Perl string (utf8 or iso-latin1 or locale) + TQCString, -&, -* <=> Perl string (utf8 or bytes, according to content or "bytes" pragma) + TQByteArray, -&, -* <=> Perl string (bytes) + TQStringList, -&, -* => Reference to an array of Perl strings (utf8) + TQString, -&, -* => Perl string (utf8 or iso-latin1 or locale) int&, -* <=> Perl integer (IV) bool&, -* <=> Perl boolean char* <=> Perl string (bytes) char** <= Reference to an array of Perl strings (bytes) uchar* <= Perl string (bytes) - QRgb* <= Reference to an array of Perl integers (IV) - QCOORD* <= Reference to an array of Perl integers (IV) + TQRgb* <= Reference to an array of Perl integers (IV) + TQCOORD* <= Reference to an array of Perl integers (IV) void* <=> Reference to a Perl integer (IV) - QValueList<int>, - *, - & <=> Reference to an array of Perl integers (IV) - QCanvasItemList, - *, - & => Reference to an array of Qt::CanvasItem - QWidgetList, - *, - & <=> Reference to an array of Qt::Widget - QObjectList, - *, - & <=> Reference to an array of Qt::Object - QFileInfoList, - *, - & <=> Reference to an array of Qt::FileInfo - QPtrList<QTab>, - *, - & <=> Reference to an array of Qt::Tab - QPtrList<QToolBar>, - *, - & <=> Reference to an array of Qt::ToolBar - QPtrList<QNetworkOperation>, - *, - & <=> Reference to an array of Qt::NetworkOperation - QPtrList<QDockWindow>, - *, - & <=> Reference to an array of Qt::DockWindow - (QUObject*) + TQValueList<int>, - *, - & <=> Reference to an array of Perl integers (IV) + TQCanvasItemList, - *, - & => Reference to an array of TQt::CanvasItem + TQWidgetList, - *, - & <=> Reference to an array of TQt::Widget + TQObjectList, - *, - & <=> Reference to an array of TQt::Object + TQFileInfoList, - *, - & <=> Reference to an array of TQt::FileInfo + TQPtrList<TQTab>, - *, - & <=> Reference to an array of TQt::Tab + TQPtrList<TQToolBar>, - *, - & <=> Reference to an array of TQt::ToolBar + TQPtrList<TQNetworkOperation>, - *, - & <=> Reference to an array of TQt::NetworkOperation + TQPtrList<TQDockWindow>, - *, - & <=> Reference to an array of TQt::DockWindow + (TQUObject*) </pre> |