• 1.求指定宽度的文本的高度,2.ubuntu下ping ipv6,3.git提示:终止提交因为提交说明为空


    1.如何求指定宽度的文本的高度

    1. paintEvent(QPaintEvent *event)
    2. {
    3. QPainter painter(this);
    4. QString text = "Invalid parameter passed to C runtime function.";
    5. QFontMetrics fm(qApp->font());
    6. QTextDocument doc(text);
    7. doc.setDefaultFont(painter.font());
    8. doc.setTextWidth(100);
    9. doc.adjustSize();
    10. painter.fillRect(QRect(QPoint(0, 0), doc.size().toSize()), Qt::yellow);
    11. doc.drawContents(&painter);
    12. }

    更新方法

    QFontMetrics(font).boundingRect(QRect(0, 0, option.rect.width(), 0), Qt::AlignCenter|Qt::TextWordWrap, text);

    2.ubuntu下ping ipv6

    服务端

    1. QTcpServer *server = new QTcpServer(this);
    2. server->listen(QHostAddress("FE80::AF72:573C:4B61:CABD%eno1"), 8080);
    3. connect(server, &QTcpServer::newConnection, this, [=](){qDebug() << "new connection" << server->nextPendingConnection()->peerAddress();});

    客户端

    1. QTcpSocket tcp;
    2. tcp.connectToHost(QHostAddress("FE80::AF72:573C:4B61:CABD%eno1"), 8080);
    3. tcp.waitForConnected();

    终端ping

    XXX@YYY:~/桌面$ ping6 fe80::af72:573c:4b61:cabd%eno1
    PING fe80::af72:573c:4b61:cabd%eno1(fe80::af72:573c:4b61:cabd%eno1) 56 data bytes
    64 bytes from fe80::af72:573c:4b61:cabd%eno1: icmp_seq=1 ttl=64 time=0.027 ms
    64 bytes from fe80::af72:573c:4b61:cabd%eno1: icmp_seq=2 ttl=64 time=0.022 ms
    64 bytes from fe80::af72:573c:4b61:cabd%eno1: icmp_seq=3 ttl=64 time=0.031 ms
    64 bytes from fe80::af72:573c:4b61:cabd%eno1: icmp_seq=4 ttl=64 time=0.035 ms
    64 bytes from fe80::af72:573c:4b61:cabd%eno1: icmp_seq=5 ttl=64 time=0.041 ms
    ^C
    --- fe80::af72:573c:4b61:cabd%eno1 ping statistics ---
    5 packets transmitted, 5 received, 0% packet loss, time 4102ms
    rtt min/avg/max/mdev = 0.022/0.031/0.041/0.006 ms

    3.Ubuntu下git提示:终止提交因为提交说明为空

    这么简单的问题居然搜索了一会儿,现在的网络环境越来越差了。

    解决方法:

    gedit:

    git config --global core.editor "gedit -s"

    the paramater "-s " means set the gedit mode to "standalone"

    Sublime Text 2

    git config --global core.editor "subl -w"

    the paramater "-w" means return until the file was closed.

    参考:https://www.cnblogs.com/maadiah/archive/2012/02/27/2369931.html

  • 相关阅读:
    电脑时间校对后不自动更新要如何解决
    Docker Compose学习笔记
    High Cardinality
    黑链暗链事件的爆发式增长
    (02)Cartographer源码无死角解析-(15) Node::AddTrajectory()→回调函数之数据流向分析
    掌握C语言指针,轻松解锁代码高效性与灵活性
    每日一题 2520. 统计能整除数字的位数(简单)
    浅谈并发容器
    SpringMVC 的三种异常处理方式详解
    Android Jni添加打印(C++打印)
  • 原文地址:https://blog.csdn.net/ch593030323/article/details/138047280