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 annotations for QTableWidget #151 #189

Merged
merged 4 commits into from
Jan 6, 2022

Conversation

TilmanK
Copy link
Contributor

@TilmanK TilmanK commented Jan 4, 2022

Ok, so here's the PR. I've tested every method and indeed every one of them either returns a None when called with invalid values or accepts None as argument, which is convenient regarding use-cases like this:

row = table_widget.row(table_widget.itemAt(QPoint(42, 42)))

I'll update the PR later today with fixes for QListWidget and QTreeWidget as well.

@TilmanK
Copy link
Contributor Author

TilmanK commented Jan 5, 2022

@bluebird75 Go ahead, it's complete. I've confirmed in simple examples that the changes are correct - you can really build complex widget structures just by passing None around ;)

@bluebird75
Copy link
Collaborator

Nice.

Unrelated but I want to get started on PyQt6-stubs. Can you rejoin the thread on #69 ? I see that you have a repo with some code for it.

@bluebird75 bluebird75 merged commit 52ed479 into python-qt-tools:master Jan 6, 2022
@mkrieger1
Copy link
Contributor

I believe QTableWidget.cellWidget should return Optional[QWidget], not List[QWidget]. Can someone confirm that List[QWidget] was a mistake, or am I wrong?

(I already wrote an inline comment here, but I'm not sure if this triggered a notification for anybody involved.)

@altendky
Copy link
Collaborator

https://doc.qt.io/qt-5/qtablewidget.html#cellWidget

[QWidget](https://doc.qt.io/qt-5/qwidget.html#QWidget) *QTableWidget::cellWidget(int row, int column) const

Looks like it shouldn't be a List, yeah. It doesn't clearly state that the pointer can be NULL, but I'd guess it can be. Maybe you could explore at runtime to double check? And provide a pr?

@mkrieger1
Copy link
Contributor

Created #198.

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.

4 participants