Issue copying rich text from Qt applications

Post Reply
RubbleMonkey92
Posts: 1
Joined: Wed Sep 21, 2022 11:02 pm

Issue copying rich text from Qt applications

Post by RubbleMonkey92 »

More specifically when copying from applications using the QTextEdit Class TextMaker does not recognize bold text.
After some poking around I found the reason and two potential solutions.

The reason this happens is when copying text in Linux Qt stores it in the clipboard as plain text, HTML, and “rich text” according to the docs (confirmed by using xclip to examine the available targets in the clipboard).
The problem arises from the fact that the HTML version defines bold text as the inline style “font-weight:600” (which is 100 less than the standard CSS definition of bold text) which I would assume is not considered bold by TextMaker (understandably so).

The two fixes I can figure out are as follows:
Fix 1: Apply the bold formatting to any text styled with font-weight 600 or higher, as 400 to 500 are considered "normal" text this shouldn’t cause problems (I think).

Fix 2: Qt also stores the text as “rich text” according to the docs, however rather than using the mimetype application/rtf as you would expect it uses application/vnd.oasis.opendocument.text instead which as you might expect is the format .odt uses.
As TextMaker already supports that perhaps you could add that as a target for pasting text, maybe even targeting that by default if available.

As this is a rather specific problem that is honestly the Qt framework's fault, I understand if you don't view this as important enough to fix.
Post Reply

Return to “FreeOffice TextMaker 2021 for Linux”