1.中文乱码
#pragma execution_character_set("utf-8")
2.产生随机数
#include <QtGlobal> #include <QTime> qsrand(QTime(0,0,0).secsTo(QTime::currentTime())); int test =qrand()%10;
3.类型转换
对QObject类进行类型转换(类似dynamic_cast):qobject_cast<T>();
1.中文乱码
#pragma execution_character_set("utf-8")
2.产生随机数
#include <QtGlobal> #include <QTime> qsrand(QTime(0,0,0).secsTo(QTime::currentTime())); int test =qrand()%10;
3.类型转换
对QObject类进行类型转换(类似dynamic_cast):qobject_cast<T>();
转载于:https://www.cnblogs.com/loki1412/p/7279967.html