Results 1 to 3 of 3

Thread: Not all colors in QtColor enum are available to me

  1. #1
    Join Date
    Apr 2017
    Posts
    55
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Not all colors in QtColor enum are available to me

    using qtcreator with QT 4.8.5

    I am changing widget colors using the code

    QPalette pal = button_array[i]->palette();
    pal.setColor(QPalette::Button, QColor(Qt::gray));
    pal.setColor(QPalette::ButtonText,Qt::black);

    I am trying to get the button color back to its original color when it is first displayed.

    If I change the color to Qt::lightgray, it thows a compiler error saying that lightgray is not a member of QT

    All the documentation shows both light and dark versions of all the colors.

    I can only utilize white, yellow, green, red, blue, black, gray, magenta

    Any clues as to why the light and dark versions of the colors are throwing compiler errors??

    Thanks in advance.

    -Ed

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Not all colors in QtColor enum are available to me

    Because you have not spelled the names correctly. C++ is case sensitive, remember? Read the docs.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Apr 2017
    Posts
    55
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Not all colors in QtColor enum are available to me

    a newbie error. Thanks for the help. I wonder if the video driver on my pc is sub-par because there is no difference in color between the lightGray, darkGray, and gray. I'm trying to get back to the original color that QT makes the button when placed on the form.

Similar Threads

  1. enum initialization
    By ad5xj in forum Qt Programming
    Replies: 3
    Last Post: 11th November 2015, 20:56
  2. QT enum array
    By angarali06 in forum Qt Programming
    Replies: 4
    Last Post: 3rd April 2011, 15:21
  3. How to use QVariant with enum?
    By FinderCheng in forum Qt Programming
    Replies: 1
    Last Post: 25th December 2010, 21:23
  4. How to export enum ?
    By Peppy in forum Qt Programming
    Replies: 1
    Last Post: 14th May 2010, 15:15
  5. How can we convert enum to int?
    By learning_qt in forum Qt Programming
    Replies: 2
    Last Post: 26th January 2010, 16:08

Tags for this Thread

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.