Skip to main content

qtcompat

Project description

qtcompat

A compatibility package to allow usage of PySide2, PyQt5 or PySide6 in Python applications. It has been written in OGS to allow our Python applications written in PyQt4 / PySide to migrate slowly to PyQt5 / Pyside2 and PySide6.

Install qtcompat

Run command:

pip3 install qtcompat 

For the bleeding edge install with:

pip3 install git+https://bitbucket.org/bvidmar/qtcompat

Usage

When writing a new package import all the modules required by it in its init.py file:

from qtcompat import (Signal, QtCore, Qt, QtGui, QtWidgets, LIB,                
    QAction, QShortcut)

and then import only the Qt modules needed by every new module from .

To write a single scrpit simply import the required modules from qtcompat:

from qtcompat import QtCore, QtGui, QtWidgets

Write applications using:

- QtCore
- QtGui
- QtWidgets
- QtOpenGL
- Signal
- Slot
- Property
- QOpenGLWidget
- QGLFormat
- QAction
- QShortcut
- Qt (shortcut for QtCore.Qt)

and the application will work with any of PySide2, PyQt5 or PySide6.

If more than one of these packages are installed qtcompat will pick the first one available in this order. To change this behaviour set the environment variable

QT_PREFERRED_LIB=PyQt5

or

QT_PREFERRED_LIB=PySide6

The selected package name will be available in the LIB attribute of qtcompat.

Who do I talk to?

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qtcompat-0.0.1a0.tar.gz (4.2 kB view hashes)

Uploaded Source

Built Distribution

qtcompat-0.0.1a0-py3-none-any.whl (3.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page