Closed hanjinliu closed 8 months ago
The recent updates across various widget files in the project primarily focus on improving type checking mechanisms. Instead of creating new instances or directly converting types, the changes advocate for the use of assert
statements and isinstance
checks to ensure the correct types are being handled. This shift enhances code safety and clarity by explicitly verifying type expectations before proceeding with further operations.
Files | Change Summary |
---|---|
.../widgets/codeedit.py |
Replaced type conversion with assert for ev as QtGui.QKeyEvent . |
.../widgets/color.py |
Changed type assertion from creating QHelpEvent to using isinstance for event check. |
.../widgets/colormap.py |
Updated to assert a0 type as QtGui.QHelpEvent instead of type conversion. |
.../widgets/eval.py |
Modified to include an assert statement ensuring event is an instance of QtGui.QKeyEvent . |
🐇✨
In the land of code and widgetry,
A change was made, quite niftily.
No more casting, wild and free,
"Assert and check," they decree.
Safety first, the rabbit's plea.
🌟🐾
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
This PR fixes bugs in Qt6, as Qt6 cannot use events to construct events.
Summary by CodeRabbit