I decided to write something on this since I just broke my ass to get this working. I am converting BGR555 4bpp SNES images to 8bpp RGB24 indexed for my QT Program. There are a number of things you need to simply "try"/"know" before getting the EFFING thing to WORK! So, since I've already done the ass-breaking. Let me show you..
STEP 1) Learn how to write a QT Image plugin.. http://doc.qt.nokia.com/qq/qq17-imageio.html
Simply edit the downloadable code so that the read/write functions reflect what you want to do...
Here are the finnicky things you need to know for 8-bit indexed QImages..
After creating a QImage img, you MUST img.setColorCount( int n), or your results will be CORRUPT. setColorCount sets the amount of colors to index with.
Note: you don't have to actually set any colors at this point...
You are now free to index pixels with setPixel(x,y,colorindex);
random ass note: if you want to get the pixel index, use img.pixelIndex(x,y);
random article, hopefully your frustration now = 0 :)