Results 1 to 2 of 2

Thread: textedit and inserthtml

  1. #1
    Join Date
    Sep 2009
    Location
    Warsaw/Poland
    Posts
    56
    Thanks
    8
    Thanked 4 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default textedit and inserthtml

    Hello,

    I have texedit ..
    and I change font size ...
    Qt Code:
    1. textEdit->setFontPointSize(12);
    To copy to clipboard, switch view to plain text mode 
    and then everythink is ok, but if I add img
    Qt Code:
    1. textEdit->insertHtml("<img src=\""+emoticonFull+"\" alt=\""+emoticon+"\" />");
    To copy to clipboard, switch view to plain text mode 
    then text font before img is ok but after img is not this size ... and how can I change font to 12 after img ?
    I try:
    Qt Code:
    1. int iRealFontSize = textEdit->fontWeight(); // fix
    2. textEdit->insertHtml("<img src=\""+emoticonFull+"\" alt=\""+emoticon+"\" />");
    3. textEdit->setFontWeight(iRealFontSize); // fix
    To copy to clipboard, switch view to plain text mode 
    but it is not working ....

    Text before img and after I add by
    Qt Code:
    1. textEdit->insertPlainText(QString(strData[i]));
    To copy to clipboard, switch view to plain text mode 

    Example:
    Last edited by mero; 12th December 2009 at 18:45.

  2. #2
    Join Date
    Sep 2009
    Location
    Warsaw/Poland
    Posts
    56
    Thanks
    8
    Thanked 4 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: textedit and inserthtml

    OK, I found solution:
    Qt Code:
    1. QFont realfont = textEdit->currentFont();
    2. ....
    3. textEdit->setCurrentFont(realfont);
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. partly draw in textEdit.
    By gikidy in forum Qt Programming
    Replies: 1
    Last Post: 31st May 2009, 19:43

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.