Solve the problem of Qt (cross-system display) style background becoming white

The written Qt program runs on another computer, and the background becomes white. My computer is win7 and my friend is win10. Initially I thought it was a system incompatibility problem. Later I found out that I was thinking too much. Use this title (cross-system display) to indicate execution on different computers.

solve:

Resources such as pictures or videos used in QT are best saved inProject resource directory,userelative path, My problem is that the absolute path is used (the background image is not in the resource path)
Insert picture description here

Path problem:

Use the relative path: /main/login, login is another name.
For example:
Insert picture description here
another example:
Insert picture description here

Add resources:

The way to add the resource path is to take the screenshot above as an example, right-click fancydemo.qrc->Open in Editor, and then click Add Files on the following screen that appears, and you can add aliases for easy calling
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_16488989/article/details/109021041