There are many ways to set the widget background color or image in QT: override paintevent (), the color palette qpalette, and the style sheet setstylesheet.
However, all methods have their own precautions. If you do not pay attention to them, it
Use Setstylesheet to set the appearance of the graphical interface
Use Setstylesheet to set the appearance of the graphical interface:QT Style Sheets is a very advantageous tool that allows customizing the appearance of Windows,It can
Use setStyleSheet to set the appearance of the graphic interface:QT Style sheet is a good tool that allows you to customize the appearance of a window,In addition, the subclass QStyle can also be used to complete the process. Its syntax is largely
From: http://www.360doc.com/content/11/1122/10/7899729_166398154.shtmlUse setstylesheet to set the appearance of the graphic interface:Qt style sheet is a good tool that allows you to customize the appearance of a window,In addition, the subclass
Easy to fix, MainWindow is a qwidget.Set the background color to blueMainwindow.setstylesheet ("background-color:blue;");Set the background image to Bg.pngMainwindow.setobjectname ("MainWindow");Mainwindow.setstylesheet ("#mainWindow
Precautions for setting widget background color/image in QT (use the style sheet setstylesheet ())
There are many ways to set the widget background color or image in QT: override paintevent (), the color palette qpalette, and the style sheet
Main Interface of the Note Software
I want to create a cross-platform Notes software based on oschina (share it with you if you do well, and collect your own notes if you do not do well ...., Oschina openapi is familiar, but QT is not very
Set the button status, default status, move the mouse over the status, click the status, use three pictures to indicate different statuses
ui->close->setStyleSheet("QPushButton{border-image: url(:/image/close.png);}"
Set the setstylesheet function in the button Image
UI-> btn_dial-> setstylesheet ("qpushbutton {background-image: URL (:/images/call_up.bmp );}""Qpushbutton: hover {background-image: URL (:/images/call_hov.bmp );}""Qpushbutton: pressed
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.