Results 1 to 5 of 5

Thread: 8bit Color

  1. #1
    Join Date
    Jan 2006
    Location
    Third rock from the sun
    Posts
    106
    Thanks
    17
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Smile 8bit Color

    I am developing a application on a Solaris 8 machine. Due to a legacy piece of software (not being replaced...yet) the machine is set to 8 bit color. Because of this, all the .png images I use for toolbar icons are appearing only in black and white. The images I am using are coming from the demos directory of the Qt installation. I have tried converting the images using M$ Paint to 8bit gifs, jpegs, and PNG, but all only appear in greyscale. Is there a particular trick to use 8 bit color images in Qt, or am I just converting the images incorrectly?

  2. #2
    Join Date
    Jan 2006
    Location
    Alingsås, Sweden
    Posts
    437
    Thanks
    3
    Thanked 39 Times in 39 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: 8bit Color

    I'm not sure, but perhaps you could load the icons as a QImage and convert it to a QPixmap. This might trigger some conversion code fixing the colours.

  3. #3
    Join Date
    Jan 2006
    Location
    Mountain View, CA
    Posts
    279
    Thanked 42 Times in 37 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: 8bit Color

    8-bit color means you are working with a shared colormap. If your images are in the wrong color (i.e. black and white) it's probably because all available cells have been allocated by the desktop and other applications.

    There are a number of different ways to address this:

    1. Start from a fresh login with as few applications running as possible. See if it still happens.
    2. Your video card probably supports higher color visuals (running 'xdpyinfo' in a terminal will tell you this). If this is the case, start your app with '-visual TrueColor' on the command line and see if your app starts in 24-bit color.
    3. Start your app with '-cmap' this should force the ap to use a private color map. It may well result in 'color flashing' though when the mouse pointer moves between windows.
    Save yourself some pain. Learn C++ before learning Qt.

  4. The following user says thank you to Chicken Blood Machine for this useful post:

    Rayven (10th August 2006)

  5. #4
    Join Date
    Jan 2006
    Location
    Third rock from the sun
    Posts
    106
    Thanks
    17
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: 8bit Color

    Thanks Chicken Blood Machine, the "-visual TrueColor" did not work, but "-cmap" did. However, the 'color flashing' was more of completly changing the desktop colors when the window was selected. Thanks again CBM

  6. #5
    Join Date
    Jan 2006
    Location
    Mountain View, CA
    Posts
    279
    Thanked 42 Times in 37 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: 8bit Color

    Quote Originally Posted by Rayven
    Thanks Chicken Blood Machine, the "-visual TrueColor" did not work, but "-cmap" did. However, the 'color flashing' was more of completly changing the desktop colors when the window was selected. Thanks again CBM
    Yeah that's what I meant. The 24-bit TrueColor option, will work if you can get a Systems Administrator to configure your Sun box with 24-bit visual support, but a default visual of 8-bit. then your legacy app will still run fine in 8-bit color, but your Qt app should be able to make use of a truecolor visual (without the flashing).
    Save yourself some pain. Learn C++ before learning Qt.

Similar Threads

  1. Html link color
    By sreedhar in forum Qt Programming
    Replies: 9
    Last Post: 5th September 2008, 14:36
  2. QLabel background color
    By munna in forum Newbie
    Replies: 3
    Last Post: 1st May 2006, 15:36
  3. Replies: 2
    Last Post: 10th March 2006, 20:46
  4. Change the text color tab page
    By gtthang in forum Qt Programming
    Replies: 4
    Last Post: 18th February 2006, 17:38
  5. Using kwm window caption bar color
    By OldJohnB in forum Qt Programming
    Replies: 7
    Last Post: 9th February 2006, 04:00

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.