Results 1 to 2 of 2

Thread: Creating array of QColors?

  1. #1
    Join Date
    Nov 2015
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Question Creating array of QColors?

    Hi,

    New some help with creating an array that holds the different QColors. I am working on MSVC 12 and using Qt 5.3.1
    From what i know to create an integer array one would simply use

    Qt Code:
    1. int myInt[3] = {5, 12, 4};
    To copy to clipboard, switch view to plain text mode 


    So here is what I have

    Qt Code:
    1. mColorButton = new PaletteButton(Qt::white);
    To copy to clipboard, switch view to plain text mode 

    this class is initialized as follows

    Qt Code:
    1. PaletteButton(const QColor &color);
    To copy to clipboard, switch view to plain text mode 

    my intention is to store the different colors used by the PaletteButton in an array. Some like this

    Qt Code:
    1. Qcolor myPaletteColor[3] = {Qt::black, Qt::white, Qt::gray};
    To copy to clipboard, switch view to plain text mode 

    Is this possible? Any ideas would be helpful!

    Thanks,

  2. #2
    Join Date
    Nov 2015
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Creating array of QColors?

    Figured it out the Qt::Black was enum value declared from another name space.....initialized the array using the enum name from the pointed namespace by Qt:black

Similar Threads

  1. Creating static const QColors
    By ToddAtWSU in forum Qt Programming
    Replies: 3
    Last Post: 24th December 2013, 12:40
  2. Creating an Array of Button
    By Anshuman in forum Qt Programming
    Replies: 8
    Last Post: 21st April 2011, 13:32
  3. Array of button for creating custom calender
    By anshumanBorah in forum Qt Programming
    Replies: 1
    Last Post: 12th April 2011, 13:21
  4. Creating a Pixmap out of an array of data
    By toratora in forum Qt Programming
    Replies: 2
    Last Post: 5th June 2007, 19:00
  5. Creating a global array in my code???
    By therealjag in forum General Programming
    Replies: 5
    Last Post: 13th March 2006, 11:13

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.