Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix return type of QTableWidget.cellWidget #198

Merged
merged 3 commits into from
Nov 22, 2022
Merged

Fix return type of QTableWidget.cellWidget #198

merged 3 commits into from
Nov 22, 2022

Conversation

mkrieger1
Copy link
Contributor

cellWidget returns a QWidget if it exists, or None if it doesn't exist.

Confirmed by this short script:

from PyQt5 import QtCore, QtWidgets

print(f'Qt {QtCore.QT_VERSION_STR}')
print(f'PyQt {QtCore.PYQT_VERSION_STR}')

app = QtWidgets.QApplication(['foo'])
table = QtWidgets.QTableWidget(1, 1)

# empty cell inside table
print(table.cellWidget(0, 0))

# filled cell inside table
table.setCellWidget(0, 0, QtWidgets.QWidget())
print(table.cellWidget(0, 0))

# cell outside table
print(table.cellWidget(99, 99))

Output:

Qt 5.15.2
PyQt 5.15.6
None
<PyQt5.QtWidgets.QWidget object at 0x7fa13208bca0>
None

@altendky
Copy link
Collaborator

Looking at fixing main CI in #199.

@altendky altendky closed this Nov 22, 2022
@altendky altendky reopened this Nov 22, 2022
@altendky
Copy link
Collaborator

I hope you don't mind me jumping in and pushing a few details here. Just saves the back and forth which can be long when I know I haven't been particularly responsive.

But, thanks for the correction!

@altendky altendky merged commit bfac825 into python-qt-tools:master Nov 22, 2022
@mkrieger1
Copy link
Contributor Author

Sure, thanks!

@bluebird75
Copy link
Collaborator

If you can add a test for this, that would be even better. The spirit of the tests is to run very small code snippets and make sure they typecheck correctly.

@mkrieger1
Copy link
Contributor Author

I will look into it.

mkrieger1 added a commit to mkrieger1/PyQt5-stubs that referenced this pull request Dec 16, 2022
altendky added a commit that referenced this pull request Dec 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants