The problem was that I didn't have a colormap, which was the array that it was trying to index.
Apparently when I try to use fromImage: "..the image is first converted to a 32-bit pixmap and then filled with the colors in the color table." (Qt documentation)
Which is kind of weird that I need to initialize a color table even though i'm using QImage::Format_Indexed8
Bookmarks