Hello, basicaly i want to check if the selected word in textEdit is bold already or not, if it’s bold, then to check the bold button, if not, don’t do anything. this is the code, what’s wrong?
QTextCursor tc = ui->textEdit->textCursor();
tc.select(QTextCursor::WordUnderCursor);
if(tc.charFormat().fontWeight() == QFont::Bold) {
ui->actionBold->setChecked(true);
}
↧