Qt Set Background Image 3 methods (simple, but worthy of careful understanding)

Source: Internet
Author: User
Tags set background

Method 1. setstylsheet{"Qdialog{background-image:url ()"}}//Using stylesheet This method has the advantage that inheriting its dialog automatically sets the background, such as replacing the skin is a good choice
Method 2. Qpalette Pal;

Pal.setbrush (Qpalette::background,qbrush (Qpixmap (")));
This->setpalette (PAL);
Method 3: In the PaintEvent (Qpaintevent *) Event//This is used for a variety of custom controls
qpainter painter (this);
Painter.drawpixmap (Rect (), qpixmap&);

http://blog.csdn.net/what951006/article/details/51538812

Qt Set Background Image 3 methods (simple, but worthy of careful understanding)

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.