Setting background-color on widgets makes child widget wrong style
Hi,
I'm new to Qt and have a problem with my first Qt application.
Steps to recreate on Windows Vista (fairly simple):
1. Start Qt Designer and create a mainwindow ui, add a push button to main widget "centralWidget"
2. Change the stylesheet of either "MainWindow" or "centralWidget" from Property Editor, and set it's background to white: background-color: rgb(255, 255, 255);
Issues: the button on the widget doesn't render as expected, please refer to the images below. The image on left side is a default preview result, and it's a Vista Style button. The one on right side is the result with white background and it's a very old windows style.
http://www.qtforum.org/index.php?pag...790f1598fda8a8http://www.qtforum.org/index.php?pag...1a68416ad79aa3
Thanks
Re: Setting background-color on widgets makes child widget wrong style
Finally I used the code like this to change the palette, and it works well so far:
Code:
pal.
setColor( QPalette::Window, Qt
::white );
setPalette( pal );
Note:
1. The preview for setting the palette from Qt Designer doesn't work. I wasted much time because of this defect.
2. I tried to override virtual void paintEvent ( QPaintEvent * event );, haven't finished yet, not sure what will happen.