Limitations of path usage for QT when using resources in Windows and Android

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.