Lazarus
Programming => Widgetset => QT => Topic started by: sfeinst on January 24, 2012, 04:42:13 pm
-
I have an app which uses a TMemo. From what I understood, TMemo supports display of one font at a time. I highlighted some text on a web page and pasted it into the TMemo. On Windows, it works as expected and the text displays with the font of the TMemo. When I do this in QT on Linux, the text displayed using different fonts (as it appeared on the web page).
I am using PasteFromClipboard of the TMemo to paste the text.
Am I running into a bug/feature of TMemo on QT (I'm guessing the memo control being used by QT supports multiple fonts).
-
Yes, you reached half-baked class problem from qt.
http://doc.qt.nokia.com/4.7/qtextedit.html (it works with plain text (property is setted up), but when you paste something it does not take into account that property and it paste complete html and then it renders that part as rich text).
So that's why they introduced QPlainTextEdit class (it was easier than fix few bugs in QTextEdit ..i guess :) ).
http://doc.qt.nokia.com/4.7/qplaintextedit.html
That class is probably exact class we need for TMemo, so I'll try to implement TMemo handle via QPlainTextEdit and see if it helps.
-
Thanks for looking into this.
-
Yes, I've tried to fix it but QPlainTextEdit is missing alignment() and setAlignment() properties .. so not for 1.0.
-
Understood. I may just add code which captures the paste first, stores in string and then pastes the string, so there won;t be any formatting. A little bit of a kludge, but should work.
-
But I've fixed it in the meantime (problem was RTFM) :)
See r36171
-
Glad I only threatened to change my code instead of actually doing it :D
-
btw. you cannot capture paste under qt because there's no signal for that.