zoukankan      html  css  js  c++  java
  • QTextEdit

    一、设置颜色,支持html语言格式的

         ui->textEdit->append("<font color="#FF0000">红色字体</font> ");

        信息显示用到,错误的红色字体

       光标移到后面

    teMsg_->moveCursor(QTextCursor::End); 
    void MainWidget::slotShowMsg(MainWidget::MsgType type,QString msg)
    {
        if(type==MSG_ERROR)
        {
           msg="<font color="#ff0000">"+msg+"</font>";
        }
    
        teMsg_->append(QDateTime::currentDateTime ().toString ("[yyyy/MM/dd hh:mm:ss zzz] ")+msg);
    
        logCount_++;
        if(logCount_>LOG_MAX_SIZE)
        {
            teMsg_->clear();
            logCount_=0;
            //qDebug()<<"clear";
        }
    
        teMsg_->moveCursor(QTextCursor::End);
    
    
    }
  • 相关阅读:
    10.28
    10.29
    11.05周四
    数据库增删改查
    11.03Tuesday
    11.10
    连接数据库
    10.30
    11.04周三
    10.27
  • 原文地址:https://www.cnblogs.com/ike_li/p/12432882.html
Copyright © 2011-2022 走看看