Results 1 to 3 of 3

Thread: error C2039: 'hwnd' : is not a member of QPalette

  1. #1
    Join Date
    Mar 2009
    Location
    Gansu,China
    Posts
    188
    Qt products
    Qt4
    Platforms
    Windows

    Default error C2039: 'hwnd' : is not a member of QPalette

    I use the follow code to set the background color of a a QLabel:
    Qt Code:
    1. QColor colorrgb(x*255,y*255,z*255);
    2. QPalette plalette;
    3. plalette.setColor(QPalette::Window,colorrgb);
    4. colorlabelreal->setAutoFillBackground(true);
    5. colorlabelreal->setPalette(plalette);
    To copy to clipboard, switch view to plain text mode 

    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

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: error C2039: 'hwnd' : is not a member of QPalette

    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.

  3. #3
    Join Date
    Mar 2009
    Location
    Gansu,China
    Posts
    188
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: error C2039: 'hwnd' : is not a member of QPalette

    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

Similar Threads

  1. Get HWND of QGLWidget
    By pl01 in forum Newbie
    Replies: 2
    Last Post: 19th December 2010, 21:18
  2. Replies: 0
    Last Post: 22nd June 2010, 20:27
  3. error: request for member `ok' in `xxx
    By intek in forum Qt Programming
    Replies: 6
    Last Post: 6th March 2009, 21:16
  4. QHash static member error
    By ramazangirgin in forum Qt Programming
    Replies: 7
    Last Post: 5th February 2008, 11:26
  5. error:invalid use of member
    By quickNitin in forum General Programming
    Replies: 4
    Last Post: 19th June 2006, 15:21

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.