当前位置: 首页>>代码示例>>C++>>正文


C++ QTextEdit::fontWeight方法代码示例

本文整理汇总了C++中QTextEdit::fontWeight方法的典型用法代码示例。如果您正苦于以下问题:C++ QTextEdit::fontWeight方法的具体用法?C++ QTextEdit::fontWeight怎么用?C++ QTextEdit::fontWeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QTextEdit的用法示例。


在下文中一共展示了QTextEdit::fontWeight方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: fontWeight

int QTextEditProto::fontWeight() const
{
  QTextEdit *item = qscriptvalue_cast<QTextEdit*>(thisObject());
  if (item)
    return item->fontWeight();
  return 0;
}
开发者ID:AlFoX,项目名称:qt-client,代码行数:7,代码来源:qtexteditproto.cpp

示例2: QColor

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();

}
开发者ID:jerduar,项目名称:Compi2,代码行数:19,代码来源:ventana_principal.cpp

示例3: fontWeight

int TextEdit::fontWeight(lua_State * L) // const : int
{
	QTextEdit* obj = ObjectHelper<QTextEdit>::check( L, 1);
	Lua::Util::push( L, obj->fontWeight() );
	return 1;
}
开发者ID:Wushaowei001,项目名称:NAF,代码行数:6,代码来源:QtlTextEdit.cpp

示例4: 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 );
      }*/
    }
  }
开发者ID:adrpo,项目名称:OMNotebook,代码行数:76,代码来源:textcursorcommands.cpp


注:本文中的QTextEdit::fontWeight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。