Beispiel #1
0
int QTextEditProto::fontWeight() const
{
  QTextEdit *item = qscriptvalue_cast<QTextEdit*>(thisObject());
  if (item)
    return item->fontWeight();
  return 0;
}
Beispiel #2
0
void Ventana_Principal::on_bt_buscar_3_clicked()
{
    Pestana *actual = (Pestana*)ui->tabWidget->currentWidget();

    if(actual != NULL){

        QTextEdit *editor = actual->textedit();

        int fw1 = editor->fontWeight();
        QColor gris1 = QColor("red");
        editor->setFontWeight(QFont::DemiBold);
        editor->setTextColor(QColor(gris1));
        editor->insertPlainText("hola");
        editor->setFontWeight(fw1);
        editor->setTextColor(gris1);
    }
    //this->AnalisisJSLT();

}
Beispiel #3
0
int TextEdit::fontWeight(lua_State * L) // const : int
{
	QTextEdit* obj = ObjectHelper<QTextEdit>::check( L, 1);
	Lua::Util::push( L, obj->fontWeight() );
	return 1;
}
  /*!
     * \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 );
      }*/
    }
  }