doc: update v3.3 release notes draft
[git-cola.git] / qtpy / QtWidgets.py
blob739f9ce146d7d7a4f95e026a7f1ff58163761bf3
1 # -*- coding: utf-8 -*-
3 # Copyright © 2014-2015 Colin Duquesnoy
4 # Copyright © 2009- The Spyder Developmet Team
6 # Licensed under the terms of the MIT License
7 # (see LICENSE.txt for details)
9 """
10 Provides widget classes and functions.
11 .. warning:: Only PyQt4/PySide QtGui classes compatible with PyQt5.QtWidgets
12 are exposed here. Therefore, you need to treat/use this package as if it
13 were the ``PyQt5.QtWidgets`` module.
14 """
16 from . import PYQT5, PYSIDE2, PYQT4, PYSIDE, PythonQtError
17 from ._patch.qcombobox import patch_qcombobox
18 from ._patch.qheaderview import introduce_renamed_methods_qheaderview
21 if PYQT5:
22 from PyQt5.QtWidgets import *
23 elif PYSIDE2:
24 from PySide2.QtWidgets import *
25 elif PYQT4:
26 from PyQt4.QtGui import *
27 QStyleOptionViewItem = QStyleOptionViewItemV4
28 del QStyleOptionViewItemV4
30 # These objects belong to QtGui
31 try:
32 # Older versions of PyQt4 do not provide these
33 del (QGlyphRun,
34 QMatrix2x2, QMatrix2x3, QMatrix2x4, QMatrix3x2, QMatrix3x3,
35 QMatrix3x4, QMatrix4x2, QMatrix4x3, QMatrix4x4,
36 QQuaternion, QRadialGradient, QRawFont, QRegExpValidator,
37 QStaticText, QTouchEvent, QVector2D, QVector3D, QVector4D,
38 qFuzzyCompare)
39 except NameError:
40 pass
41 del (QAbstractTextDocumentLayout, QActionEvent, QBitmap, QBrush, QClipboard,
42 QCloseEvent, QColor, QConicalGradient, QContextMenuEvent, QCursor,
43 QDesktopServices, QDoubleValidator, QDrag, QDragEnterEvent,
44 QDragLeaveEvent, QDragMoveEvent, QDropEvent, QFileOpenEvent,
45 QFocusEvent, QFont, QFontDatabase, QFontInfo, QFontMetrics,
46 QFontMetricsF, QGradient, QHelpEvent, QHideEvent,
47 QHoverEvent, QIcon, QIconDragEvent, QIconEngine, QImage,
48 QImageIOHandler, QImageReader, QImageWriter, QInputEvent,
49 QInputMethodEvent, QKeyEvent, QKeySequence, QLinearGradient,
50 QMouseEvent, QMoveEvent, QMovie, QPaintDevice, QPaintEngine,
51 QPaintEngineState, QPaintEvent, QPainter, QPainterPath,
52 QPainterPathStroker, QPalette, QPen, QPicture, QPictureIO, QPixmap,
53 QPixmapCache, QPolygon, QPolygonF,
54 QRegion, QResizeEvent, QSessionManager, QShortcutEvent, QShowEvent,
55 QStandardItem, QStandardItemModel, QStatusTipEvent,
56 QSyntaxHighlighter, QTabletEvent, QTextBlock, QTextBlockFormat,
57 QTextBlockGroup, QTextBlockUserData, QTextCharFormat, QTextCursor,
58 QTextDocument, QTextDocumentFragment, QTextDocumentWriter,
59 QTextFormat, QTextFragment, QTextFrame, QTextFrameFormat,
60 QTextImageFormat, QTextInlineObject, QTextItem, QTextLayout,
61 QTextLength, QTextLine, QTextList, QTextListFormat, QTextObject,
62 QTextObjectInterface, QTextOption, QTextTable, QTextTableCell,
63 QTextTableCellFormat, QTextTableFormat, QTransform,
64 QValidator, QWhatsThisClickedEvent,
65 QWheelEvent, QWindowStateChangeEvent, qAlpha, qBlue,
66 qGray, qGreen, qIsGray, qRed, qRgb, qRgba, QIntValidator,
67 QStringListModel)
69 # These objects belong to QtPrintSupport
70 del (QAbstractPrintDialog, QPageSetupDialog, QPrintDialog, QPrintEngine,
71 QPrintPreviewDialog, QPrintPreviewWidget, QPrinter, QPrinterInfo)
73 # These objects belong to QtCore
74 del (QItemSelection, QItemSelectionModel, QItemSelectionRange,
75 QSortFilterProxyModel)
77 # Patch QComboBox to allow Python objects to be passed to userData
78 patch_qcombobox(QComboBox)
80 # QHeaderView: renamed methods
81 introduce_renamed_methods_qheaderview(QHeaderView)
83 elif PYSIDE:
84 from PySide.QtGui import *
85 QStyleOptionViewItem = QStyleOptionViewItemV4
86 del QStyleOptionViewItemV4
88 # These objects belong to QtGui
89 del (QAbstractTextDocumentLayout, QActionEvent, QBitmap, QBrush, QClipboard,
90 QCloseEvent, QColor, QConicalGradient, QContextMenuEvent, QCursor,
91 QDesktopServices, QDoubleValidator, QDrag, QDragEnterEvent,
92 QDragLeaveEvent, QDragMoveEvent, QDropEvent, QFileOpenEvent,
93 QFocusEvent, QFont, QFontDatabase, QFontInfo, QFontMetrics,
94 QFontMetricsF, QGradient, QHelpEvent, QHideEvent,
95 QHoverEvent, QIcon, QIconDragEvent, QIconEngine, QImage,
96 QImageIOHandler, QImageReader, QImageWriter, QInputEvent,
97 QInputMethodEvent, QKeyEvent, QKeySequence, QLinearGradient,
98 QMatrix2x2, QMatrix2x3, QMatrix2x4, QMatrix3x2, QMatrix3x3,
99 QMatrix3x4, QMatrix4x2, QMatrix4x3, QMatrix4x4, QMouseEvent,
100 QMoveEvent, QMovie, QPaintDevice, QPaintEngine, QPaintEngineState,
101 QPaintEvent, QPainter, QPainterPath, QPainterPathStroker, QPalette,
102 QPen, QPicture, QPictureIO, QPixmap, QPixmapCache, QPolygon,
103 QPolygonF, QQuaternion, QRadialGradient, QRegExpValidator,
104 QRegion, QResizeEvent, QSessionManager, QShortcutEvent, QShowEvent,
105 QStandardItem, QStandardItemModel, QStatusTipEvent,
106 QSyntaxHighlighter, QTabletEvent, QTextBlock, QTextBlockFormat,
107 QTextBlockGroup, QTextBlockUserData, QTextCharFormat, QTextCursor,
108 QTextDocument, QTextDocumentFragment,
109 QTextFormat, QTextFragment, QTextFrame, QTextFrameFormat,
110 QTextImageFormat, QTextInlineObject, QTextItem, QTextLayout,
111 QTextLength, QTextLine, QTextList, QTextListFormat, QTextObject,
112 QTextObjectInterface, QTextOption, QTextTable, QTextTableCell,
113 QTextTableCellFormat, QTextTableFormat, QTouchEvent, QTransform,
114 QValidator, QVector2D, QVector3D, QVector4D, QWhatsThisClickedEvent,
115 QWheelEvent, QWindowStateChangeEvent, qAlpha, qBlue, qGray, qGreen,
116 qIsGray, qRed, qRgb, qRgba, QIntValidator, QStringListModel)
118 # These objects belong to QtPrintSupport
119 del (QAbstractPrintDialog, QPageSetupDialog, QPrintDialog, QPrintEngine,
120 QPrintPreviewDialog, QPrintPreviewWidget, QPrinter, QPrinterInfo)
122 # These objects belong to QtCore
123 del (QItemSelection, QItemSelectionModel, QItemSelectionRange,
124 QSortFilterProxyModel)
126 # Patch QComboBox to allow Python objects to be passed to userData
127 patch_qcombobox(QComboBox)
129 # QHeaderView: renamed methods
130 introduce_renamed_methods_qheaderview(QHeaderView)
132 else:
133 raise PythonQtError('No Qt bindings could be found')