1、为Qt添加网络模块
打开.pro文件,添加network模块:
QT += core gui network
2、Qt在调试模式下UI显示中文正常,输出显示中文乱码
这种情况下可以修改系统编码。
3、获取当前时间
QDateTime currentDateTime = QDateTime::currentDateTime(); qDebug() << currentDateTime.toString("当前时间:yyyy-MM-dd hh:mm:ss.zzz");