QtPlugins路径查找

以QPA插件为例,windows下QPA插件为qwindows.dll,按qt说明需要放在platforms子目录下。
示例:相对于程序根目录。

1.

bin/my.exe
bin/Qt5Core.dll
bin/platforms/qwindows.dll

Qt官方说明结构,程序可运行。

2.

bin/my.exe
bin/a/b/c/Qt5Core.dll
bin/a/b/plugins/platforms/qwindows.dll

设置PATH变量为bin/a/b/c,让my.exe查找到Qt5Core.dll,程序可运行。

3.

bin/my.exe
bin/a/b/c/Qt5Core.dll
bin/a/b/platforms/qwindows.dll

去掉plugins目录包装,程序运行失败,没有加载Platform插件。

4.

bin/my.exe
bin/a/b/c/Qt5Core.dll
bin/a/plugins/platforms/qwindows.dll

plugins目录不在Qt5Core.dll上级,程序运行失败,没有加载Platform插件。

5.

bin/my.exe
bin/Qt5Core.dll
bin/../plugins/platforms/qwindows.dll

plugins目录放在bin上级目录,程序运行失败,没有加载Platform插件。

6.

bin/my.exe
bin/a/b/c/Qt5Core.dll
bin/a/b/c/plugins/platforms/qwindows.dll

plugins放在Qt5Core.dll同级,程序运行失败,没有加载Platform插件。

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容