Some icons are added to the image path, but they cannot be displayed using the QIcon method. Then I was wondering whether these pictures in qt need "declaration" like functions, so I searched through the project files one by one. Finally I found the qrc folder.
Although I added some files under the mode file, they are not reflected in the above qrc file.
So I think, just import the image file into the qrc file.
So right-click /mode->add existing file.
Find the remotecontrol.jpg file in the resource/mode path
and add it, but it is not directly like chart and debug as I imagined, it is in a newly generated folder resource\mode file.
It would be very inconvenient to call this way, what should I do? After some exploration, we can directly edit the qrc file.
Right-click the qrc file->Open in Editor->->/mode->Add Files->set alias,
so we have realized the addition of qrc resources.
Then call it again. When calling, we can also call the alias directly!
Successfully displayed!
But the backgrounds of these pictures are not transparent, and setting not to display the background is useless. I have always had this trouble, because I found these pictures on the Internet, so how to change the background color to a transparent color, or how to ignore the background, feels a very strange question (which part is regarded as the background), about this Please see the next blog to solve the problem of Qt icon background color transparency
Solve the problem that the QIcon icon does not display in Qt
Guess you like
Origin blog.csdn.net/qq_16488989/article/details/108826508
Recommended
Ranking