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

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

paintEvent(QPaintEvent *event)
{
    QPainter painter(this);
    QString text = "Invalid parameter passed to C runtime function.";
    QFontMetrics fm(qApp->font());

    QTextDocument doc(text);
    doc.setDefaultFont(painter.font());
    doc.setTextWidth(100);
    doc.adjustSize();
    painter.fillRect(QRect(QPoint(0, 0), doc.size().toSize()), Qt::yellow);
    doc.drawContents(&painter);
}

更新方法

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

2.ubuntu下ping ipv6

服务端

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

客户端

 QTcpSocket tcp;
 tcp.connectToHost(QHostAddress("FE80::AF72:573C:4B61:CABD%eno1"), 8080);
 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

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值