diff --git a/PySide2-stubs/QtWidgets.pyi b/PySide2-stubs/QtWidgets.pyi index cb35a6a..772bb12 100644 --- a/PySide2-stubs/QtWidgets.pyi +++ b/PySide2-stubs/QtWidgets.pyi @@ -3449,7 +3449,7 @@ class QGraphicsItem(Shiboken.Object): def contains(self, point:PySide2.QtCore.QPointF) -> bool: ... def contextMenuEvent(self, event:PySide2.QtWidgets.QGraphicsSceneContextMenuEvent) -> None: ... def cursor(self) -> PySide2.QtGui.QCursor: ... - def data(self, key:int) -> typing.Any: ... + def data(self, key:typing.Union[int, PySide2.QtCore.Qt.ItemDataRole]) -> typing.Any: ... def deviceTransform(self, viewportTransform:PySide2.QtGui.QTransform) -> PySide2.QtGui.QTransform: ... def dragEnterEvent(self, event:PySide2.QtWidgets.QGraphicsSceneDragDropEvent) -> None: ... def dragLeaveEvent(self, event:PySide2.QtWidgets.QGraphicsSceneDragDropEvent) -> None: ... @@ -3638,11 +3638,11 @@ class QGraphicsItem(Shiboken.Object): def setBoundingRegionGranularity(self, granularity:float) -> None: ... def setCacheMode(self, mode:PySide2.QtWidgets.QGraphicsItem.CacheMode, cacheSize:PySide2.QtCore.QSize=...) -> None: ... def setCursor(self, cursor: Union[PySide2.QtGui.QCursor, PySide2.QtCore.Qt.CursorShape]) -> None: ... - def setData(self, key:int, value:typing.Any) -> None: ... + def setData(self, key:typing.Union[int, PySide2.QtCore.Qt.ItemDataRole], value:typing.Any) -> None: ... def setEnabled(self, enabled:bool) -> None: ... def setFiltersChildEvents(self, enabled:bool) -> None: ... def setFlag(self, flag:PySide2.QtWidgets.QGraphicsItem.GraphicsItemFlag, enabled:bool=...) -> None: ... - def setFlags(self, flags:PySide2.QtWidgets.QGraphicsItem.GraphicsItemFlags) -> None: ... + def setFlags(self, flags:PySide2.QtWidgets.QGraphicsItem.GraphicsItemFlags|PySide2.QtWidgets.QGraphicsItem.GraphicsItemFlag) -> None: ... def setFocus(self, focusReason:PySide2.QtCore.Qt.FocusReason=...) -> None: ... def setFocusProxy(self, item:PySide2.QtWidgets.QGraphicsItem) -> None: ... def setGraphicsEffect(self, effect:PySide2.QtWidgets.QGraphicsEffect) -> None: ... @@ -4765,7 +4765,7 @@ class QGraphicsView(PySide2.QtWidgets.QAbstractScrollArea): def setOptimizationFlag(self, flag:PySide2.QtWidgets.QGraphicsView.OptimizationFlag, enabled:bool=...) -> None: ... def setOptimizationFlags(self, flags:PySide2.QtWidgets.QGraphicsView.OptimizationFlags) -> None: ... def setRenderHint(self, hint:PySide2.QtGui.QPainter.RenderHint, enabled:bool=...) -> None: ... - def setRenderHints(self, hints:PySide2.QtGui.QPainter.RenderHints) -> None: ... + def setRenderHints(self, hints:PySide2.QtGui.QPainter.RenderHints|PySide2.QtGui.QPainter.RenderHint) -> None: ... def setResizeAnchor(self, anchor:PySide2.QtWidgets.QGraphicsView.ViewportAnchor) -> None: ... def setRubberBandSelectionMode(self, mode:PySide2.QtCore.Qt.ItemSelectionMode) -> None: ... def setScene(self, scene:PySide2.QtWidgets.QGraphicsScene) -> None: ... @@ -5880,7 +5880,7 @@ class QListWidgetItem(Shiboken.Object): def backgroundColor(self) -> PySide2.QtGui.QColor: ... def checkState(self) -> PySide2.QtCore.Qt.CheckState: ... def clone(self) -> PySide2.QtWidgets.QListWidgetItem: ... - def data(self, role:int) -> typing.Any: ... + def data(self, role:typing.Union[int, PySide2.QtCore.Qt.ItemDataRole]) -> typing.Any: ... def flags(self) -> PySide2.QtCore.Qt.ItemFlags: ... def font(self) -> PySide2.QtGui.QFont: ... def foreground(self) -> PySide2.QtGui.QBrush: ... @@ -5892,7 +5892,7 @@ class QListWidgetItem(Shiboken.Object): def setBackground(self, brush: Union[PySide2.QtGui.QBrush, PySide2.QtGui.QColor]) -> None: ... def setBackgroundColor(self, color: Union[PySide2.QtGui.QColor, PySide2.QtCore.Qt.GlobalColor, str, int]) -> None: ... def setCheckState(self, state:PySide2.QtCore.Qt.CheckState) -> None: ... - def setData(self, role:int, value:typing.Any) -> None: ... + def setData(self, role:typing.Union[int, PySide2.QtCore.Qt.ItemDataRole], value:typing.Any) -> None: ... def setFlags(self, flags:PySide2.QtCore.Qt.ItemFlags) -> None: ... def setFont(self, font:PySide2.QtGui.QFont) -> None: ... def setForeground(self, brush: Union[PySide2.QtGui.QBrush, PySide2.QtGui.QColor]) -> None: ... diff --git a/tests/qgraphicsitem.py b/tests/qgraphicsitem.py new file mode 100644 index 0000000..f9757df --- /dev/null +++ b/tests/qgraphicsitem.py @@ -0,0 +1,11 @@ +from PySide2.QtCore import Qt +from PySide2.QtWidgets import QGraphicsItem + +class TestItem(QGraphicsItem): + pass + +a = TestItem() +a.setData(Qt.UserRole, {1: 11, 2: 22}) +_ = a.data(Qt.UserRole) + +a.setFlags(QGraphicsItem.ItemSendsScenePositionChanges) \ No newline at end of file diff --git a/tests/qgraphicsview.py b/tests/qgraphicsview.py new file mode 100644 index 0000000..3f2e1a5 --- /dev/null +++ b/tests/qgraphicsview.py @@ -0,0 +1,6 @@ +from PySide2.QtCore import Qt +from PySide2.QtGui import QPainter +from PySide2.QtWidgets import QGraphicsView + +a = QGraphicsView() +a.setRenderHints(QPainter.Antialiasing) diff --git a/tests/qlistwidgetitem.py b/tests/qlistwidgetitem.py new file mode 100644 index 0000000..fbcb722 --- /dev/null +++ b/tests/qlistwidgetitem.py @@ -0,0 +1,7 @@ +from PySide2.QtCore import Qt +from PySide2.QtWidgets import QListWidgetItem + +a = QListWidgetItem() +a.setData(Qt.UserRole, {1: 11, 2: 22}) +_ = a.data(Qt.UserRole) +