From 7d27356bafd5670adcc8753ab5437b3bf8ffa4be Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Tue, 22 Nov 2011 03:12:38 -0600 Subject: Initial TQt conversion --- doc/html/using.html | 81 +++++++++++++++++++++++++++-------------------------- 1 file changed, 41 insertions(+), 40 deletions(-) (limited to 'doc/html/using.html') diff --git a/doc/html/using.html b/doc/html/using.html index 5ff6786..c3c0309 100644 --- a/doc/html/using.html +++ b/doc/html/using.html @@ -235,13 +235,13 @@ be used for this example without change.

A More Complex C++ Example

In this last example we will wrap a fictional C++ library that contains a class -that is derived from a Qt class. This will demonstrate how SIP allows a class +that is derived from a TQt class. This will demonstrate how SIP allows a class hierarchy to be split across multiple Python extension modules, and will introduce SIP’s versioning system.

The library contains a single C++ class called Hello which is derived from -Qt’s QLabel class. It behaves just like QLabel except that the text +TQt’s TQLabel class. It behaves just like TQLabel except that the text in the label is hard coded to be Hello World. To make the example more -interesting we’ll also say that the library only supports Qt v4.2 and later, +interesting we’ll also say that the library only supports TQt v4.2 and later, and also includes a function called setDefault() that is not implemented in the Windows version of the library.

The hello.h header file looks something like this:

@@ -251,12 +251,13 @@ in the Windows version of the library.

#include <qwidget.h> #include <qstring.h> -class Hello : public QLabel { - // This is needed by the Qt Meta-Object Compiler. +class Hello : public TQLabel { + // This is needed by the TQt Meta-Object Compiler. Q_OBJECT + TQ_OBJECT public: - Hello(QWidget *parent = 0); + Hello(TQWidget *parent = 0); private: // Prevent instances from being copied. @@ -265,7 +266,7 @@ private: }; #if !defined(Q_OS_WIN) -void setDefault(const QString &def); +void setDefault(const TQString &def); #endif

The corresponding SIP specification file would then look something like this:

@@ -273,25 +274,25 @@ void setDefault(const QString &def); %Module hello 0 -%Import QtGui/QtGuimod.sip +%Import TQtGui/TQtGuimod.sip -%If (Qt_4_2_0 -) +%If (TQt_4_2_0 -) -class Hello : QLabel { +class Hello : TQLabel { %TypeHeaderCode #include <hello.h> %End public: - Hello(QWidget *parent /TransferThis/ = 0); + Hello(TQWidget *parent /TransferThis/ = 0); private: Hello(const Hello &); }; %If (!WS_WIN) -void setDefault(const QString &def); +void setDefault(const TQString &def); %End %End @@ -301,12 +302,12 @@ previous examples.