Qt implements transparent background window

Source: Internet
Author: User

Setminimumsize (qsize (1, 800,800 ));
Setattribute (QT: wa_translucentbackground, true); // [1]

Setstylesheet ("background-color: Transparent"); // [2]

Setwindowflags (QT: framelesswindowhint );

Qpushbutton * pbutton = new qpushbutton;
Pbutton-> setparent (this );
Pbutton-> setgeometry (100,100,200,100 );
Pbutton-> settext ("button ");
Pbutton-> setstylesheet ("background-color: RGB (255,100, 255,255,255); color: RGB );");

 

You can use the above settings to obtain a fully transparent background window. The experiment found that [1] and [2] are indispensable. From the function literal perspective, you should call one of the functions to achieve full transparency. Later, I wanted to use setstylesheet ("background-color: RGB (100,100, 0,100)"); To set translucent, and found no effect. I don't know how to set the translucent background window separately. If you callSetwindowopacity () makes the background window and controls transparent.

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.