단일 문자에 대한 QTextCharFormat을 업데이트하려고합니다. 하지만이 적용되지 않습니다 :QTextEdit single QTextCharFormat
이QTextCursor cursor(document());
cursor.setPosition(4);
QTextCharFormat format;
format.setFontPointSize(sizeString.toInt());
cursor.mergeCharFormat(format);
qDebug() << "SET POS " << cursor.position() << " TO " << sizeString.toInt();
QTextCursor cursor2(document());
cursor.setPosition(4);
QTextCharFormat charformat = cursor2.charFormat();
QFont font = charformat.font();
qDebug() << " LOADED FONTSIZE: " << font.pointSize();
출력 :
SET POS 4 TO 16
LOADED FONTSIZE: 36
어떤 생각이 무엇을 놓치고? 올바른 사용의
커서에 익숙하지 않지만 선택 (moveCursor 및 앵커를 유지하여 일부 텍스트를 선택해야 함)하지 않아도됩니까? – Hayt
난 그냥이 시도 .. 내가 변경된 QTextCharFormat 적용하려면 오른쪽 함수가 누락 된 것 같아 – wutzebaer
여기 예제를 확인하십시오 : http://doc.qt.io/qt-5/richtext-cursor.html " 서식있는 텍스트 조작 " – Hayt