Using relative path for image:url in stylesheet
-
@lukutis222 Could you share
green_circle.png
file? and the style sheet you're applying to your label?I tested with a random green circle icon with a transparent background, and a yellow background for the label, and it works.
Here's how it looks:
and here's the image I used, and its link:
-
@Abderrahmene_Rayene
Sure. The image is attached:
You should be able save it as image.
Regarrding the label:
I have simply created a label, adjusted its size and added stylesheet background color:
In the code I do:
QPixmap pixmap = QPixmap (":/icons/green_circle.png"); ui->label_5->setPixmap(pixmap); ui->label_5->setScaledContents(true);
Result
I have then tried the same thing again just instead using my
green_circle
, I used yourgreen_circle
. That seems to work fine!
.I wonder what is exactly t=the problem with my image. It seems transparent but its not!
It is also worth mentioning that this is not just one image that I have issues with. I use many transparent images that does not actually seem to be transparent. Another example is this icon:
-
@lukutis222 it seems this has nothing to do with Qt.
How are you downloading these images? What's their source?