Bug 503823

Summary: "Screenshot of Selection": Blurry with fractional scaling
Product: [Applications] kate Reporter: madness742
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: 25.04.0   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Screenshot taken at 100% scaling.
Screenshot (popup) taken at 100% scaling.
Screenshot taken at 125% scaling.
Screenshot (popup) taken at 125% scaling.
Showcase of the white space after the latest fix.

Description madness742 2025-05-06 04:20:55 UTC
Created attachment 180973 [details]
Screenshot taken at 100% scaling.

SUMMARY
When trying to save a screenshot of a selection with fractional scaling, the output is very blurry.

STEPS TO REPRODUCE
1. Set monitor to 125% scaling (Desktop -> Right Click -> Display Configuration).
2. Open Kate and browse to any document.
3. Select 1 or more lines
4. Right click and select "Take Screenshot of Selection".
5. Click on "copy".
6. Open Dolphin and paste the file.

Due to bug 503821 directly saving it doesn't work. You need to copy/paste the screenshot.

OBSERVED RESULT
The screenshot is much blurrier when fractional scaling is enabled.

EXPECTED RESULT
Image quality similar to screenshots taken at 100% scaling.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Fedora Linux 42
KDE Plasma Version: 6.3.4
KDE Frameworks Version: 6.13.0
Qt Version: 6.9.0

ADDITIONAL INFORMATION
- Launching Kate with `QT_SCALE_FACTOR_ROUNDING_POLICY=Ceil` drastically improves the image quality.
Comment 1 madness742 2025-05-06 04:21:22 UTC
Created attachment 180974 [details]
Screenshot (popup) taken at 100% scaling.
Comment 2 madness742 2025-05-06 04:21:40 UTC
Created attachment 180975 [details]
Screenshot taken at 125% scaling.
Comment 3 madness742 2025-05-06 04:21:52 UTC
Created attachment 180976 [details]
Screenshot (popup) taken at 125% scaling.
Comment 4 Waqar Ahmed 2025-05-06 05:20:47 UTC
Git commit d5ef4a26cf5be5a0a0a22782db54e5627e8857d8 by Waqar Ahmed.
Committed on 06/05/2025 at 05:20.
Pushed by waqar into branch 'master'.

Fix screenshot for hidpi displays

M  +3    -1    src/view/screenshotdialog.cpp

https://invent.kde.org/frameworks/ktexteditor/-/commit/d5ef4a26cf5be5a0a0a22782db54e5627e8857d8
Comment 5 madness742 2025-05-06 06:03:49 UTC
Thank you for the quick fix. I compiled it using `kde-builder` and noticed that text looks much better now, but it also adds quite a bit of white space to the screenshot.
Comment 6 madness742 2025-05-06 06:04:18 UTC
Created attachment 180981 [details]
Showcase of the white space after the latest fix.