-#ifdef HAVE_KDE
- // Set highlighter back to active in case it was deactivated by too many errors.
- if (ui.inputEdit->highlighter())
- ui.inputEdit->highlighter()->setActive(true);
-#endif
+ // Make sure UI state follows
+ ui.boldButton->setChecked(false);
+ ui.italicButton->setChecked(false);
+ ui.underlineButton->setChecked(false);
+}
+
+
+void InputWidget::setFormatBold(const bool bold)
+{
+ // Apply formatting
+ QTextCharFormat fmt;
+ fmt.setFontWeight(bold ? QFont::Bold : QFont::Normal);
+ mergeFormatOnSelection(fmt);
+ // Make sure UI state follows
+ ui.boldButton->setChecked(bold);
+}
+
+
+void InputWidget::setFormatItalic(const bool italic)
+{
+ // Apply formatting
+ QTextCharFormat fmt;
+ fmt.setFontItalic(italic);
+ mergeFormatOnSelection(fmt);
+ // Make sure UI state follows
+ ui.italicButton->setChecked(italic);
+}
+
+
+void InputWidget::setFormatUnderline(const bool underline)
+{
+ // Apply formatting
+ QTextCharFormat fmt;
+ fmt.setFontUnderline(underline);
+ mergeFormatOnSelection(fmt);
+ // Make sure UI state follows
+ ui.underlineButton->setChecked(underline);