QPixmap::fromImage() is a static method returning the pixmap created from the image, so your code should be:
Qt Code:
To copy to clipboard, switch view to plain text mode
If you use indexed images, you have to first set the colour lookup table size using QImage::setNumColors().2) There seems to be a problem creating an image with 8-bit indexed pixels. In fact, the sample code in the documentation does not work. Running the "Code 2", below results in error messages indicating that indexes 0, 1 and 2 are invalid. Stepping into the QT code seems to indicate that NumColors is not being properly set by the constructor (adding setNumColors(256) corrects the problem).
If you look closely, you'll notice that the problems are not related to Qt itself but to 3rd party libraries it uses (X11, libpng, etc.). AFAIK there are no memory problems with Qt.3) Why does Valgrind return so many problems with QT? (QT4 is MUCH better than qt3, but still has plenty of issues).
Bookmarks