PDA

View Full Version : Printing JPEG images from QTextEdits



ToddAtWSU
6th May 2010, 22:43
I am having difficulties printing JPG images contained in QTextEdits. I actually have a sub-classed QTextEdit and for printing I create the printer object, convert the QTextEdit to a QTextDocument, and then call QTextDocument's print function. I would show the code but my code is on a stand-alone network and I am not with the network right now. But it is just those three lines of code. All of the text prints fine and PNG images print fine, but the JPG images print out as black boxes the size of the image in the QTextEdit. Inside my .h file I have the IMPORT statement for qjpeg. I forget the syntax of it, but it is located just after my include statements. Does anybody have any ideas why everything works fine except JPG. I am running Solaris 10 in 8-bit color (don't ask...legacy software :rolleyes:) if that matters.

Thanks!
Todd

ToddAtWSU
11th May 2010, 17:53
The problem seems to be with the 8-bit color. I switched the machine to 24-bit color and the JPG printed fine. But back in 8-bit color it does not print. I have tried saving the JPG as temp.png and then printing the PNG file after opening it, but that fails as well. I have tried switching it to Indexed mode but it doesn't print correctly either. Any ideas?

ToddAtWSU
18th May 2010, 19:23
By setting QApplication::setColorSpec( QApplication::ManyColor ) and passing the -visual TrueColor to the command line allowed me to see the image and print them.