QLabel with Background Image
-
Hello guys,
I wa unable to create a QLabel (80x40 px) with a semi transparent background. What I tried:- I create a png 29x29 px and set it through css. The transparency works. The issue is the png is not stretched but repeated instead:
- I use a QPalette:
@ QColor bg_color(0, 0, 0, 50);
QPalette p(pinLabel->palette());
p.setColor(QPalette::Window, bg_color);
pinLabel->setPalette(p);@But it does draw nothing.
- I tried with the css property @ background-color: rgba(0, 0, 255, 50); }@ . But it does draw nothing.
What's wrong?
How can i stretch the background-image in order to meete the QLabel's geometry?thanks
Qt version: 4.8.2 embedded - windows ce
-
check "QLabel::scaledContents()":http://qt-project.org/doc/qt-4.8/qlabel.html#scaledContents-prop
If it solves ur issue.
-
thank you it worked. I ve another question. If I change the content of the QLabel the background image disapper. How does it is suppose to work?