AnyQt

AnyQt.availableapi()

Return a list of available Qt interfaces.

AnyQt.setpreferredapi(api)

Set the preferred Qt API.

Will raise a RuntimeError if a Qt API was already selected.

Note that QT_API environment variable (if set) will take precedence.

AnyQt.selectapi(api)

Select an Qt API to use.

This can only be set once and before any of the Qt modules are explicitly imported.

AnyQt.USED_API = None

AnyQt.QtCore

Export a Qt5 compatible QtCore module.

  • PyQt5: Full PyQt5.QtCore module is reexported
  • PyQt4: Full PyQt4.QtCore module is reexported and in addition QAbstractProxyModel, QIdentityProxyModel, QItemSelection, QItemSelectionModel, QItemSelectionRange, QSortFilterProxyModel, QStringListModel, are imported from PyQt4.QtGui

Note

The folowing are not available when using PyQt5:
  • ‘QAbstractFileEngine’
  • ‘QAbstractFileEngineHandler’
  • ‘QAbstractFileEngineIterator’
  • ‘QFSFileEngine’
  • ‘QPyNullVariant’
  • ‘QSystemLocale’
  • ‘SIGNAL’
  • ‘SLOT’
  • ‘qInstallMsgHandler’
  • ‘qSwap’

Note

QUrl in Qt5 has a different interface (some functionality was split into QUrlParse). No attempt is made to taper over the differences.

  • QSignalMapper imported from this module has mappedInt, mappedString, mappedObject and mappedWidget signals defined even when not present in Qt < 5.15. Use these instead of deprecated mapped overloads for forward compatibility with Qt6

    Note

    A subclass of the real QSignalMapper is used.

Use AnyQt.QtCore.QT_VERSION to check if a feature is present.

AnyQt.QtGui

Export a Qt5 compatible QtGui module.

  • PyQt5: Full PyQt5.QtGui module is reexported
  • PyQt4: The following members are imported from PyQt4.QtGui:
    • ‘QAbstractTextDocumentLayout’
    • ‘QActionEvent’
    • ‘QBitmap’
    • ‘QBrush’
    • ‘QClipboard’
    • ‘QCloseEvent’
    • ‘QColor’
    • ‘QConicalGradient’
    • ‘QContextMenuEvent’
    • ‘QCursor’
    • ‘QDesktopServices’
    • ‘QDoubleValidator’
    • ‘QDrag’
    • ‘QDragEnterEvent’
    • ‘QDragLeaveEvent’
    • ‘QDragMoveEvent’
    • ‘QDropEvent’
    • ‘QFileOpenEvent’
    • ‘QFocusEvent’
    • ‘QFont’
    • ‘QFontDatabase’
    • ‘QFontInfo’
    • ‘QFontMetrics’
    • ‘QFontMetricsF’
    • ‘QGlyphRun’
    • ‘QGradient’
    • ‘QHelpEvent’
    • ‘QHideEvent’
    • ‘QHoverEvent’
    • ‘QIcon’
    • ‘QIconDragEvent’
    • ‘QIconEngine’
    • ‘QImage’
    • ‘QImageIOHandler’
    • ‘QImageReader’
    • ‘QImageWriter’
    • ‘QInputEvent’
    • ‘QInputMethodEvent’
    • ‘QIntValidator’
    • ‘QKeyEvent’
    • ‘QKeySequence’
    • ‘QLinearGradient’
    • ‘QMatrix2x2’
    • ‘QMatrix2x3’
    • ‘QMatrix2x4’
    • ‘QMatrix3x2’
    • ‘QMatrix3x3’
    • ‘QMatrix3x4’
    • ‘QMatrix4x2’
    • ‘QMatrix4x3’
    • ‘QMatrix4x4’
    • ‘QMouseEvent’
    • ‘QMoveEvent’
    • ‘QMovie’
    • ‘QPaintDevice’
    • ‘QPaintEngine’
    • ‘QPaintEngineState’
    • ‘QPaintEvent’
    • ‘QPainter’
    • ‘QPainterPath’
    • ‘QPainterPathStroker’
    • ‘QPalette’
    • ‘QPen’
    • ‘QPicture’
    • ‘QPictureIO’
    • ‘QPixmap’
    • ‘QPixmapCache’
    • ‘QPolygon’
    • ‘QPolygonF’
    • ‘QQuaternion’
    • ‘QRadialGradient’
    • ‘QRawFont’
    • ‘QRegExpValidator’
    • ‘QRegion’
    • ‘QResizeEvent’
    • ‘QSessionManager’
    • ‘QShortcutEvent’
    • ‘QShowEvent’
    • ‘QStandardItem’
    • ‘QStandardItemModel’
    • ‘QStaticText’
    • ‘QStatusTipEvent’
    • ‘QSyntaxHighlighter’
    • ‘QTabletEvent’
    • ‘QTextBlock’
    • ‘QTextBlockFormat’
    • ‘QTextBlockGroup’
    • ‘QTextBlockUserData’
    • ‘QTextCharFormat’
    • ‘QTextCursor’
    • ‘QTextDocument’
    • ‘QTextDocumentFragment’
    • ‘QTextDocumentWriter’
    • ‘QTextFormat’
    • ‘QTextFragment’
    • ‘QTextFrame’
    • ‘QTextFrameFormat’
    • ‘QTextImageFormat’
    • ‘QTextInlineObject’
    • ‘QTextItem’
    • ‘QTextLayout’
    • ‘QTextLength’
    • ‘QTextLine’
    • ‘QTextList’
    • ‘QTextListFormat’
    • ‘QTextObject’
    • ‘QTextObjectInterface’
    • ‘QTextOption’
    • ‘QTextTable’
    • ‘QTextTableCell’
    • ‘QTextTableCellFormat’
    • ‘QTextTableFormat’
    • ‘QTouchEvent’
    • ‘QTransform’
    • ‘QValidator’
    • ‘QVector2D’
    • ‘QVector3D’
    • ‘QVector4D’
    • ‘QWhatsThisClickedEvent’
    • ‘QWheelEvent’
    • ‘QWindowStateChangeEvent’
    • ‘qAlpha’
    • ‘qBlue’
    • ‘qFuzzyCompare’
    • ‘qGray’
    • ‘qGreen’
    • ‘qIsGray’
    • ‘qRed’
    • ‘qRgb’
    • ‘qRgba’
  • When using a Qt4 API, the QWheelEvent gains a Qt5 compatible angleDelta() method.
  • A backported QGuiApplication.screenAt static method is added if not implemented by Qt5
  • A QFontMetrics(F).horizontalAdvance method is made available if not present in Qt (<5.11)
  • An missing QPdfWriter.setPageSize(QPageSize) overload for PyQt5 is added.

AnyQt.QtWidgets

Export a Qt5 compatible QtWidgets module

  • PyQt5: Full PyQt5.QtWidgets module is reexported
  • PyQt4: The following members from PyQt4.QtGui are exported:
    • ‘QAbstractButton’
    • ‘QAbstractGraphicsShapeItem’
    • ‘QAbstractItemDelegate’
    • ‘QAbstractItemView’
    • ‘QAbstractScrollArea’
    • ‘QAbstractSlider’
    • ‘QAbstractSpinBox’
    • ‘QAction’
    • ‘QActionGroup’
    • ‘QApplication’
    • ‘QBoxLayout’
    • ‘QButtonGroup’
    • ‘QCalendarWidget’
    • ‘QCheckBox’
    • ‘QColorDialog’
    • ‘QColumnView’
    • ‘QComboBox’
    • ‘QCommandLinkButton’
    • ‘QCommonStyle’
    • ‘QCompleter’
    • ‘QDataWidgetMapper’
    • ‘QDateEdit’
    • ‘QDateTimeEdit’
    • ‘QDesktopWidget’
    • ‘QDial’
    • ‘QDialog’
    • ‘QDialogButtonBox’
    • ‘QDirModel’
    • ‘QDockWidget’
    • ‘QDoubleSpinBox’
    • ‘QErrorMessage’
    • ‘QFileDialog’
    • ‘QFileIconProvider’
    • ‘QFileSystemModel’
    • ‘QFocusFrame’
    • ‘QFontComboBox’
    • ‘QFontDialog’
    • ‘QFormLayout’
    • ‘QFrame’
    • ‘QGesture’
    • ‘QGestureEvent’
    • ‘QGestureRecognizer’
    • ‘QGraphicsAnchor’
    • ‘QGraphicsAnchorLayout’
    • ‘QGraphicsBlurEffect’
    • ‘QGraphicsColorizeEffect’
    • ‘QGraphicsDropShadowEffect’
    • ‘QGraphicsEffect’
    • ‘QGraphicsEllipseItem’
    • ‘QGraphicsGridLayout’
    • ‘QGraphicsItem’
    • ‘QGraphicsItemGroup’
    • ‘QGraphicsLayout’
    • ‘QGraphicsLayoutItem’
    • ‘QGraphicsLineItem’
    • ‘QGraphicsLinearLayout’
    • ‘QGraphicsObject’
    • ‘QGraphicsOpacityEffect’
    • ‘QGraphicsPathItem’
    • ‘QGraphicsPixmapItem’
    • ‘QGraphicsPolygonItem’
    • ‘QGraphicsProxyWidget’
    • ‘QGraphicsRectItem’
    • ‘QGraphicsRotation’
    • ‘QGraphicsScale’
    • ‘QGraphicsScene’
    • ‘QGraphicsSceneContextMenuEvent’
    • ‘QGraphicsSceneDragDropEvent’
    • ‘QGraphicsSceneEvent’
    • ‘QGraphicsSceneHelpEvent’
    • ‘QGraphicsSceneHoverEvent’
    • ‘QGraphicsSceneMouseEvent’
    • ‘QGraphicsSceneMoveEvent’
    • ‘QGraphicsSceneResizeEvent’
    • ‘QGraphicsSceneWheelEvent’
    • ‘QGraphicsSimpleTextItem’
    • ‘QGraphicsTextItem’
    • ‘QGraphicsTransform’
    • ‘QGraphicsView’
    • ‘QGraphicsWidget’
    • ‘QGridLayout’
    • ‘QGroupBox’
    • ‘QHBoxLayout’
    • ‘QHeaderView’
    • ‘QInputDialog’
    • ‘QItemDelegate’
    • ‘QItemEditorCreatorBase’
    • ‘QItemEditorFactory’
    • ‘QKeyEventTransition’
    • ‘QLCDNumber’
    • ‘QLabel’
    • ‘QLayout’
    • ‘QLayoutItem’
    • ‘QLineEdit’
    • ‘QListView’
    • ‘QListWidget’
    • ‘QListWidgetItem’
    • ‘QMacCocoaViewContainer’
    • ‘QMainWindow’
    • ‘QMdiArea’
    • ‘QMdiSubWindow’
    • ‘QMenu’
    • ‘QMenuBar’
    • ‘QMessageBox’
    • ‘QMouseEventTransition’
    • ‘QPanGesture’
    • ‘QPinchGesture’
    • ‘QPlainTextDocumentLayout’
    • ‘QPlainTextEdit’
    • ‘QProgressBar’
    • ‘QProgressDialog’
    • ‘QPushButton’
    • ‘QRadioButton’
    • ‘QRubberBand’
    • ‘QScrollArea’
    • ‘QScrollBar’
    • ‘QShortcut’
    • ‘QSizeGrip’
    • ‘QSizePolicy’
    • ‘QSlider’
    • ‘QSpacerItem’
    • ‘QSpinBox’
    • ‘QSplashScreen’
    • ‘QSplitter’
    • ‘QSplitterHandle’
    • ‘QStackedLayout’
    • ‘QStackedWidget’
    • ‘QStatusBar’
    • ‘QStyle’
    • ‘QStyleFactory’
    • ‘QStyleHintReturn’
    • ‘QStyleHintReturnMask’
    • ‘QStyleHintReturnVariant’
    • ‘QStyleOption’
    • ‘QStyleOptionButton’
    • ‘QStyleOptionComboBox’
    • ‘QStyleOptionComplex’
    • ‘QStyleOptionDockWidget’
    • ‘QStyleOptionFocusRect’
    • ‘QStyleOptionFrame’
    • ‘QStyleOptionGraphicsItem’
    • ‘QStyleOptionGroupBox’
    • ‘QStyleOptionHeader’
    • ‘QStyleOptionMenuItem’
    • ‘QStyleOptionProgressBar’
    • ‘QStyleOptionRubberBand’
    • ‘QStyleOptionSizeGrip’
    • ‘QStyleOptionSlider’
    • ‘QStyleOptionSpinBox’
    • ‘QStyleOptionTab’
    • ‘QStyleOptionTabBarBase’
    • ‘QStyleOptionTabWidgetFrame’
    • ‘QStyleOptionTitleBar’
    • ‘QStyleOptionToolBar’
    • ‘QStyleOptionToolBox’
    • ‘QStyleOptionToolButton’
    • ‘QStyleOptionViewItem’
    • ‘QStylePainter’
    • ‘QStyledItemDelegate’
    • ‘QSwipeGesture’
    • ‘QSystemTrayIcon’
    • ‘QTabBar’
    • ‘QTabWidget’
    • ‘QTableView’
    • ‘QTableWidget’
    • ‘QTableWidgetItem’
    • ‘QTableWidgetSelectionRange’
    • ‘QTapAndHoldGesture’
    • ‘QTapGesture’
    • ‘QTextBrowser’
    • ‘QTextEdit’
    • ‘QTimeEdit’
    • ‘QToolBar’
    • ‘QToolBox’
    • ‘QToolButton’
    • ‘QToolTip’
    • ‘QTreeView’
    • ‘QTreeWidget’
    • ‘QTreeWidgetItem’
    • ‘QTreeWidgetItemIterator’
    • ‘QUndoCommand’
    • ‘QUndoGroup’
    • ‘QUndoStack’
    • ‘QUndoView’
    • ‘QVBoxLayout’
    • ‘QWIDGETSIZE_MAX’
    • ‘QWhatsThis’
    • ‘QWidget’
    • ‘QWidgetAction’
    • ‘QWidgetItem’
    • ‘QWizard’
    • ‘QWizardPage’
    • ‘qApp’
    • ‘qDrawBorderPixmap’
    • ‘qDrawPlainRect’
    • ‘qDrawShadeLine’
    • ‘qDrawShadePanel’
    • ‘qDrawShadeRect’
    • ‘qDrawWinButton’
    • ‘qDrawWinPanel’
  • QFileDialog’s get{Open,Save}Filename provide a consistent PyQt5 compatible interface (i.e. they return (filename: str, format: str) tuple.

  • QHeaderView provides a consistent forward compatible methods:
    • QHeaderView.setSectionResizeMode()
    • QHeaderView.sectionResizeMode()
    • QHeaderView.sectionsClickable()
    • QHeaderView.setSectionsClickable()
    • QHeaderView.sectionsMovable()
    • QHeaderView.setSectionsMovable()
  • The versioned QStyleOption subclasses in PyQt4.QtGui are renamed to their unversioned conterpart (e.g. the QStyleOptionViewItemV4 is exported as QStyleOptionViewItem

  • A forward compatile QWidget.grab() method is made available when using a Qt4 backend

  • A QWidget.screen() method is made available when not present in Qt5 (<5.14).

  • QButtonGroup imported from this module has idClicked, idPressed, idReleased and idToggled signals defined even when not present in Qt < 5.15. Use these instead of clicked[int], pressed[int] and toggled[int] overloads for compatibility with Qt6 where they are removed.

    Note

    A subclass of the real QGroupBox is used.

  • QComboBox imported from this module has textActivated and textHighlighted signals defined even when not present in Qt < 5.14. Use these instead of activated[int] and highlighted[int] overloads for compatibility with Qt6 where they are removed.

    Note

    A subclass of the real QComboBox is used.

AnyQt.QtMultimedia

AnyQt.QtMultimediaWidgets

Qt5-only QtMultimediaWidgets module.

AnyQt.QtNetwork

AnyQt.QtPrintSupport

Export a Qt5 compatible QtPrintSupport module.

AnyQt.Qml

Qt5-only Qml module.

AnyQt.QtQuick

Qt5-only QtQuick module.

AnyQt.QtSql

AnyQt.QtSvg

AnyQt.QtTest

A PyQt5 API compatible QSignalSpy class is provided when using PyQt4 backend

AnyQt.QtDBus

AnyQt.QtDesigner

AnyQt.QtHelp

AnyQt.QtMacExtras

  • PyQt5: Full PyQt5.QtMacExtras is reexported
  • PyQt4: QMacPasteboardMime is imported from PyQt4.QtGui

AnyQt.QtOpenGL

AnyQt.QtWebChannel

Export a Qt5 compatible QtWebChannel module.

AnyQt.QtWebEngineWidgets

Qt5-only QtWebEngineWidgets module.

AnyQt.QtWebKit

Export a Qt5 compatible QtWebKit module.

AnyQt.QtWebKitWidgets

Export a Qt5 compatible QtWebKitWidgets module.

AnyQt.QtWebSockets

Qt5-only QtWebSockets module.

AnyQt.QtWinExtras

Qt5-only QtWinExtras module.

AnyQt.QtX11Extras

  • Qt5: Full QtX11Extras is reexported
  • Qt4: QX11Info is imported from QtGui

AnyQt.QtXml

AnyQt.QtXmlPatterns

AnyQt.sip

When using a PyQt4/5 then this is an alias for the corresponding sip module