[Qt-interest] QListWidget increasingly slow

Josiah Bryan jbryan at productiveconcepts.com
Wed Nov 11 01:37:31 CET 2009


Bob Hood wrote:
> Josiah Bryan wrote:
>> Here's some actual HTML generated by a QTextEdit from plain text:
>>
>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" 
>> "http://www.w3.org/TR/REC-html40/strict.dtd"><html><head><meta 
>> name="qrichtext" content="1" /><style type="text/css">p, li { 
>> white-space: pre-wrap; }</style></head><body style="font-family:'Sans 
>> Serif'; font-size:9pt; font-weight:400; font-style:normal;"><p 
>> align="left" style="margin-top:0px; margin-bottom:0px; 
>> margin-left:0px; margin-right:0px; -qt-block-indent:0; 
>> text-indent:0px; background:red; color:white"><span style=" 
>> font-family:'Sans Serif'; color:white;background:red;font-size:9pt; 
>> font-weight:400;">Chorus 1</span></p></body></html>
>>
>> Does that render the word 'Chorus 1' white with red background?
> 
> Yes, it does.  Hmm.. So it might appear that I need to insert some kind 
> of header information each time the log widget is cleared.  I'll play 
> around with this and see if this solves my problem.  Thanks again.
> 

Check for a 'setPlainText()' method - I know QTextDocument has one. It 
generates the header info for you if you set the plain text (even an 
empty string, I guess). Then you can add HTML to the editor after that. 
Thats all just a theory - I havn't tried it myself that way. I've used 
the setPlainText on a QTextDocument, but I dont know if the text edit 
provides such a method.

-josiah




More information about the Qt-interest-old mailing list