Skip to content

Construct pure virtual methods in inherited classes#340

Closed
rcalixte wants to merge 6 commits into
mappu:masterfrom
rcalixte:fix_virtuals
Closed

Construct pure virtual methods in inherited classes#340
rcalixte wants to merge 6 commits into
mappu:masterfrom
rcalixte:fix_virtuals

Conversation

@rcalixte

@rcalixte rcalixte commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

This unfortunately ends up as a sort of breaking change. Now that the base implementations are defined, they are returning 0 in some cases. The result is that not setting an override means a 0 value being returned for something like the column count, leading to an empty-looking model where Qt's private default may return 1 (in the case of QAbstractListModel but not QAbstractTableModel). The fix is mechanical but it's still a breaking change. I've updated the examples that I could find that were impacted.

While it's not strictly marshalling in the purest sense, the tests are for validation that can otherwise only be seen visually. Would it make sense to split the tests into a new testing nomenclature?

cc @arnetheduck

@rcalixte rcalixte marked this pull request as draft July 2, 2026 14:29
@rcalixte

rcalixte commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

I think I'm going to close this in favor of #341. I believe these methods are not meant for overrides and that we just need to address the panics in order to resolve #246.

@rcalixte rcalixte closed this Jul 2, 2026
@rcalixte rcalixte deleted the fix_virtuals branch July 2, 2026 14:31
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.

Panic "can only override virtual methods for directly constructed types" when calling a parent class override method

1 participant