Results 1 to 6 of 6

Thread: Generating distinguishes colors from QColor::colorNames()

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2016
    Location
    Poland
    Posts
    18
    Thanks
    5
    Qt products
    Qt5
    Platforms
    Windows

    Question Generating distinguishes colors from QColor::colorNames()

    Hi
    I wrote a small loop in c++ for generating colors from QColor::colorNames(). But it generates it reaaaaly randomly, so together they look really really bad.
    Is there any idea how to generate distinguishable colours(blue, red, green, yellow, orange, white etc.) first? I know it depence from i-value in loop, but no idea how to set it
    Here is my code:

    Qt Code:
    1. QStringList colorName = QColor::colorNames();
    2. QVector<QColor> colorCat(numCat); // number of categories I have to color
    3. for(int i =0; i < numCatt; i++)
    4. colorCat[i] = colorName[i]; //I also tried something like colorName[2*i], or [i*i] to generate something normal, but it failed
    To copy to clipboard, switch view to plain text mode 
    Last edited by time; 9th November 2016 at 22:16.

Similar Threads

  1. QColor generator?
    By Khaine in forum Qt Programming
    Replies: 2
    Last Post: 30th March 2016, 10:35
  2. Doubt In QColor::colorNames()
    By vinodpaul in forum Newbie
    Replies: 1
    Last Post: 24th July 2012, 07:21
  3. question with QColor
    By Devora in forum Qt Programming
    Replies: 2
    Last Post: 23rd June 2009, 10:49
  4. bug with QColor(QString& name)
    By Radagast in forum Qt Programming
    Replies: 1
    Last Post: 31st July 2008, 14:24
  5. MFC PALLETEINDEX to QColor()
    By maverick_pol in forum Qt Programming
    Replies: 8
    Last Post: 24th September 2007, 07:10

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.