PDA

View Full Version : QTextEdit change Fontsize after using QTextCharFormat



cic
30th September 2013, 09:08
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:



void testTextView :: setInsertTextFont(const QFont& font)
{
QTextCharFormat fmt;
fmt.setFont(font);

QTextCursor cursor = m_edit -> textCursor();
cursor.mergeCharFormat(fmt);

m_edit -> mergeCurrentCharFormat(fmt);
}


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?