gpt4 book ai didi

android - 如何在安卓上使用QFile?

转载 作者:行者123 更新时间:2023-11-30 02:52:13 27 4
gpt4 key购买 nike

我需要使用 qt 程序在 android 上读取 .txt 文件。如果为 windows 构建,该文件应该在 build 文件夹中,但是 android 呢?如何将其包含在 apk 中?

最佳答案

您可以将文本文件包含到您的 APK Assets 中,然后像这样引用它:

QFile file( "assets:/qml/foo/main.qml" );

这个问题有另一个用于访问 Assets 的 URI:How to add qt resources to android APK file?

或者您可以在您的应用程序中将 QFile 打包为 QRC ( http://qt-project.org/doc/qt-5.0/qtcore/resources.html ) 并像这样访问它:

QFile file( "qrc:/path/to/file.abc" );

这两个选项都是只读的。

关于android - 如何在安卓上使用QFile?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19146790/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com