Tag: EBS relative path exists dem oid Common dir IAP png
There are several ways to use the following paths in Qt.
- 1. QRC the built-in resources are read-only resources in the application, as part of the application, rather than separate from the app in one folder. The path to the resource file in the. qrc file is shown in <file>img/car.png</file>, so we can use Qfile file (":/imag/car.png") when using the path.
- 2, absolute path, in Windows/linux is the form of "e:/img/car.jpg", you can use Qfile file ("E:/img/car.jpg").
- 3. Relative path, the symbol "./" in the relative path, indicates the current directory, ". /"indicates a top-level directory. C:/img/car.jpg;c:/img/cardir/car2.jpg. Access from car2.jpg to car.jpg should use ".. /car.jpg ", while access from car.jpg to car.jpg should use"./cardir/car2.jpg ".
The use of paths in different environments for different classes in QT (using folder resources) is not the same.
Fake like a file in Windows with a path of "e:/workplace/test/assets".
The path to Android is "/data/data/org.qtproject.example.test".
- 1, demo.html in the use of QML webview elements.
Windows: "E:/workplace/test/assets/demo.html".
Android: "file:///data/data/org.qtproject.example.test/demo.html"
- 2, sound.wav in the use of Qmediaplayer.
Windows: "E:/workplace/test/assets/sound.wav".
Android: "/data/data/org.qtproject.example.test/sound.wav"
Write these.
ws://and wss://in Websocket
HTTP//And https://
Limitations of path usage for QT when using resources in Windows and Android