Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我是 C++ 和 QT 编程的新手,我想以毫秒为单位获取 QThread 执行一项任务所需的时间。有什么选择吗?
问候
您需要创建两个信号 - 一个用于开始工作,一个用于完成工作。连接到开始信号的插槽将存储开始时间,如下所示:
mStartTime = QDateTime::currentDateTime();
连接到完成信号的插槽将像这样计算差异:
qint64 msecs = mStartTime.msecsTo(QDateTime::currentDateTime());