Hi all
Can any body tell me how to add colour in windows. i need 2 change the colour of windows to red from default. but im not able 2 do.
Thank you all
Hi all
Can any body tell me how to add colour in windows. i need 2 change the colour of windows to red from default. but im not able 2 do.
Thank you all
Cheers,
Phillip
--- Please post the solution you got to solve your problem. It may help others.
You mean the background? Make sure the autoFillBackground property of the widget is set to true and set a colour of your choice as QPalette::Background role of the widget's palette.
Ya autoFillBackground is set as True. i also added
ui.CancelButton->setBackgroundRole((QPalette::ColorRole)Qt::red ); in constructor as i need cancelButton as red. But nothing is working. Can u plz tell me how to colour the window.
Thank you.
Cheers,
Phillip
--- Please post the solution you got to solve your problem. It may help others.
then Make sure the autoFillBackground property of the widget is set to true.Qt Code:
QPalette palette; brush.setStyle(Qt::SolidPattern); brush1.setStyle(Qt::SolidPattern); ui.CancelButton->setPalette(palette);To copy to clipboard, switch view to plain text mode
hope this help!
Anurag Shukla
A man who never makes mistake is the man who never does anything! Theodre Rosvelt!
I ve solved the problem.
Thank you all .
Cheers,
Phillip
--- Please post the solution you got to solve your problem. It may help others.
HI all.
I ve changed the colour of window by usning the code
now i need to check the window colour. if it is black i need 2 change it to gray and vice versa. i Tried to do as below but its not workingQt Code:
this->setPalette(p);To copy to clipboard, switch view to plain text mode
But its not coming inside if loop.Qt Code:
{ this->setPalette(p); }To copy to clipboard, switch view to plain text mode
Can any body help me.
thank you all.
Last edited by jpn; 27th February 2008 at 09:11. Reason: missing [code] tags
Cheers,
Phillip
--- Please post the solution you got to solve your problem. It may help others.
Read what QWidget::backgroundRole does. It returns a role, not a colour.
QWidget::backroundRole() returns QPalette::ColorRole. It makes no sense to compare it to Qt::GlobalColor.
Qt Code:
if (palette().color(Qt::Window) == Qt::black) ...To copy to clipboard, switch view to plain text mode
J-P Nurmi
I tried to do like following.
still its not coming inside, but it showd come inside as the windows colour is black.Qt Code:
{ GrayColour(); }To copy to clipboard, switch view to plain text mode
Then what to do Mr Wysota.? can u plz help me.
Thanks.
Last edited by jpn; 27th February 2008 at 10:42. Reason: two posts merged
Cheers,
Phillip
--- Please post the solution you got to solve your problem. It may help others.
Have a boolean flag instead of checking the colour.
Cheers,
Phillip
--- Please post the solution you got to solve your problem. It may help others.
You won't be able to change colours of other applications using Qt code.
As I said, you won't be able to modify the behaviour of other applications using Qt code. SetSysColor() is not an MFC method, it's WinAPI function, so you can call it from Qt-based applications as well.
Just call the function![]()
I tried to call like
quint32 m_ColourElement = COLOR_3DDKSHADOW;
quint32 m_ColourNight = RGB(100, 100, 100);
SetSysColors(16, m_ColourElement, m_ColourDay);
But getting erors.
Cheers,
Phillip
--- Please post the solution you got to solve your problem. It may help others.
What kind of errors?
Qt is not a programming language but a library.
Perhaps you should read SetSysColors() docs...
J-P Nurmi
Bookmarks