PDA

View Full Version : error C2039: 'hwnd' : is not a member of QPalette



weixj2003ld
19th December 2011, 00:30
I use the follow code to set the background color of a a QLabel:


QColor colorrgb(x*255,y*255,z*255);
QPalette plalette;
plalette.setColor(QPalette::Window,colorrgb);
colorlabelreal->setAutoFillBackground(true);
colorlabelreal->setPalette(plalette);


but the follow error occur:
error C2039: 'hwnd' : is not a member of QPalette
error C2275: 'HWND' : illegal use of this type as an expression

ChrisW67
19th December 2011, 01:53
If you are going to post code to support a question about compiling or linking:

Paste the actual code that generates the error, and some context lines around it.
Tell us which line or lines the error relates to.
Copy and paste the actual error message and some context lines before it.
Test us something about your build environment: Operating system, Qt version, compiler version etc.


Nothing in the code snippet you have posted helps us connect to the error message you posted.

weixj2003ld
19th December 2011, 06:32
plalette.setColor(QPalette::Window,colorrgb);
this line occur.
If I change the code as follows,it is ok.But it is not what I want.

plalette.setColor(QPalette::WindowText,colorrgb);

I use vc2005+qt4.6.3