to handle text on QTextEdit , QTextCursor make the job ...
void FontText()
{
/* get existing font txt = QTextEdit */
bool ok;
if (ok) {
format.setFont(fontyour);
c.setCharFormat(format);
}
}
void FontText()
{
/* get existing font txt = QTextEdit */
QTextCursor c = txt->textCursor();
QTextCharFormat format = c.charFormat();
QFont f = format.font();
bool ok;
QFont fontyour = QFontDialog::getFont(&ok,f,0);
if (ok) {
format.setFont(fontyour);
c.setCharFormat(format);
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks