本文整理汇总了C++中QTextEdit::fontItalic方法的典型用法代码示例。如果您正苦于以下问题:C++ QTextEdit::fontItalic方法的具体用法?C++ QTextEdit::fontItalic怎么用?C++ QTextEdit::fontItalic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTextEdit
的用法示例。
在下文中一共展示了QTextEdit::fontItalic方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fontItalic
bool QTextEditProto::fontItalic() const
{
QTextEdit *item = qscriptvalue_cast<QTextEdit*>(thisObject());
if (item)
return item->fontItalic();
return false;
}
示例2: fontItalic
int TextEdit::fontItalic(lua_State * L) // const : bool
{
QTextEdit* obj = ObjectHelper<QTextEdit>::check( L, 1);
Lua::Util::push( L, obj->fontItalic() );
return 1;
}
示例3: execute
/*!
* \class TextCursorChangeFontFace
* \author Anders Fernström
* \date 2005-11-03
* \date 2006-01-13 (update)
*
* \brief Command for changing font face
*
* 2005-11-07 AF, Added function (case 4) in switch to change
* strikckout settings
* 2005-11-15 AF, added trick to get correct style on links
* 2006-01-13 AF, remove trick to get correct style on links because
* it made undo/redo work incorrectly
*/
void TextCursorChangeFontFace::execute()
{
QTextEdit *editor = document()->getCursor()->currentCell()->textEdit();
QFont font;
if( editor )
{
switch( face_ )
{
case 0: // Plain
editor->setFontWeight( QFont::Normal );
editor->setFontItalic( false );
editor->setFontUnderline( false );
font = editor->currentFont();
font.setStrikeOut( false );
editor->setCurrentFont( font );
break;
case 1: // Bold
if( editor->fontWeight() != QFont::Normal )
editor->setFontWeight( QFont::Normal );
else
editor->setFontWeight( QFont::Bold );
break;
case 2: // Italic
if( editor->fontItalic() )
editor->setFontItalic( false );
else
editor->setFontItalic( true );
break;
case 3: // Underline
if( editor->fontUnderline() )
editor->setFontUnderline( false );
else
editor->setFontUnderline( true );
break;
case 4: // Strickout
font = editor->currentFont();
if( font.strikeOut() )
font.setStrikeOut( false );
else
font.setStrikeOut( true );
editor->setCurrentFont( font );
break;
}
// ugly trick to make the sure that the links haven't change
// color
/*
if( !editor->toPlainText().isEmpty() )
{
int start = editor->textCursor().selectionStart();
int end = editor->textCursor().selectionEnd();
editor->setHtml( editor->toHtml() );
QTextCursor cursor( editor->textCursor() );
cursor.setPosition( start );
cursor.setPosition( end, QTextCursor::KeepAnchor );
editor->setTextCursor( cursor );
}*/
}
}