View Full Version : How to change the color of background of QMainwindow?
weixj2003ld
5th July 2012, 10:56
When I create a QMainwindow only(that is ,there is no DockWidget,no central Widget),and the main area color is grey,how to change it to other color ,such as white?
Added after 8 minutes:
shows as picture.
7952
ChrisW67
5th July 2012, 11:26
QMainWindow m;
m.setStyleSheet("QMainWindow {background: 'yellow';}");
m.show();
Krump Lee
5th July 2012, 11:27
Did you try subclassing QMainWindow's paintEvent?
weixj2003ld
5th July 2012, 13:58
QMainWindow m;
m.setStyleSheet("QMainWindow {background: 'yellow';}");
m.show();
It can change the background color of QMainWindow,but it change the background color of Tool bar and status,too.
Did you try subclassing QMainWindow's paintEvent?
I have subclassed QMainWindow's paintEvent,but I'm sorry how to do in it?
wysota
5th July 2012, 23:56
What you want is to change the background of the centralWidget of the main window.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.