I have a bold button that when selected can set the text and make it bold as follows:
QTextCursor cursor = this->ui->editNotes->textCursor();
QTextCharFormat format;
format.setFontWeight(QFont::Bold);
cursor.mergeCharFormat(format);
The question is how to press the same bold button and check if the selected text is bold? So if its already bold i will remove the bold from the same selection. Do I have to parse the html code? Example if I look at the text that I made bold the html data is:
<span style=" font-family:'Arial,Helvetica'; font-size:14px; font-weight:600; color:#313131;">functions</span>
Is there an easier method then parsing the attributes the text is wrapped in to check the font-weight? Or is this the only solution?