示例#1
0
bool QTextEditProto::fontUnderline() const
{
  QTextEdit *item = qscriptvalue_cast<QTextEdit*>(thisObject());
  if (item)
    return item->fontUnderline();
  return false;
}
示例#2
0
int TextEdit::fontUnderline(lua_State * L) // const : bool
{
	QTextEdit* obj = ObjectHelper<QTextEdit>::check( L, 1);
	Lua::Util::push( L, obj->fontUnderline() );
	return 1;
}
示例#3
0
  /*!
     * \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 );
      }*/
    }
  }