sabeesh
24th July 2007, 07:21
Hi,
How can I set the background color as black of a MainWindow? Please help me!!!!!!!!!
Sabeesh
ufo-vl
24th July 2007, 08:07
This code generated from Qt Designer,
QPalette palette;
QBrush brush(QColor(255, 255, 255, 255));
brush.setStyle(Qt::SolidPattern);
palette.setBrush(QPalette::Active, QPalette::Base, brush);
QBrush brush1(QColor(0, 0, 0, 255));
brush1.setStyle(Qt::SolidPattern);
palette.setBrush(QPalette::Active, QPalette::Window, brush1);
palette.setBrush(QPalette::Inactive, QPalette::Base, brush);
palette.setBrush(QPalette::Inactive, QPalette::Window, brush1);
palette.setBrush(QPalette::Disabled, QPalette::Base, brush1);
palette.setBrush(QPalette::Disabled, QPalette::Window, brush1);
Dialog->setPalette(palette);
Dialog - it's your MainWindow.
I think, this code is possible to optimize.
rajesh
24th July 2007, 08:22
try this in your mainwindow class constructor:
tested code:
QPalette palette;
palette.setColor(backgroundRole(), Qt::black);
setPalette(palette);
sabeesh
24th July 2007, 09:27
Hi,
Thankyou
it's working
:)
Sabeesh
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.