connect(actionTextItalic,SIGNAL(triggered()),SLOT(textItalic()));...void WkDiary::textItalic(){ QTextCharFormat format; format.setFontItalic(actionTextItalic->isChecked()); mergeFormatOnWordOrSelection(format);}void WkDiary::mergeFormatOnWordOrSelection(const QTextCharFormat& format){ QTextCursor cursor = editor->textCursor(); if(!cursor.hasSelection()) cursor.select(QTextCursor::WordUnderCursor); cursor.mergeCharFormat(format); editor->mergeCurrentCharFormat(format);}
connect(actionTextItalic,SIGNAL(triggered(bool)),editor,SLOT(setFontItalic(bool)));