ui.boldButton->setIcon(icon::get("format-text-bold"));
ui.italicButton->setIcon(icon::get("format-text-italic"));
ui.underlineButton->setIcon(icon::get("format-text-underline"));
+ ui.strikethroughButton->setIcon(icon::get("format-text-strikethrough"));
ui.clearButton->setIcon(icon::get("edit-clear"));
ui.encryptionIconLabel->hide();
setFormatUnderline(!ui.underlineButton->isChecked());
}
+void InputWidget::toggleFormatStrikethrough()
+{
+ setFormatStrikethrough(!ui.strikethroughButton->isChecked());
+}
+
void InputWidget::clearFormat()
{
// Clear all formatting for selection (not global)
QTextCharFormat fmt;
fmt.setFontWeight(QFont::Normal);
fmt.setFontUnderline(false);
+ fmt.setFontStrikeOut(false);
fmt.setFontItalic(false);
fmt.clearForeground();
fmt.clearBackground();
ui.boldButton->setChecked(false);
ui.italicButton->setChecked(false);
ui.underlineButton->setChecked(false);
+ ui.strikethroughButton->setChecked(false);
}
void InputWidget::setFormatBold(const bool bold)
ui.underlineButton->setChecked(underline);
}
+void InputWidget::setFormatStrikethrough(const bool strike)
+{
+ // Apply formatting
+ QTextCharFormat fmt;
+ fmt.setFontStrikeOut(strike);
+ mergeFormatOnSelection(fmt);
+ // Make sure UI state follows
+ ui.strikethroughButton->setChecked(strike);
+}
+
void InputWidget::mergeFormatOnSelection(const QTextCharFormat& format)
{
QTextCursor cursor = inputLine()->textCursor();
setFormatUnderline(checked);
}
+void InputWidget::on_strikethroughButton_clicked(bool checked)
+{
+ setFormatStrikethrough(checked);
+}
+
void InputWidget::on_italicButton_clicked(bool checked)
{
setFormatItalic(checked);
ui.boldButton->setChecked(f.bold());
ui.italicButton->setChecked(f.italic());
ui.underlineButton->setChecked(f.underline());
+ ui.strikethroughButton->setChecked(f.strikeOut());
}
void InputWidget::colorChosen(QAction* action)