Python Bindings for Qt (3.18.1)

Phil Thompson

This document describes a set of Python bindings for the Qt widget set. Contact the author at .


Introduction

PyQt is a set of Python bindings for the Qt toolkit and available for all platforms supported by Qt, including Windows, Linux, UNIX, MacOS/X and embedded systems such as the Sharp Zaurus and the Compaq iPAQ. They have been tested against Qt versions 1.43 to 3.3.7, Qt Non-commercial, Qtopia 1.5.0, and Python versions 1.5 to 2.5. Qt/Embedded v3 is not supported. Qt v4 is supported by PyQt v4.

PyQt is available under the GPL license for use with the GPL version of Qt, a a commercial license for use with the commercial version of Qt, a non-commercial license for use with the non-commercial version of Qt v2, and an educational license for use with the educational version of Qt.

PyQt is built using SIP (a tool for generating Python extension modules for C++ class libraries). SIP v4.6 or later must be installed in order to build and run this version of PyQt.

PyQt for MacOS/X requires Qt v3.1.0 or later and Python v2.3 or later.

The bindings are implemented as a number of Python modules

PyQt also includes the pyuic and pylupdate utilities which correspond to the Qt uic and lupdate utilities. pyuic converts the GUI designs created with Qt Designer to executable Python code. pylupdate scans Python code, extracts all strings that are candidates for internationalisation, and creates an XML file for use by Qt Linguist.


Other PyQt Goodies

Using Qt Designer

Qt Designer is a GPL'ed GUI design editor provided by Trolltech as part of Qt. It generates an XML description of a GUI design. Qt includes uic which generates C++ code from that XML.

PyQt includes pyuic which generates Python code from the same XML. The Python code is self contained and can be executed immediately.

It is sometimes useful to be able to include some specific Python code in the output generated by pyuic. For example, if you are using custom widgets, pyuic has no way of knowing the name of the Python module containing the widget and so cannot generate the required import statement. To help get around this, pyuic will extract any lines entered in the Comment field of Qt Designer's Form Settings dialog that begin with Python: and copies them to the generated output.

Here's a simple example showing the contents of the Comment field.

This comment will be ignored by pyuic.
Python:
Python:# Import our custom widget.
Python:from foo import bar

Here's the corresponding output from pyuic.

from qt import *

# Import our custom widget.
from foo import bar

Thanks to Christian Bird, pyuic will extract Python code entered using Qt Designer to implement slots. In Qt Designer, when you need to edit a slot and the source editor appears, enter Python code between the curly braces. Don't worry about the correct starting indent level, each line is prepended with a correct indentation.

Make sure that the ui.h file is in the same directory as the .ui file when using pyuic. The .ui file implies the name of the .ui.h file so there is no need to specify it on the command line.

Here's an example of a simple slot.

void DebMainWindowFrm::browsePushButtonClicked()
{
if self.debugging:
    QMessageBox.critical(self, "Event", "browse pushbutton was clicked!")
}

Here is the resulting code when pyuic is run.

class DebMainWindowFrm(QMainWindow):
    ...stuff...
    def browsePushButtonClicked(self):
        if self.debugging:
            QMessageBox.critical(self, "Event", "browse pushbutton was clicked!")

Note that indenting is as normal and that self and all other parameters passed to the slot are available.

If you use this, you will need to turn off all of the fancy options for the C++ editor in Designer as it tries to force C++ syntax and that's naturally annoying when trying to code in Python.


Using Qt Linguist

Qt includes the lupdate program which parses C++ source files converting calls to the QT_TR_NOOP() and QT_TRANSLATE_NOOP() macros to .ts language source files. The lrelease program is then used to generate .qm binary language files that are distributed with your application.

Thanks to Detlev Offenbach, PyQt includes the pylupdate program. This generates the same .ts language source files from your PyQt source files.


Deploying Commercial PyQt Applications

When deploying commercial PyQt applications it is necessary to discourage users from accessing the underlying PyQt modules for themselves. A user that used the modules shipped with your application to develop new applications would themselves be considered a developer and would need their own commercial Qt and PyQt licenses.

One solution to this problem is the VendorID package. This allows you to build Python extension modules that can only be imported by a digitally signed custom interpreter. The package enables you to create such an interpreter with your application embedded within it. The result is an interpreter that can only run your application, and PyQt modules that can only be imported by that interpreter. You can use the package to similarly restrict access to any extension module.

In order to build PyQt with support for the VendorID package, pass the -i command line flag to configure.py.


pyqtconfig and Build System Support

The SIP build system (ie. the sipconfig module) is described in the SIP documentation. PyQt includes the pyqtconfig module that can be used by configuration scripts of other bindings that are built on top of PyQt.

The pyqtconfig module contains the following classes:

Configuration(sipconfig.Configuration)

This class encapsulates additional configuration values, specific to PyQt, that can be accessed as instance variables.

The following configuration values are provided (in addition to those provided by the sipconfig.Configuration class):

pyqt_bin_dir

The name of the directory containing the pyuic and pylupdate executables.

pyqt_mod_dir

The name of the directory containing the PyQt modules.

pyqt_modules

A string containing the names of the PyQt modules that were installed.

pyqt_qt_sip_flags

A string of the SIP flags used to generate the code for the qt module and which should be added to those needed by any module that imports the qt module.

pyqt_qtaxcontainer_sip_flags

A string of the SIP flags used to generate the code for the qtaxcontainer module and which should be added to those needed by any module that imports the qtaxcontainer module.

pyqt_qtcanvas_sip_flags

A string of the SIP flags used to generate the code for the qtcanvas module and which should be added to those needed by any module that imports the qtcanvas module.

pyqt_qtext_sip_flags

A string of the SIP flags used to generate the code for the qtext module and which should be added to those needed by any module that imports the qtext module.

pyqt_qtgl_sip_flags

A string of the SIP flags used to generate the code for the qtgl module and which should be added to those needed by any module that imports the qtgl module.

pyqt_qtnetwork_sip_flags

A string of the SIP flags used to generate the code for the qtnetwork module and which should be added to those needed by any module that imports the qtnetwork module.

pyqt_qtsql_sip_flags

A string of the SIP flags used to generate the code for the qtsql module and which should be added to those needed by any module that imports the qtsql module.

pyqt_qttable_sip_flags

A string of the SIP flags used to generate the code for the qttable module and which should be added to those needed by any module that imports the qttable module.

pyqt_qtui_sip_flags

A string of the SIP flags used to generate the code for the qtui module and which should be added to those needed by any module that imports the qtui module.

pyqt_qtxml_sip_flags

A string of the SIP flags used to generate the code for the qtxml module and which should be added to those needed by any module that imports the qtxml module.

pyqt_sip_dir

The name of the base directory where the .sip files for each of the PyQt modules is installed. A sub-directory exists with the same name as the module.

pyqt_version

The PyQt version as a 3 part hexadecimal number (eg. v3.10 is represented as 0x030a00).

pyqt_version_str

The PyQt version as a string. For development snapshots it will start with snapshot-.

QtModuleMakefile(sipconfig.SIPModuleMakefile)

The Makefile class for modules that import the qt module.

finalise(self)

This is a reimplementation of sipconfig.Makefile.finalise().

QtAxContainerModuleMakefile(QtModuleMakefile)

The Makefile class for modules that import the qtaxcontainer module.

finalise(self)

This is a reimplementation of sipconfig.Makefile.finalise().

QtCanvasModuleMakefile(QtModuleMakefile)

The Makefile class for modules that import the qtcanvas module.

finalise(self)

This is a reimplementation of sipconfig.Makefile.finalise().

QtExtModuleMakefile(QtModuleMakefile)

The Makefile class for modules that import the qtext module.

finalise(self)

This is a reimplementation of sipconfig.Makefile.finalise().

QtGLModuleMakefile(QtModuleMakefile)

The Makefile class for modules that import the qtgl module.

finalise(self)

This is a reimplementation of sipconfig.Makefile.finalise().

QtNetworkModuleMakefile(QtModuleMakefile)

The Makefile class for modules that import the qtnetwork module.

finalise(self)

This is a reimplementation of sipconfig.Makefile.finalise().

QtTableModuleMakefile(QtModuleMakefile)

The Makefile class for modules that import the qttable module.

finalise(self)

This is a reimplementation of sipconfig.Makefile.finalise().

QtSQLModuleMakefile(QtTableModuleMakefile)

The Makefile class for modules that import the qtsql module.

finalise(self)

This is a reimplementation of sipconfig.Makefile.finalise().

QtUIModuleMakefile(QtModuleMakefile)

The Makefile class for modules that import the qtui module.

finalise(self)

This is a reimplementation of sipconfig.Makefile.finalise().

QtXMLModuleMakefile(QtModuleMakefile)

The Makefile class for modules that import the qtxml module.

finalise(self)

This is a reimplementation of sipconfig.Makefile.finalise().


Things to be Aware Of

super and Wrapped Classes

Internally PyQt implements a lazy technique for attribute lookup where attributes are only placed in type and instance dictionaries when they are first referenced. This technique is needed to reduce the time taken to import large modules such as PyQt.

In most circumstances this technique is transparent to an application. The exception is when super is used with a PyQt class. The way that super is currently implemented means that the lazy lookup is bypassed resulting in AttributeError exceptions unless the attribute has been previously referenced.

Note that this restriction applies to any class wrapped by SIP and not just PyQt.


Python Strings, Qt Strings and Unicode

Unicode support was added to Qt in v2.0 and to Python in v1.6. In Qt, Unicode support is implemented using the QString class. It is important to understand that QStrings, Python string objects and Python Unicode objects are all different but conversions between them are automatic in many cases and easy to achieve manually when needed.

Whenever PyQt expects a QString as a function argument, a Python string object or a Python Unicode object can be provided instead, and PyQt will do the necessary conversion automatically.

You may also manually convert Python string and Unicode objects to QStrings by using the QString constructor as demonstrated in the following code fragment.

qs1 = QString('Converted Python string object')
qs2 = QString(u'Converted Python Unicode object')

In order to convert a QString to a Python string object use the Python str() function. Applying str() to a null QString and an empty QString both result in an empty Python string object.

In order to convert a QString to a Python Unicode object use the Python unicode() function. Applying unicode() to a null QString and an empty QString both result in an empty Python Unicode object.


Access to Protected Member Functions

When an instance of a C++ class is not created from Python it is not possible to access the protected member functions, or emit the signals, of that instance. Attempts to do so will raise a Python exception. Also, any Python methods corresponding to the instance's virtual member functions will never be called.


None and NULL

Throughout the bindings, the None value can be specified wherever NULL is acceptable to the underlying C++ code.

Equally, NULL is converted to None whenever it is returned by the underlying C++ code.


Support for C++ void * Data Types

PyQt represents void * values as objects of type sip.voidptr. Such values are often used to pass the addresses of external objects between different Python modules. To make this easier, a Python integer (or anything that Python can convert to an integer) can be used whenever a sip.voidptr is expected.

A sip.voidptr may be converted to a Python integer by using the int() builtin function.

A sip.voidptr may be converted to a Python string by using its asstring() method. The asstring() method takes an integer argument which is the length of the data in bytes.


Support for Threads

PyQt implements the full set of Qt's thread classes. Python, of course, also has its own thread extension modules. If you are using SIP v4 (or later) and Python v2.3.5 (or later) then PyQt does not impose any additional restrictions. (Read the relevant part of the Qt documentation to understand the restrictions imposed by the Qt API.)

If you are using earlier versions of either SIP or Python then it is possible to use either of the APIs so long as you follow some simple rules.

  • If you use the Qt API then the very first import of one of the PyQt modules must be done from the main thread.

  • If you use the Python API then all calls to PyQt (including any imports) must be done from one thread only. Therefore, if you want to make calls to PyQt from several threads then you must use the Qt API.

  • If you want to use both APIs in the same application then all calls to PyQt must be done from threads created using the Qt API.

The above comments actually apply to any SIP generated module, not just PyQt.


Garbage Collection

C++ does not garbage collect unreferenced class instances, whereas Python does. In the following C++ fragment both colours exist even though the first can no longer be referenced from within the program:

c = new QColor();
c = new QColor();

In the corresponding Python fragment, the first colour is destroyed when the second is assigned to c:

c = QColor()
c = QColor()

In Python, each colour must be assigned to different names. Typically this is done within class definitions, so the code fragment would be something like:

self.c1 = QColor()
self.c2 = QColor()

Sometimes a Qt class instance will maintain a pointer to another instance and will eventually call the destructor of that second instance. The most common example is that a QObject (and any of its sub-classes) keeps pointers to its children and will automatically call their destructors. In these cases, the corresponding Python object will also keep a reference to the corresponding child objects.

So, in the following Python fragment, the first QLabel is not destroyed when the second is assigned to l because the parent QWidget still has a reference to it.

p = QWidget()
l = QLabel('First label',p)
l = QLabel('Second label',p)

C++ Variables

Access to C++ variables is supported. They are accessed as Python instance variables. For example:

tab = QTab()
tab.label = "First Tab"
tab.r = QRect(10,10,75,30)

Global variables and static class variables are effectively read-only. They can be assigned to, but the underlying C++ variable will not be changed. This may change in the future.

Access to protected C++ class variables is not supported. This may change in the future.


Multiple Inheritance

It is not possible to define a new Python class that sub-classes from more than one Qt class.


i18n Support

Qt implements i18n support through the Qt Linguist application, the QTranslator class, and the QApplication::translate(), QObject::tr() and QObject::trUtf8() methods. Usually the tr() method is used to obtain the correct translation of a message. The translation process uses a message context to allow the same message to be translated differently. tr() is actually generated by moc and uses the hardcoded class name as the context. On the other hand, QApplication::translate() allows to context to be explicitly stated.

Unfortunately, because of the way Qt implents tr() (and trUtf8()) it is not possible for PyQt to exactly reproduce its behavour. The PyQt implementation of tr() (and trUtf8()) uses the class name of the instance as the context. The key difference, and the source of potential problems, is that the context is determined dynamically in PyQt, but is hardcoded in Qt. In other words, the context of a translation may change depending on an instance's class hierarchy.

class A(QObject):
    def __init__(self):
        QObject.__init__(self)

    def hello(self):
        return self.tr("Hello")

class B(A):
    def __init__(self):
        A.__init__(self)

a = A()
a.hello()

b = B()
b.hello()

In the above the message is translated by a.hello() using a context of A, and by b.hello() using a context of B. In the equivalent C++ version the context would be A in both cases.

The PyQt behaviour is unsatisfactory and may be changed in the future. It is recommended that QApplication.translate() be used in preference to tr() (and trUtf8()). This is guaranteed to work with current and future versions of PyQt and makes it much easier to share message files between Python and C++ code. Below is the alternative implementation of A that uses QApplication.translate().

class A(QObject):
    def __init__(self):
        QObject.__init__(self)

    def hello(self):
        return qApp.translate("A","Hello")

Note that the code generated by pyuic uses QApplication.translate().


Signal and Slot Support

A signal may be either a Qt signal (specified using SIGNAL()) or a Python signal (specified using PYSIGNAL()).

A slot can be either a Python callable object, a Qt signal (specified using SIGNAL()), a Python signal (specified using PYSIGNAL()), or a Qt slot (specified using SLOT()).

You connect signals to slots (and other signals) as you would from C++. For example:

QObject.connect(a,SIGNAL("QtSig()"),pyFunction)
QObject.connect(a,SIGNAL("QtSig()"),pyClass.pyMethod)
QObject.connect(a,SIGNAL("QtSig()"),PYSIGNAL("PySig"))
QObject.connect(a,SIGNAL("QtSig()"),SLOT("QtSlot()"))
QObject.connect(a,PYSIGNAL("PySig"),pyFunction)
QObject.connect(a,PYSIGNAL("PySig"),pyClass.pyMethod)
QObject.connect(a,PYSIGNAL("PySig"),SIGNAL("QtSig()"))
QObject.connect(a,PYSIGNAL("PySig"),SLOT("QtSlot()"))

When a slot is a Python method that corresponds to a Qt slot then a signal can be connected to either the Python method or the Qt slot. The following connections achieve the same effect.

sbar = QScrollBar()
lcd = QLCDNumber()

QObject.connect(sbar,SIGNAL("valueChanged(int)"),lcd.display)
QObject.connect(sbar,SIGNAL("valueChanged(int)"),lcd,SLOT("display(int)"))

The difference is that the second connection is made at the C++ level and is more efficient.

Disconnecting signals works in exactly the same way.

Any instance of a class that is derived from the QObject class can emit a signal using the emit method. This takes two arguments. The first is the Python or Qt signal, the second is a Python tuple which are the arguments to the signal. For example:

a.emit(SIGNAL("clicked()"),())
a.emit(PYSIGNAL("pySig"),("Hello","World"))

Note that when a slot is a Python callable object its reference count is not increased. This means that a class instance can be deleted without having to explicitly disconnect any signals connected to its methods. However, it also means that using lambda expressions as slots will not work unless you keep a separate reference to the expression to prevent it from being immediately garbage collected.

Qt allows a signal to be connected to a slot that requires fewer arguments than the signal passes. The extra arguments are quietly discarded. Python slots can be used in the same way.


Static Member Functions

Static member functions are implemented as Python class functions. For example the C++ static member function QObject::connect() is called from Python as QObject.connect() or self.connect() if called from a sub-class of QObject.


Enumerated Types

Enumerated types are implemented as a set of simple variables corresponding to the separate enumerated values.

When using an enumerated value the name of the class (or a sub-class) in which the enumerated type was defined in must be included. For example:

Qt.SolidPattern
QWidget.TabFocus
QFrame.TabFocus

Module Reference Documentation

The following sections should be used in conjunction with the normal class documentation - only the differences specific to the Python bindings are documented here.

In these sections, Not yet implemented implies that the feature can be easily implemented if needed. Not implemented implies that the feature will not be implemented, either because it cannot be or because it is not appropriate.

If a class is described as being fully implemented then all non-private member functions and all public class variables have been implemented.

If an operator has been implemented then it is stated explicitly.

Classes that are not mentioned have not yet been implemented.


qt Module Reference

Qt Constants

All constant values defined by Qt have equivalent constants defined to Python.


Qt (Qt v2+)

Qt is fully implemented.


QAccel

QAccel is fully implemented.


QAction (Qt v2.2+)

QAction is fully implemented.


QActionGroup (Qt v2.2+)

QActionGroup is fully implemented.


QApplication

QApplication(int &argc, char **argv);

This takes one parameter which is a list of argument strings. Arguments used by Qt are removed from the list.

QApplication(int &argc, char **argv, bool GUIenabled);

This takes two parameters, the first of which is a list of argument strings. Arguments used by Qt are removed from the list.

QApplication(int &argc, char **argv, Type type);

This takes two parameters, the first of which is a list of argument strings. Arguments used by Qt are removed from the list. (Qt v2.2+)

int exec();

This has been renamed to exec_loop in Python.


QAssistantClient (Qt v3.1+)

QAssistantClient is fully implemented.


QBitmap

QBitmap is fully implemented.


QBrush

QBrush is fully implemented, including the Python == and != operators.


QButton

QButton is fully implemented.


QButtonGroup

QButtonGroup is fully implemented.


QByteArray

A Python string can be used whenever a QByteArray can be used. A QByteArray can be converted to a Python string using the Python str() function.

QByteArray &assign(const char *data, uint size);

Not implemented.

char &at(uint i);

Not yet implemented.

int contains(const char &d);

Not yet implemented.

bool fill(const char &d, int size = -1);

Not yet implemented.

int find(const char &d, uint i = 0);

Not yet implemented.

void resetRawData(const char *data, uintsize);

Not implemented.

QByteArray &setRawData(const char *data, uintsize);

Not implemented.


QCDEStyle (Qt v2+)

QCDEStyle is fully implemented.


QCheckBox

QCheckBox is fully implemented.


QClipboard

void *data const(const char *format);

Not yet implemented (Qt v1.x).

void setData(const char *format, void *);

Not yet implemented (Qt v1.x).


QColor

The Python == and != operators are supported.

void getHsv(int *h, int *s, int *v);

This takes no parameters and returns the h, s and v values as a tuple.

void getRgb(int *r, int *g, int *b);

This takes no parameters and returns the r, g and b values as a tuple.

void hsv(int *h, int *s, int *v);

This takes no parameters and returns the h, s and v values as a tuple.

void rgb(int *r, int *g, int *b);

This takes no parameters and returns the r, g and b values as a tuple.


QColorDialog (Qt v2+)

static QRgb getRgba(QRgb initial, bool *ok, QWidget *parent = 0, const char *name = 0);

This takes the initial, parent and name parameters and returns a tuple containing the QRgb result and the ok value.


QColorGroup

QColorGroup is fully implemented.


QComboBox

QComboBox is fully implemented.


QCommonStyle (Qt v2+)

virtual void getButtonShift(int &x, int &y);

This takes no parameters and returns a tuple of the x and y values. (Qt v2)

virtual void tabbarMetrics(const QTabBar *t, int &hframe, int &vframe, int &overlap);

This takes only the t parameter and returns a tuple of the hframe, vframe and overlap values. (Qt v2)


QCString (Qt v2+)

A Python string can be used whenever a QCString can be used. A QCString can be converted to a Python string using the Python str() function.

QCString &sprintf(const char *format, ...);

Not implemented.

short toShort(bool *ok = 0);

This returns a tuple of the short result and the ok value.

ushort toUShort(bool *ok = 0);

This returns a tuple of the ushort result and the ok value.

int toInt(bool *ok = 0);

This returns a tuple of the int result and the ok value.

uint toUInt(bool *ok = 0);

This returns a tuple of the uint result and the ok value.

long toLong(bool *ok = 0);

This returns a tuple of the long result and the ok value.

ulong toULong(bool *ok = 0);

This returns a tuple of the ulong result and the ok value.

float toFloat(bool *ok = 0);

This returns a tuple of the float result and the ok value.

double toDouble(bool *ok = 0);

This returns a tuple of the double result and the ok value.


QCursor

QCursor is fully implemented.


QDataStream

QDataStream &readBytes(const char *&s, uint &l);

This takes no parameters. The QDataStream result and the data read are returned as a tuple.

QDataStream &readRawBytes(const char *s, uint l);

This takes only the l parameter. The QDataStream result and the data read are returned as a tuple.

QDataStream &writeBytes(const char *s, uint len);

len is derived from s and not passed as a parameter.

QDataStream &writeRawBytes(const char *s, uint len);

len is derived from s and not passed as a parameter.


QDate

The Python ==, !=, <, <=, >, >= and __nonzero__ operators are supported.

int weekNumber(int *yearNum = 0);

This takes no parameters and returns the week number and the year number as a tuple. (Qt v3.1+)


QDateTime

QDateTime is fully implemented, including the Python ==, !=, <, <=, >, >= and __nonzero__ operators.


QTime

QTime is fully implemented, including the Python ==, !=, <, <=, >, >= and __nonzero__ operators.


QDateEdit (Qt v3+)

QDateEdit is fully implemented.


QTimeEdit (Qt v3+)

QTimeEdit is fully implemented.


QDateTimeEdit (Qt v3+)

QDateTimeEdit is fully implemented.


QDesktopWidget (Qt v3+)

QDesktopWidget is fully implemented.


QDial (Qt v2.2+)

QDial is fully implemented.


QDialog

int exec();

This has been renamed to exec_loop in Python.

This method also causes ownership of the underlying C++ dialog to be transfered to Python. This means that the C++ dialog will be deleted when the Python wrapper is garbage collected. Although this is a little inconsistent, it ensures that the dialog is deleted without having to explicity code it using QObject.deleteLater() or other techniques.


QDir

QDir is fully implemented, including the Python len, [] (for reading slices and individual elements), ==, != and in operators


QFileInfoList

This class isn't implemented. Whenever a QFileInfoList is the return type of a function or the type of an argument, a Python list of QFileInfo instances is used instead.


QDockArea (Qt v3+)

bool hasDockWindow const(QDockWindow *w, int *index = 0);

This takes the w parameter and returns the index of the QDockWIndow or -1 if the QDockArea does not contain the QDockWindow.


QDockWindow (Qt v3+)

QDockWindow is fully implemented.


QColorDrag (Qt v2.1+)

QColorDrag is fully implemented.


QDragObject

QDragObject is fully implemented.


QImageDrag

QImageDrag is fully implemented.


QStoredDrag

QStoredDrag is fully implemented.


QTextDrag

QTextDrag is fully implemented.


QUriDrag (Qt v2+)

QUriDrag is fully implemented.


QUrlDrag (Qt v1.x)

QUrlDrag is fully implemented.


QDropSite

QDropSite is fully implemented.


QErrorMessage (Qt v3+)

QErrorMessage is fully implemented.


QEvent

QEvent is fully implemented.

Instances of QEvents are automatically converted to the correct sub-class.


QChildEvent

QChildEvent is fully implemented.


QCloseEvent

QCloseEvent is fully implemented.


QIconDragEvent (Qt v3.3+)

QIconDragEvent is fully implemented.


QContextMenuEvent (Qt v3+)

QContextMenuEvent is fully implemented.


QCustomEvent

QCustomEvent is fully implemented. Any Python object can be passed as the event data and its reference count is increased.


QDragEnterEvent

QDragEnterEvent is fully implemented.


QDragLeaveEvent

QDragLeaveEvent is fully implemented.


QDragMoveEvent

QDragMoveEvent is fully implemented.


QDropEvent

QDropEvent is fully implemented.


QFocusEvent

QFocusEvent is fully implemented.


QHideEvent

QHideEvent is fully implemented.


QIMComposeEvent (Qt v3.1+)

QIMComposeEvent is fully implemented.


QIMEvent (Qt v3+)

QIMEvent is fully implemented.


QKeyEvent

QKeyEvent is fully implemented.


QMouseEvent

QMouseEvent is fully implemented.


QMoveEvent

QMoveEvent is fully implemented.


QPaintEvent

QPaintEvent is fully implemented.


QResizeEvent

QResizeEvent is fully implemented.


QShowEvent

QShowEvent is fully implemented.


QTabletEvent (Qt v3+)

QTabletEvent is fully implemented.


QTimerEvent

QTimerEvent is fully implemented.


QWheelEvent (Qt v2+)

QWheelEvent is fully implemented.


QEventLoop (Qt v3.1+)

virtual int exec();

This has been renamed to exec_loop in Python.


QFile

bool open(int m, FILE *f);

Not implemented.

Q_LONG readBlock(char *data, Q_ULONG len);

This takes a single len parameter. The data is returned if there was no error, otherwise None is returned.

Q_LONG readLine(char *data, Q_ULONG maxlen);

This takes a single maxlen parameter. The data is returned if there was no error, otherwise None is returned.

static void setDecodingFunction(EncoderFn f);

Not yet implemented. (Qt v2+)

static void setEncodingFunction(EncoderFn f);

Not yet implemented. (Qt v2+)

Q_LONG writeBlock(const char *data, Q_ULONG len);

len is derived from data and not passed as a parameter.


QFileDialog

QFileDialog is fully implemented.


QFileIconProvider

QFileIconProvider is fully implemented.


QFilePreview

QFilePreview is fully implemented. However it cannot be used from Python in the same way as it is used from C++ because PyQt does not support multiple inheritance involving more than one wrapped class. A trick that seems to work is to use composition rather than inheritance as in the following code fragment.

class FilePreview(QFilePreview):
    pass

class Preview(QLabel):
    def __init__(self, parent=None):
        QLabel.__init__(self, parent)
        self.preview = FilePreview()
        self.preview.previewUrl = self.previewUrl

Note that QFilePreview cannot be instantiated directly because it is abstract. Thanks to Hans-Peter Jansen for this trick.


QFileInfo

QFileInfo is fully implemented.


QFont

QFont is fully implemented, including the Python == and != operators.


QFontDatabase (Qt v2.1+)

QFontDatabase is fully implemented.


QFontDialog (Qt v2+)

static QFont getFont(bool *ok, const QFont &def, QWidget *parent = 0, const char *name = 0);

This takes the def, parent and name parameters and returns a tuple containing the QFont result and the ok value.

static QFont getFont(bool *ok, QWidget *parent = 0, const char *name = 0);

This takes the parent and name parameters and returns a tuple containing the QFont result and the ok value.


QFontInfo

QFontInfo is fully implemented.


QFontMetrics

QRect boundingRect(int x, int y, int w, int h, int flags, const QString &str, int len = -1, int tabstops = 0, int *tabarray = 0);

The tabarray parameter is a Python list of integers.

QSize size(int flags, const QString &str, int len = -1, int tabstops = 0, int *tabarray = 0);

The tabarray parameter is a Python list of integers.


QFrame

QFrame is fully implemented.


QGManager (Qt v1.x)

QGManager is fully implemented.


QChain (Qt v1.x)

QChain is implemented as an opaque class.


QGrid (Qt v2+)

QGrid is fully implemented.


QGridView (Qt v3+)

QGridView is fully implemented.


QGroupBox

QGroupBox is fully implemented.


QHBox (Qt v2+)

QHBox is fully implemented.


QHButtonGroup (Qt v2+)

QHButtonGroup is fully implemented.


QHeader

QHeader is fully implemented.


QHGroupBox (Qt v2+)

QHGroupBox is fully implemented.


QIconSet

QIconSet is fully implemented.


QIconFactory (Qt v3.1+)

QIconFactory is fully implemented.


QIconView (Qt v2.1+)

QIconViewItem *makeRowLayout(QIconViewItem *begin, int &y);

Not yet implemented.


QIconViewItem (Qt v2.1+)

QIconViewItem is fully implemented.


QIconDrag (Qt v2.1+)

QIconDrag is fully implemented.


QIconDragItem (Qt v2.1+)

QIconDragItem is fully implemented.


QImage

The Python == and != operators are supported.

QImage(const char *xpm[]);

This takes a list of strings as its parameter.

QImage(uchar *data, int w, int h, int depth, QRgb *colorTable, int numColors, Endian bitOrder);

The colorTable parameter is a list of QRgb instances or None. (Qt v2.1+)

uchar *bits();

The return value is a sip.voidptr object which is only useful if passed to another Python module.

QRgb *colorTable();

The return value is a sip.voidptr object which is only useful if passed to another Python module.

QImage convertDepthWithPalette(int, QRgb *p, int pc, int cf = 0);

Not implemented.

uchar **jumpTable();

The return value is a sip.voidptr object which is only useful if passed to another Python module.

bool loadFromData(const uchar *buf, uint len, const char *format = 0, ColorMode mode = Auto);

len is derived from buf and not passed as a parameter.

uchar *scanLine(int i);

The return value is a sip.voidptr object which is only useful if passed to another Python module.


QImageIO

static void defineIOHandler(const char *format, const char *header, const char *flags, image_io_handler read_image, image_io_handler write_image);

Not implemented.


QImageTextKeyLang

QImageTextKeyLang is fully implemented.


QInputDialog (Qt v2.1+)

static QString getText(const QString &caption, const QString &label, const QString &text = QString::null, bool *ok = 0, QWidget *parent = 0, const char *name = 0);

The ok is not passed and the returned value is a tuple of the QString result and the ok flag. (Qt v2.1 - v2.3.1)

static QString getText(const QString &caption, const QString &label, QLineEdit::EchoModeecho, const QString &text = QString::null, bool *ok = 0, QWidget *parent = 0, const char *name = 0);

The ok is not passed and the returned value is a tuple of the QString result and the ok flag. (Qt v2.2 - v2.3.1)

static QString getText(const QString &caption, const QString &label, QLineEdit::EchoModeecho = QLineEdit::Normal, const QString &text = QString::null, bool *ok = 0, QWidget *parent = 0, const char *name = 0);

The ok is not passed and the returned value is a tuple of the QString result and the ok flag. (Qt v3+)

static int getInteger(const QString &caption, const QString &label, int num = 0, int from = -2147483647, int to = 2147483647, int step = 1, bool *ok = 0, QWidget *parent = 0, const char *name = 0);

The ok is not passed and the returned value is a tuple of the int result and the ok flag.

static double getDouble(const QString &caption, const QString &label, double num = 0, double from = -2147483647, double to = 2147483647, int step = 1, bool *ok = 0, QWidget *parent = 0, const char *name = 0);

The ok is not passed and the returned value is a tuple of the double result and the ok flag.

static QString getItem(const QString &caption, const QString &label, const QStringList &list, int current = 0, bool editable = TRUE, bool *ok = 0, QWidget *parent = 0, const char *name = 0);

The ok is not passed and the returned value is a tuple of the QString result and the ok flag.


QInterlaceStyle (Qt v2.3.1+)

void scrollBarMetrics(const QTabBar *sb, int &sliderMin, int &sliderMax, int &sliderLength, int &buttonDim);

This takes only the sb parameter and returns a tuple of the sliderMin, sliderMax, sliderLength and buttonDim values.


QIODevice

QIODevice is fully implemented.


QKeySequence (Qt v3+)

QKeySequence is fully implemented including the operators ==, !=, QString() and int(). A QString instance or a Python integer may be used whenever a QKeySequence can be used.


QLabel

QLabel is fully implemented.


QLayout

QLayout is fully implemented.


QBoxLayout

QBoxLayout is fully implemented.


QGLayoutIterator (Qt v2+)

QGLayoutIterator is fully implemented.


QGridLayout

bool findWidget(QWidget *w, int *row, int *col);

This takes the w parameter and returns a tuple containing the bool result, row and col. (Qt v2+)


QHBoxLayout

QHBoxLayout is fully implemented.


QLayoutItem (Qt v2+)

QLayoutItem is fully implemented.


QLayoutIterator (Qt v2+)

QLayoutItem *next();

This is a wrapper around the QLayoutIterator ++ operator.


QSpacerItem (Qt v2+)

QSpacerItem is fully implemented.


QVBoxLayout

QVBoxLayout is fully implemented.


QWidgetItem (Qt v2+)

QWidgetItem is fully implemented.


QLCDNumber

QLCDNumber is fully implemented.


QLibrary (Qt v3+)

QLibrary is fully implemented.


QLineEdit

int characterAt(int xpos, QChar *chr);

This takes only the xpos parameter and returns the int result and the chr value as a tuple. (Qt v3+)

void del();

This has been renamed delChar in Python. (Qt v2+)

bool getSelection(int *start, int *end);

This takes no parameters and returns the bool result and the start and end values as a tuple. (Qt v3+)


QList<type> (Qt v2)

Types based on the QList template are automatically converted to and from Python lists of the type.


QListBox

bool itemYPos(int index, int *yPos);

This takes the index parameter and returns a tuple containing the bool result and yPos. (Qt v1.x)


QListBoxItem

QListBoxItem is fully implemented.


QListBoxPixmap

QListBoxPixmap is fully implemented.


QListBoxText

QListBoxText is fully implemented.


QListView

QListView is fully implemented.

Note that to remove a child QListViewItem you must first call takeItem() and then del().


QListViewItem

QListViewItem is fully implemented.

Note that to remove a child QListViewItem you must first call takeItem() and then del().


QCheckListItem

QCheckListItem is fully implemented.


QListViewItemIterator (Qt v2+)

QListViewItemIterator is fully implemented.


QLocale (Qt v3.3+)

short toShort(bool *ok = 0);

This returns a tuple of the short result and the ok value.

ushort toUShort(bool *ok = 0);

This returns a tuple of the ushort result and the ok value.

int toInt(bool *ok = 0);

This returns a tuple of the int result and the ok value.

uint toUInt(bool *ok = 0);

This returns a tuple of the uint result and the ok value.

Q_LONG toLong(bool *ok = 0);

This returns a tuple of the long result and the ok value.

Q_ULONG toULong(bool *ok = 0);

This returns a tuple of the ulong result and the ok value.

float toFloat(bool *ok = 0);

This returns a tuple of the float result and the ok value.

double toDouble(bool *ok = 0);

This returns a tuple of the double result and the ok value.


QMainWindow

QTextStream &operator<<(QTextStream &, const QMainWindow &);

This operator is fully implemented. (Qt v3+)

QTextStream &operator>>(QTextStream &, QMainWindow &);

This operator is fully implemented. (Qt v3+)

bool getLocation(QToolBar *tb, ToolBarDock &dock, int &index, bool &nl, int &extraOffset);

This takes only the tb parameter and returns a tuple of the result, dock, index, nl and extraOffset values. (Qt v2.1.0+)

QList<QToolBar> toolBars(ToolBarDock dock);

This returns a list of QToolBar instances. (Qt v2.1.0+)


QMemArray<type> (Qt v3+)

Types based on the QMemArray template are automatically converted to and from Python lists of the type.


QMenuBar

QMenuBar is fully implemented.


QMenuData

QMenuItem *findItem(int id, QMenuData **parent);

Not implemented.


QCustomMenuItem (Qt v2.1+)

QCustomMenuItem is fully implemented.


QMenuItem

QMenuItem is an internal Qt class.


QMessageBox

QMessageBox is fully implemented.


QMetaObject

int numClassInfo const(bool super = FALSE);

Not implemented.

const QClassInfo *classInfo const(bool super = FALSE);

Not implemented.


QMetaProperty

QMetaProperty is fully implemented.


QMimeSource (Qt v2+)

QMimeSource is fully implemented.


QMimeSourceFactory (Qt v2+)

QMimeSourceFactory is fully implemented.


QWindowsMime (Qt v3+)

QWindowsMime is fully implemented.


QMotifPlusStyle (Qt v2.2+)

void getButtonShift(int &x, int &y);

This takes no parameters and returns a tuple of the x and y values. (Qt v2)

void scrollBarMetrics(const QScrollBar *sb, int &sliderMin, int &sliderMax, int &sliderLength, int &buttonDim);

This takes only the sb parameter and returns a tuple of the sliderMin, sliderMax, sliderLength and buttonDim values. (Qt v2)


QMotifStyle (Qt v2+)

void scrollBarMetrics(const QTabBar *sb, int &sliderMin, int &sliderMax, int &sliderLength, int &buttonDim);

This takes only the sb parameter and returns a tuple of the sliderMin, sliderMax, sliderLength and buttonDim values. (Qt v2)

void tabbarMetrics(const QTabBar *t, int &hframe, int &vframe, int &overlap);

This takes only the t parameter and returns a tuple of the hframe, vframe and overlap values. (Qt v2)


QMovie

QMovie(QDataSource *src, int bufsize = 1024);

Not implemented.

void pushData(const uchar *data, int length);

length is derived from data and not passed as a parameter. (Qt v2.2.0+)


QMultiLineEdit

void cursorPosition const(int *line, int *col);

This takes no parameters and returns a tuple of the line and col values. (Qt v1.x, Qt v2.x)

virtual void del();

This has been renamed delChar in Python. (Qt v1.x, Qt v2.x)

void getCursorPosition const(int *line, int *col);

This takes no parameters and returns a tuple of the line and col values. (Qt v1.x, Qt v2.x)

bool getMarkedRegion(int *line1, int *col1, int *line2, int *col2);

This takes no parameters and returns a tuple of the bool result and the line1, col1, line2 and col2 values.


QMutex (Qt v2.2+)

QMutex is fully implemented.


QMutexLocker (Qt v3.1+)

QMutexLocker is fully implemented.


QNetworkOperation (Qt v2.1+)

QNetworkOperation is fully implemented.


QNetworkProtocol (Qt v2.1+)

QNetworkProtocol is fully implemented.


QNetworkProtocolFactoryBase (Qt v2.1+)

QNetworkProtocolFactoryBase is fully implemented.


QObject

bool disconnect(const QObject *receiver, const char *member = 0);

Not yet implemented.

bool disconnect(const char *signal = 0, const QObject *receiver = 0, const char *member = 0);

Not yet implemented.

static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member);

At the moment PyQt does not support the full behaviour of the corresponding Qt method. In particular, specifying None (ie. 0 in C++) for the signal and receiver parameters is not yet supported.


QObjectCleanupHandler (Qt v3+)

QObjectCleanupHandler is fully implemented.


QObjectList

This class isn't implemented. Whenever a QObjectList is the return type of a function or the type of an argument, a Python list of QObject instances is used instead.


QPaintDeviceMetrics

QPaintDeviceMetrics is fully implemented.


QPaintDevice

virtual bool cmd(int, QPainter *, QPDevCmdParam *);

Not implemented.


QPainter

QRect boundingRect(int x, int y, int w, int h, int flags, const char *str, int len = -1, char **intern = 0);

The intern parameter is not supported.

QRect boundingRect(const QRect&, int flags, const char *str, int len = -1, char **intern = 0);

The intern parameter is not supported.

void drawText(int x, int y, int w, int h, int flags, const char *str, int len = -1, QRect *br = 0, char **intern = 0);

The intern parameter is not supported.

void drawText(const QRect&, int flags, const char *str, int len = -1, QRect *br = 0, char **intern = 0);

The intern parameter is not supported.

void setTabArray(int *ta);

This takes a single parameter which is a list of tab stops.

int *tabArray();

This returns a list of tab stops.


QPalette

QPalette is fully implemented, including the Python == and != operators.


QPixmap

QPixmap(const char *xpm[]);

This takes a list of strings as its parameter.

bool loadFromData(const uchar *buf, uint len, const char *format = 0, ColorMode mode = Auto);

len is derived from buf and not passed as a parameter.

bool loadFromData(const uchar *buf, uint len, const char *format, int conversion_flags);

Not implemented.


QPixmapCache (Qt v3+)

QPixmapCache is fully implemented.


QPair<type,type> (Qt v3+)

Types based on the QPair template are automatically converted to and from Python tuples of two elements.


QPen

QPen is fully implemented, including the Python == and != operators.


QPicture

const char *data();

Not implemented.

void setData(const char *data, uint size);

size is derived from data and not passed as a parameter.


QPlatinumStyle (Qt v2+)

void scrollBarMetrics(const QTabBar *sb, int &sliderMin, int &sliderMax, int &sliderLength, int &buttonDim);

This takes only the sb parameter and returns a tuple of the sliderMin, sliderMax, sliderLength and buttonDim values. (Qt v2)


QPoint

The Python +, +=, -, -=, unary -, *, *=, /, /=, ==, != and __nonzero__ operators are supported.

QCOORD &rx();

Not implemented.

QCOORD &ry();

Not implemented.


QPointArray

QPointArray(int nPoints, const QCOORD *points);

This takes a single parameter which is a list of points.

void point(uint i, int *x, int *y);

This takes the single parameter i and returns the x and y values as a tuple.

bool putPoints(int index, int nPoints, const QCOORD *points);

This takes two parameters, index and a list of points.

bool putPoints(int index, int nPoints, int firstx, int firsty, ...);

Not implemented.

bool setPoints(int nPoints, const QCOORD *points);

This takes a single parameter which is a list of points.

bool setPoints(int nPoints, int firstx, int firsty, ...);

Not implemented.


QPopupMenu

int exec();

This has been renamed exec_loop in Python.

int exec(const QPoint &pos, int indexAtPoint = 0);

This has been renamed exec_loop in Python.


QPrintDialog (X11)

QPrintDialog is fully implemented.


QPrinter

QPrinter is fully implemented.


QProcess (Qt v3+)

QProcess is fully implemented.


QProgressBar

QProgressBar is fully implemented.


QProgressDialog

QProgressDialog is fully implemented. value.


QPtrList<type> (Qt v3+)

Types based on the QPtrList template are automatically converted to and from Python lists of the type.


QPushButton

QPushButton is fully implemented.


QRadioButton

QRadioButton is fully implemented.


QRangeControl

QRangeControl is fully implemented.


QRect

The Python &, &=, |, |=, ==, !=, in and __nonzero__ operators are supported.

void coords(int *x1, int *y1, int *x2, int *y2);

This takes no parameters and returns a tuple containing the four values.

void rect(int *x, int *y, int *w, int *h);

This takes no parameters and returns a tuple containing the four values.

QCOORD &rBottom();

Not implemented. (Qt v2+)

QCOORD &rLeft();

Not implemented. (Qt v2+)

QCOORD &rRight();

Not implemented. (Qt v2+)

QCOORD &rTop();

Not implemented. (Qt v2+)


QRegExp

The Python == and != operators are supported.

int match(const char *str, int index = 0, int *len = 0);

This takes str and index parameters and returns a tuple of the int result and the len value. (Qt v1.x)

int match(const QString &str, int index = 0, int *len = 0);

This takes str and index parameters and returns a tuple of the int result and the len value. (Qt v2+)


QRegion

The Python |, |=, +, +=, &, &=, -, -=, ^, ^=, ==, !=, in and __nonzero__ operators are supported.

QArray<QRect> rects();

Not implemented.

void setRects(QRect *rects, int num);

Not yet implemented. (Qt v2.2+)


QScrollBar

QScrollBar is fully implemented.


QScrollView

void contentsToViewport(int x, int y, int &vx, int &vy);

This takes the x and y parameters and returns a tuple containing the vx and vy values. (Qt v2+)

void viewportToContents(int vx, int vy, int &x, int &y);

This takes the vx and vy parameters and returns a tuple containing the x and y values. (Qt v2+)


QSemaphore (Qt v2.2+)

QSemaphore is fully implemented. The += and -= operators have also been implemented, but require Python v2.0 or later.


QSemiModal (Qt v1, v2)

QSemiModal is fully implemented.


QSessionManager (Qt v2+)

QSessionManager is fully implemented.


QSettings (Qt v3+)

bool readBoolEntry(const QString &key, bool def = 0, bool *ok = 0);

The ok is not passed and the returned value is a tuple of the bool result and the ok flag.

double readDoubleEntry(const QString &key, double def = 0, bool *ok = 0);

The ok is not passed and the returned value is a tuple of the double result and the ok flag.

QString readEntry(const QString &key, const QString &def = QString::null, bool *ok = 0);

The ok is not passed and the returned value is a tuple of the QString result and the ok flag.

QStringList readListEntry(const QString &key, bool *ok = 0);

The ok is not passed and the returned value is a tuple of the QStringList result and the ok flag.

QStringList readListEntry(const QString &key, const QChar &separator, bool *ok = 0);

The ok is not passed and the returned value is a tuple of the QStringList result and the ok flag.

int readNumEntry(const QString &key, int def = 0, bool *ok = 0);

The ok is not passed and the returned value is a tuple of the int result and the ok flag.

bool writeEntry(const QString &key, bool value);

Not implemented.


QSGIStyle (Qt v2.2+)

void scrollBarMetrics(const QScrollBar *sb, int &sliderMin, int &sliderMax, int &sliderLength, int &buttonDim);

This takes only the sb parameter and returns a tuple of the sliderMin, sliderMax, sliderLength and buttonDim values. (Qt v2)


QSignalMapper

QSignalMapper is fully implemented.


QSimpleRichText (Qt v2+)

QSimpleRichText is fully implemented.


QSize

The Python +, +=, -, -=, *, *=, /, /=, ==, != and __nonzero__ operators are supported.

QCOORD &rheight();

Not implemented.

QCOORD &rwidth();

Not implemented.


QSizeGrip (Qt v2+)

QSizeGrip is fully implemented.


QSizePolicy (Qt v2+)

QSizePolicy is fully implemented.


QSlider

QSlider is fully implemented.


QSocketNotifier

QSocketNotifier is fully implemented.


QSound (Qt v2.2+)

QSound is fully implemented.


QSpinBox

virtual int mapTextToValue(bool *ok);

This returns a tuple of the int result and the modified ok value.


QSplashScreen (Qt v3.2.0+)

QSplashScreen is fully implemented.


QSplitter

void getRange(int id, int *min, int *max);

This takes the id parameter and returns the min and max values as a tuple. (Qt v2+)


QStatusBar

QStatusBar is fully implemented.


QChar (Qt v2+)

uchar &cell const();

Not implemented.

uchar &row const();

Not implemented.


QString

A Python string object (or Unicode object) can be used whenever a QString can be used. A QString can be converted to a Python string object using the Python str() function, and to a Python Unicode object using the Python unicode() function.

The Python +=, len, [] (for reading slices and individual characters), in and comparison operators are supported.

QCharRef at(uint i);

Not yet implemented. (Qt v2+)

QChar constref const(uint i);

Not yet implemented. (Qt v2+)

QChar &ref(uint i);

Not yet implemented. (Qt v2+)

QString &setUnicodeCodes(const ushort *unicode_as_shorts, uint len);

Not yet implemented. (Qt v2.1+)

QString &sprintf(const char *format, ...);

Not implemented.

short toShort(bool *ok = 0);

This returns a tuple of the short result and the ok value.

ushort toUShort(bool *ok = 0);

This returns a tuple of the ushort result and the ok value.

int toInt(bool *ok = 0);

This returns a tuple of the int result and the ok value.

uint toUInt(bool *ok = 0);

This returns a tuple of the uint result and the ok value.

long toLong(bool *ok = 0);

This returns a tuple of the long result and the ok value.

ulong toULong(bool *ok = 0);

This returns a tuple of the ulong result and the ok value.

float toFloat(bool *ok = 0);

This returns a tuple of the float result and the ok value.

double toDouble(bool *ok = 0);

This returns a tuple of the double result and the ok value.


QStringList (Qt v2+)

The Python len, [] (for both reading and writing slices and individual elements), del (for deleting slices and individual elements), +, +=, *, *=, ==, != and in operators are supported.

Iterator append(const QString &x);

This does not return a value.

Iterator prepend(const QString &x);

This does not return a value.


QStrList

This class isn't implemented. Whenever a QStrList is the return type of a function or the type of an argument, a Python list of strings is used instead.


QStyle (Qt v2+)

virtual void getButtonShift(int &x, int &y);

This takes no parameters and returns a tuple of the x and y values. (Qt v2)

virtual void scrollBarMetrics(const QScrollBar *b, int &sliderMin, int &sliderMax, int &sliderLength, int &buttonDim);

Thus takes only the b parameter and returns a tuple of the sliderMin, sliderMax, sliderLength and buttonDim values. (Qt v2)

virtual void tabbarMetrics(const QTabBar *t, int &hframe, int &vframe, int &overlap);

This takes only the t parameter and returns a tuple of the hframe, vframe and overlap values. (Qt v2)


QStyleOption (Qt v3+)

QStyleOption is fully implemented.


QStyleSheet (Qt v2+)

QStyleSheet is fully implemented.


QStyleSheetItem (Qt v2+)

QStyleSheetItem is fully implemented.


QSyntaxHighlighter (Qt v3.1+)

QSyntaxHighlighter is fully implemented.


QTab

QTab is fully implemented.


QTabBar

QList<QTab> tabList();

This returns a list of QTab instances.


QTabDialog

QTabDialog is fully implemented.


QTableView (Qt 1.x, Qt 2.x)

bool colXPos(int col, int *xPos);

This takes the col parameter and returns a tuple containing the bool result and xPos.

bool rowYPos(int row, int *yPos);

This takes the row parameter and returns a tuple containing the bool result and yPos.


QTabWidget (Qt v2+)

QTabWidget is fully implemented.


QTextBrowser (Qt v2+)

QTextBrowser is fully implemented.


QTextCodec (Qt v2+)

virtual QCString fromUnicode(const QString &uc, int &lenInOut);

The returned value is a tuple of the QCString result and the updated lenInOut.


QTextDecoder (Qt v2+)

QTextDecoder is fully implemented.


QTextEncoder (Qt v2+)

virtual QCString fromUnicode = 0(const QString &uc, int &lenInOut);

The returned value is a tuple of the QCString result and the updated lenInOut.


QTextEdit (Qt v3+)

int charAt(const QPoint &pos, int *para = 0);

This takes only the pos parameter and returns a tuple of the value returned via the para pointer and the int result.

void del();

This has been renamed delChar in Python.

virtual bool find(const QString &expr, bool cs, bool wo, bool forward = TRUE, int *para = 0, int *index = 0);

If the para and index parameters are omitted then the bool result is returned. If both are supplied (as integers) then a tuple of the bool result and the modified values of para and index is returned.

void getCursorPosition(int *para, int *index);

This takes no parameters and returns a tuple of the values returned via the para and index pointers.

void getSelection(int *paraFrom, int *indexFrom, int *paraTo, int *indexTo, int selNum = 0);

This takes only the selNum parameter and returns a tuple of the paraFrom, indexFrom, paraTo and indexTo values.


QTextStream

QTextStream(FILE *fp, int mode);

Not implemented.

QTextStream &readRawBytes(char *buf, uint len);

Not yet implemented.

QTextStream &writeRawBytes(const char *buf, uint len);

Not yet implemented.


QTextIStream (Qt v2+)

QTextIStream(FILE *fp, int mode);

Not implemented.


QTextOStream (Qt v2+)

QTextOStream(FILE *fp, int mode);

Not implemented.


QTextView (Qt v2+)

QTextView is fully implemented.


QThread (Qt v2.2+)

QThread is fully implemented.


QTimer

QTimer is fully implemented.


QToolBar

QToolBar is fully implemented.


QToolBox (Qt v3.2.0+)

QToolBox is fully implemented.


QToolButton

QToolButton is fully implemented.


QToolTip

QToolTip is fully implemented.


QToolTipGroup

QToolTipGroup is fully implemented.


QTranslator (Qt v2+)

QTranslator is fully implemented.


QTranslatorMessage (Qt v2.2+)

QTranslatorMessage is fully implemented.


QUrl (Qt v2.1+)

QUrl is fully implemented, including the QString(), == and != operators.


QUrlInfo (Qt v2.1+)

QUrlInfo is fully implemented.


QUrlOperator (Qt v2.1+)

virtual bool isDir(bool *ok);

This returns a tuple of the bool result and the ok value.


QUuid (Qt v3.0+)

QUuid is fully implemented.


QValidator

virtual State validate(QString& input, int& pos);

The returned value is a tuple of the State result and the updated pos.


QDoubleValidator

State validate(QString& input, int& pos);

The returned value is a tuple of the State result and the updated pos.


QIntValidator

State validate(QString& input, int& pos);

The returned value is a tuple of the State result and the updated pos.


QRegExpValidator (Qt v3+)

virtual State validate(QString& input, int& pos);

The returned value is a tuple of the State result and the updated pos.


QValueList<type> (Qt v2+)

Types based on the QValueList template are automatically converted to and from Python lists of the type.


QVariant (Qt v2.1+)

QVariant(const char *val);

Not implemented.

QVariant(const QBitArray &val);

Not yet implemented. (Qt v3+)

QVariant(const QValueList<QVariant> &val);

Not yet implemented.

QVariant(const QMap<QString,QVariant> &val);

Not yet implemented.

QBitArray &asBitArray();

Not yet implemented. (Qt v3+)

bool &asBool();

Not implemented.

double &asDouble();

Not implemented.

int &asInt();

Not implemented.

QValueList<QVariant> &asList();

Not implemented.

QMap<QString,QVariant> &asMap();

Not implemented.

uint &asUInt();

Not implemented.

QValueListConstIterator<QVariant>listBegin const();

Not implemented.

QValueListConstIterator<QVariant>listEnd const();

Not implemented.

QMapConstIterator<QString,QVariant>mapBegin const();

Not implemented.

QMapConstIterator<QString,QVariant>mapEnd const();

Not implemented.

QMapConstIterator<QString,QVariant>mapFind const(const QString &key);

Not implemented.

QValueListConstIterator<QString>stringListBegin const();

Not implemented.

QValueListConstIterator<QString>stringListEnd const();

Not implemented.

const QBitArray toBitArray const();

Not yet implemented. (Qt v3+)

const QValueList<QVariant>toList const();

Not yet implemented.

const QMap<QString,QVariant>toMap const();

Not yet implemented.


QVBox (Qt v2+)

QVBox is fully implemented.


QVButtonGroup (Qt v2+)

QVButtonGroup is fully implemented.


QVGroupBox (Qt v2+)

QVGroupBox is fully implemented.


QWaitCondition (Qt v2.2+)

QWaitCondition is fully implemented.


QWhatsThis

QWhatsThis is fully implemented.


QWidget

QWExtra *extraData();

Not implemented.

QFocusData *focusData();

Not implemented.

void lower();

This has been renamed to lowerW in Python.

void raise();

This has been renamed to raiseW in Python.


QWidgetList

This class isn't implemented. Whenever a QWidgetList is the return type of a function or the type of an argument, a Python list of instances is used instead.


QWidgetStack

QWidgetStack is fully implemented.


QWindow

QWindow is fully implemented (Qt v1.x).


QWindowsStyle (Qt v2+)

void getButtonShift(int &x, int &y);

This takes no parameters and returns a tuple of the x and y values. (Qt v2)

void scrollBarMetrics(const QTabBar *sb, int &sliderMin, int &sliderMax, int &sliderLength, int &buttonDim);

This takes only the sb parameter and returns a tuple of the sliderMin, sliderMax, sliderLength and buttonDim values. (Qt v2)

void tabbarMetrics(const QTabBar *t, int &hframe, int &vframe, int &overlap);

This takes only the t parameter and returns a tuple of the hframe, vframe and overlap values. (Qt v2)


QWindowsXPStyle (Qt v3.0.1+, Windows)

QWindowsXPStyle is fully implemented.


QWizard (Qt v2+)

QWizard is fully implemented.


QWMatrix

The Python ==, != and *= operators are supported.

QWMatrix invert const(bool *invertible = 0);

This takes no parameters and returns a tuple of the QWMatrix result and the invertible value.

void map const(int x, int y, int *tx, int *ty);

This takes the x and y parameters and returns a tuple containing the tx and ty values.

void map const(float x, float y, float *tx, float *ty);

This takes the x and y parameters and returns a tuple containing the tx and ty values. (Qt v1.x)

void map const(double x, double y, double *tx, double *ty);

This takes the x and y parameters and returns a tuple containing the tx and ty values. (Qt v2+)


QWorkspace (Qt v2.1+)

QWorkspace is fully implemented.


qtaxcontainer Module Reference

QAxBase (Windows, Qt v3+)

QAxObject(IUnknown *iface = 0);

Not implemented.

long queryInterface(const QUuid &uuid, void **iface);

Not implemented.

PropertyBag propertyBag const();

Not implemented.

void setPropertyBag(const PropertyBag &bag);

Not implemented.

unsigned long registerWeakActiveObject(const QString &guid);

This is a utility method provided by PyQt to make it easier to use Mark Hammond's win32com module to manipulate objects created by the qtaxcontainer module.

The RegisterActiveObject() COM function is called to register the QAxBase instance as a weak object with the guid GUID. The revoke handle is returned.

static void revokeActiveObject(unsigned long rhandle);

This is a wrapper around the RevokeActiveObject() COM function and is called to revoke the object registered using registerWeakActiveObject(). rhandle is the revoke handle returned by registerWeakActiveObject().


QAxObject (Windows, Qt v3+)

QAxObject(IUnknown *iface, QObject *parent = 0, const char *name = 0);

Not implemented.


QAxWidget (Windows, Qt v3+)

QAxWidget(IUnknown *iface, QWidget *parent = 0, const char *name = 0);

Not implemented.


qtcanvas Module Reference

QCanvas (Qt v2.2+)

QCanvas is fully implemented.


QCanvasEllipse (Qt v2.2+)

QCanvasEllipse is fully implemented.


QCanvasItem (Qt v2.2+)

QCanvasItem is fully implemented.


QCanvasItemList (Qt v2.2+)

This class isn't implemented. Whenever a QCanvasItemList is the return type of a function or the type of an argument, a Python list of QCanvasItem instances is used instead.


QCanvasLine (Qt v2.2+)

QCanvasLine is fully implemented.


QCanvasPixmap (Qt v2.2+)

QCanvasPixmap is fully implemented.


QCanvasPixmapArray (Qt v2.2+)

QPixmapArray(QList<QPixmap> pixmaps, QList<QPoint> hotspots);

The pixmaps argument is a Python list of QPixmap instances, and the hotspots argument is a Python list of QPoint instances. (Qt v2.2.0 - Qt v2.3.1)

QPixmapArray(QValueList<QPixmap> pixmaps, QPointArray hotspots = QPointArray());

The pixmaps argument is a Python list of QPixmap instances. (Qt v3+)


QCanvasPolygon (Qt v2.2+)

QCanvasPolygon is fully implemented.


QCanvasPolygonalItem (Qt v2.2+)

QCanvasPolygonalItem is fully implemented.


QCanvasRectangle (Qt v2.2+)

QCanvasRectangle is fully implemented.


QCanvasSpline (Qt v3.0+)

QCanvasSpline is fully implemented.


QCanvasSprite (Qt v2.2+)

QCanvasSprite is fully implemented.


QCanvasText (Qt v2.2+)

QCanvasText is fully implemented.


QCanvasView (Qt v2.2+)

QCanvasView is fully implemented.


qtext Module Reference

QextScintilla

void getCursorPosition(int *line, int *index);

This takes no parameters and returns a tuple of the values returned by the line and index pointers.

void getSelection(int *lineFrom, int *indexFrom, int *lineTo, int *indexTo);

This takes no parameters and returns a tuple of the values returned by the lineFrom, indexFrom, lineTo and indexTo pointers.


QextScintillaAPIs

QextScintillaAPIs is fully implemented.


QextScintillaBase

QextScintillaBase is fully implemented.


QextScintillaCommand

QextScintillaCommand is fully implemented.


QextScintillaCommandSet

QextScintillaCommandSet is fully implemented.


QextScintillaDocument

QextScintillaDocument is fully implemented.


QextScintillaLexer

QextScintillaLexer is fully implemented.


QextScintillaLexerBash (QScintilla v1.4+)

QextScintillaLexerBash is fully implemented.


QextScintillaLexerBatch (QScintilla v1.6+)

QextScintillaLexerBatch is fully implemented.


QextScintillaLexerCPP

QextScintillaLexerCPP is fully implemented.


QextScintillaLexerCSharp

QextScintillaLexerCSharp is fully implemented.


QextScintillaLexerCSS (QScintilla v1.6+)

QextScintillaLexerCSS is fully implemented.


QextScintillaLexerDiff (QScintilla v1.6+)

QextScintillaLexerDiff is fully implemented.


QextScintillaLexerHTML (QScintilla v1.1+)

QextScintillaLexerHTML is fully implemented.


QextScintillaLexerIDL

QextScintillaLexerIDL is fully implemented.


QextScintillaLexerJava

QextScintillaLexerJava is fully implemented.


QextScintillaLexerJavaScript

QextScintillaLexerJavaScript is fully implemented.


QextScintillaLexerLua (QScintilla v1.5+)

QextScintillaLexerLua is fully implemented.


QextScintillaLexerMakefile (QScintilla v1.6+)

QextScintillaLexerMakefile is fully implemented.


QextScintillaLexerPerl

QextScintillaLexerPerl is fully implemented.


QextScintillaLexerPOV (QScintilla v1.6+)

QextScintillaLexerPOV is fully implemented.


QextScintillaLexerProperties (QScintilla v1.6+)

QextScintillaLexerProperties is fully implemented.


QextScintillaLexerPython

QextScintillaLexerPython is fully implemented.


QextScintillaLexerRuby (QScintilla v1.5+)

QextScintillaLexerRuby is fully implemented.


QextScintillaLexerSQL (QScintilla v1.1+)

QextScintillaLexerSQL is fully implemented.


QextScintillaLexerTeX (QScintilla v1.6+)

QextScintillaLexerTeX is fully implemented.


QextScintillaMacro

QextScintillaMacro is fully implemented.


QextScintillaPrinter

QextScintillaPrinter is fully implemented.


qtgl Module Reference

QGL

QGL is fully implemented.


QGLContext

QGLContext is fully implemented.


QGLFormat

QGLFormat is fully implemented.


QGLWidget

QGLWidget is fully implemented.


QGLColormap (Qt v3.0+)

void setEntries(int count, const QRgb *colors, int base = 0);

Not yet implemented.


qtnetwork Module Reference

QDns (Qt v2.2+)

QDns is fully implemented.


QFtp (Qt v2.2+)

Q_LONG readBlock(char *data, Q_ULONG maxlen);

This takes a single maxlen parameter. The data is returned if there was no error, otherwise None is returned.


QHostAddress (Qt v2.2+)

QHostAddress(Q_UINT8 *ip6Addr);

Not yet implemented.

QHostAddress(const Q_IPV6ADDR &ip6Addr);

Not yet implemented.

void setAddress(Q_UINT8 *ip6Addr);

Not yet implemented.

Q_IPV6ADDR toIPv6Address const();

Not yet implemented.


QHttp (Qt v3+)

Q_LONG readBlock(char *data, Q_ULONG maxlen);

This takes a single maxlen parameter. The data is returned if there was no error, otherwise None is returned.


QHttpHeader (Qt v3.1+)

QHttpHeader is fully implemented.


QHttpRequestHeader (Qt v3.1+)

QHttpRequestHeader is fully implemented.


QHttpResponseHeader (Qt v3.1+)

QHttpResponseHeader is fully implemented.


QLocalFs (Qt v2.1+)

QLocalFs is fully implemented.


QServerSocket (Qt v2.2+)

QServerSocket is fully implemented.


QSocket (Qt v2.2+)

Q_LONG readBlock(char *data, Q_ULONG len);

This takes a single len parameter. The data is returned if there was no error, otherwise Py_None is returned.

Q_LONG readLine(char *data, Q_ULONG maxlen);

This takes a single maxlen parameter. The data is returned if there was no error, otherwise Py_None is returned.

Q_LONG writeBlock(const char *data, Q_ULONG len);

len is derived from data and not passed as a parameter.


QSocketDevice (Qt v2.2+)

Q_LONG readBlock(char *data, Q_ULONG len);

This takes a single len parameter. The data is returned if there was no error, otherwise None is returned.

Q_LONG writeBlock(const char *data, Q_ULONG len);

len is derived from data and not passed as a parameter.


qtpe Module Reference

QPEApplication

QApplication(int& argc, char **argv, Type type);

This takes two parameters, the first of which is a list of argument strings. Arguments used by Qt are removed from the list.

int exec();

This has been renamed to exec_loop in Python.


AppLnk

virtual QString exec const();

This has been renamed to exec_property in Python.


AppLnkSet

AppLnkSet is fully implemented.


Config

Config is fully implemented.


DateFormat

DateFormat is fully implemented.


DocLnk

QString exec const();

This has been renamed to exec_property in Python.


DocLnkSet

DocLnkSet is fully implemented.


FileManager

FileManager is fully implemented.


FileSelector

FileSelector is fully implemented.


FileSelectorItem

FileSelectorItem is fully implemented.


FontDatabase

FontDatabase is fully implemented.


Global

static void setBuiltinCommands(Command *);

Not implemented.


MenuButton

MenuButton is fully implemented.


QCopEnvelope

QCopEnvelope is fully implemented.


QDawg

QDawg is fully implemented.


QPEMenuBar

QPEMenuBar is fully implemented.


QPEToolBar

QPEToolBar is fully implemented.


Resource

Resource is fully implemented.


qtsql Module Reference

QDataBrowser (Qt v3+)

virtual void del();

This has been renamed delOnCursor in Python.


QDataTable (Qt v3+)

QDataTable is fully implemented.


QDataView (Qt v3+)

QDataView is fully implemented.


QEditorFactory (Qt v3+)

QEditorFactory is fully implemented.


QSql (Qt v3+)

QSql is fully implemented.


QSqlCursor (Qt v3+)

virtual int del(bool invalidate = TRUE);

This has been renamed delRecords in Python.

virtual int del(const QString &filter, bool invalidate = TRUE);

This has been renamed delRecords in Python.

bool exec(const QString &query);

This has been renamed execQuery in Python.


QSqlDatabase (Qt v3+)

QSqlQuery exec(const QString &query = QString::null);

This has been renamed execStatement in Python.


QSqlDriver (Qt v3+)

QSqlDriver is fully implemented.


QSqlEditorFactory (Qt v3+)

QSqlEditorFactory is fully implemented.


QSqlError (Qt v3+)

QSqlError is fully implemented.


QSqlField (Qt v3+)

QSqlField is fully implemented.


QSqlFieldInfo (Qt v3+)

QSqlFieldInfo is fully implemented.


QSqlForm (Qt v3+)

QSqlForm is fully implemented.


QSqlIndex (Qt v3+)

QSqlIndex is fully implemented.


QSqlPropertyMap (Qt v3+)

QSqlPropertyMap is fully implemented. However, because PyQt does not allow new properties to be defined, it is not possible to implement custom editor widgets in Python and add them to a property map. This will simple be ignored.

This problem may be addressed in a future release of PyQt.


QSqlQuery (Qt v3+)

QMap<QString,QVariant> boundValues const();

Not yet implemented. (Qt v3.2.0+)

virtual bool exec(const QString &query);

This has been renamed execQuery in Python.

bool exec();

This has been renamed execQuery in Python. (Qt v3.1+)


QSqlRecord (Qt v3+)

QSqlRecord is fully implemented.


QSqlRecordInfo (Qt v3+)

QSqlRecordInfo is implemented as a Python list of QSqlFieldInfo instances.


QSqlResult (Qt v3+)

QSqlResult is fully implemented.


QSqlSelectCursor (Qt v3.2.0+)

int del(bool invalidate = TRUE);

This has been renamed delRecords in Python.

bool exec(const QString &query);

This has been renamed execQuery in Python.


qttable Module Reference

QTable (Qt v2.2+)

QTable is fully implemented.


QTableItem (Qt v2.2+)

QTableItem is fully implemented.


QCheckTableItem (Qt v3+)

QCheckTableItem is fully implemented.


QComboTableItem (Qt v3+)

QComboTableItem is fully implemented.


QTableSelection (Qt v2.2+)

QTableSelection is fully implemented.


qtui Module Reference

QWidgetFactory (Qt v3+)

QWidgetFactory is fully implemented.


qtxml Module Reference

QDomImplementation (Qt v2.2+)

QDomImplementation is fully implemented.


QDomNode (Qt v2.2+)

QDomNode is fully implemented, including the Python == and != operators.


QDomNodeList (Qt v2.2+)

QDomNodeList is fully implemented.


QDomDocument (Qt v2.2+)

bool setContent(const QCString &buffer, bool namespaceProcessing, QString *errorMsg = 0, int *errorLine = 0, int *errorColumn = 0);

This takes the buffer and namespaceProcessing parameters and returns a tuple containing the bool result and the errorMsg, errorLine and errorColumn values. (Qt v3+)

bool setContent(const QByteArray &buffer, bool namespaceProcessing, QString *errorMsg = 0, int *errorLine = 0, int *errorColumn = 0);

This takes the buffer and namespaceProcessing parameters and returns a tuple containing the bool result and the errorMsg, errorLine and errorColumn values. (Qt v3+)

bool setContent(const QString &text, bool namespaceProcessing, QString *errorMsg = 0, int *errorLine = 0, int *errorColumn = 0);

This takes the text and namespaceProcessing parameters and returns a tuple containing the bool result and the errorMsg, errorLine and errorColumn values. (Qt v3+)

bool setContent(const QIODevice *dev, bool namespaceProcessing, QString *errorMsg = 0, int *errorLine = 0, int *errorColumn = 0);

This takes the dev and namespaceProcessing parameters and returns a tuple containing the bool result and the errorMsg, errorLine and errorColumn values. (Qt v3+)

bool setContent(const QCString &buffer, QString *errorMsg = 0, int *errorLine = 0, int *errorColumn = 0);

This takes the buffer parameter only and returns a tuple containing the bool result and the errorMsg, errorLine and errorColumn values. (Qt v3+)

bool setContent(const QByteArray &buffer, QString *errorMsg = 0, int *errorLine = 0, int *errorColumn = 0);

This takes the buffer parameter only and returns a tuple containing the bool result and the errorMsg, errorLine and errorColumn values. (Qt v3+)

bool setContent(const QString &text, QString *errorMsg = 0, int *errorLine = 0, int *errorColumn = 0);

This takes the text parameter only and returns a tuple containing the bool result and the errorMsg, errorLine and errorColumn values. (Qt v3+)

bool setContent(const QIODevice *dev, QString *errorMsg = 0, int *errorLine = 0, int *errorColumn = 0);

This takes the dev parameter only and returns a tuple containing the bool result and the errorMsg, errorLine and errorColumn values. (Qt v3+)

bool setContent(QXmlInputSource *source, QXmlReader *reader, QString *errorMsg = 0, int *errorLine = 0, int *errorColumn = 0);

Not yet implemented. (Qt v3.2.0+)


QDomDocumentFragment (Qt v2.2+)

QDomDocumentFragment is fully implemented.


QDomDocumentType (Qt v2.2+)

QDomDocumentType is fully implemented.


QDomNamedNodeMap (Qt v2.2+)

QDomNamedNodeMap is fully implemented.


QDomCharacterData (Qt v2.2+)

QDomCharacterData is fully implemented.


QDomAttr (Qt v2.2+)

QDomAttr is fully implemented.


QDomElement (Qt v2.2+)

QDomElement is fully implemented.


QDomText (Qt v2.2+)

QDomText is fully implemented.


QDomComment (Qt v2.2+)

QDomComment is fully implemented.


QDomCDATASection (Qt v2.2+)

QDomCDATASection is fully implemented.


QDomNotation (Qt v2.2+)

QDomNotation is fully implemented.


QDomEntity (Qt v2.2+)

QDomEntity is fully implemented.


QDomEntityReference (Qt v2.2+)

QDomEntityReference is fully implemented.


QDomProcessingInstruction (Qt v2.2+)

QDomProcessingInstruction is fully implemented.