可以为特定项目禁用 Qt 5.8 中的 QML 缓存吗? [英] Can QML caching in Qt 5.8 be disabled for a particular project?

查看:17
本文介绍了可以为特定项目禁用 Qt 5.8 中的 QML 缓存吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Qt 5.8 应该带有可选的提前使用 qtquick 编译器,但它带有一个 sort-of-a-jit-compiler,该功能默认启用并将已编译的 QML 文件缓存在磁盘上,以便提高启动性能并减少内存使用量.

Qt 5.8 was supposed to come with the optional use ahead of time qtquick compiler, instead it arrived with a sort-of-a-jit-compiler, a feature that's enabled by default and caches compiled QML files on disk in order to improve startup performance and reduce memory usage.

然而,该功能与 严重 bugs 大大减少,或者在我的情况下甚至完全否定它的好处,因为我从一开始就没有启动时间问题,并且测试没有显示任何内存使用情况任何改进.

The feature however arrives with serious bugs which greatly diminish, or in my case even completely negate its benefits, as I didn't have a problem with startup times to begin with, and testing didn't reveal any memory usage improvements whatsoever.

所以我想做的是在我的项目中选择退出该功能,但我似乎不知道如何做到这一点.回到 Qt 5.7.1 不是一个选择,因为我的项目依赖于 5.8 引入的其他新功能.

So what I would like to do is opt out of that feature in my project, but I don't seem to find how to do that. Going back to Qt 5.7.1 is not an option since my project relies on other new features, introduced with 5.8.

推荐答案

QML_DISABLE_DISK_CACHE(设置为 1)添加到您的环境变量中.您应该可以通过 qputenv 在您的应用程序中执行此操作 -- 在加载 QML 内容之前将其放在 main 中.

Add QML_DISABLE_DISK_CACHE (set to 1) to your environment variables. You should be able to do it inside your application via qputenv -- put it somewhere in main before loading QML content.

这篇关于可以为特定项目禁用 Qt 5.8 中的 QML 缓存吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆