Results 1 to 1 of 1

Thread: QTextEdit change Fontsize after using QTextCharFormat

  1. #1
    Join Date
    Nov 2011
    Location
    Karlsruhe, Germany
    Posts
    57
    Thanks
    10
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Windows

    Smile QTextEdit change Fontsize after using QTextCharFormat

    Hi all,

    after calling QTextCharFormat to set specific words' font size,

    i cannot update the whole text's font anymore.

    For example:

    I have an idea.

    "an idea" is changed by the function below:

    Qt Code:
    1. void testTextView :: setInsertTextFont(const QFont& font)
    2. {
    3. fmt.setFont(font);
    4.  
    5. QTextCursor cursor = m_edit -> textCursor();
    6. cursor.mergeCharFormat(fmt);
    7.  
    8. m_edit -> mergeCurrentCharFormat(fmt);
    9. }
    To copy to clipboard, switch view to plain text mode 

    then when I called QTextEdit::setFont() and zoomIn()/zoomOut(), only "I have" change to the size I wanted,
    but "an idea" remains the same state as before.

    any idea to fix the problem?
    Last edited by cic; 30th September 2013 at 10:05.

Similar Threads

  1. Update characters QTextCharFormat in QTextEdit
    By Suppaman in forum Qt Programming
    Replies: 2
    Last Post: 27th July 2013, 10:31
  2. how to set fontsize for label?
    By BalaQT in forum Qt Programming
    Replies: 3
    Last Post: 18th September 2009, 17:02
  3. how to change QTextEdit background color ?
    By mismael85 in forum Qt Programming
    Replies: 9
    Last Post: 26th June 2008, 22:05
  4. Change margin on QTextEdit print()
    By Dii in forum Qt Programming
    Replies: 2
    Last Post: 20th May 2008, 22:45
  5. Replies: 2
    Last Post: 9th March 2007, 23:19

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.