Skip to content

Signature of "method" incompatible with supertype "Class" [override] #1219

Discussion options

You must be logged in to vote

I found the actual answer is this:

class MyTabWidget(QtWidgets.QTabWidget):
    @typing.overload
    def addTab(
        self,
        widget: QtWidgets.QWidget,
        arg__2: str,
        /,
    ) -> int:  # noqa: D102  # Overloads don't get docstrings
        ...

    @typing.overload
    def addTab(
        self,
        widget: QtWidgets.QWidget,
        icon: QtGui.QIcon | QtGui.QPixmap,
        label: str,
        /,
    ) -> int:  # noqa: D102  # Overloads don't get docstrings
        ...

    def addTab(
        self,
        widget: QtWidgets.QWidget,
        icon: QtGui.QIcon | QtGui.QPixmap | str,
        label: str = '',
        /,
    ) -> int:
    # Implementation goes her…

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
3 replies
@adam-grant-hendry
Comment options

@Akuli
Comment options

@Akuli
Comment options

Comment options

You must be logged in to vote
1 reply
@adam-grant-hendry
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by adam-grant-hendry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants