Fix Qt6 rendering: exclude from DIRECTUPDATE/QUICKUPDATE optimizations #625
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
When using LazPaint with the Qt6 widgetset, users may experience sluggish rendering and UI glitches during editing or zooming operations.
Root Cause
The
uimageview.pasfile defines two rendering optimizations:These optimizations:
Update()afterInvalidateRect()The original code (from 2020, commit b80b767) correctly excluded Qt5 from these optimizations, but Qt6 was not yet supported by Lazarus at that time and was not excluded.
Why Qt5/Qt6 Need Different Handling
Qt's paint system expects all painting to go through
paintEvent()handlers via the event loop. From Qt documentation:Qt6 maintains the same event-driven paint model as Qt5. In fact, Qt6 went further by deprecating
repaint()entirely, as synchronous painting "does not work well on modern systems."The direct update patterns that work on GTK conflict with Qt's event coalescing and can cause:
Solution
Add
and not defined(LCLqt6)to both conditional defines, matching the existing Qt5 exclusion:References
Testing
Built and verified application launches correctly on Arch Linux with Qt6Pas 6.2.9, FPC 3.2.2, Lazarus 3.8.