在 QApplication a(argc, argv); 之前设置环境变量
QByteArray qtdir = qgetenv("QTDIR");
/*QString strDir = "D:\\Qt\\myDebugQt\\myDebugQt";*/
QString strPlatforms = qtdir + QString(R"(\plugins\platforms)");
qputenv("QT_QPA_PLATFORM_PLUGIN_PATH", strPlatforms.toLocal8Bit());