Results 1 to 3 of 3

Thread: Printing JPEG images from QTextEdits

  1. #1
    Join Date
    Jan 2006
    Location
    Ohio
    Posts
    332
    Thanks
    37
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Printing JPEG images from QTextEdits

    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 ) if that matters.

    Thanks!
    Todd

  2. #2
    Join Date
    Jan 2006
    Location
    Ohio
    Posts
    332
    Thanks
    37
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Printing JPEG images from QTextEdits

    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?

  3. #3
    Join Date
    Jan 2006
    Location
    Ohio
    Posts
    332
    Thanks
    37
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Printing JPEG images from QTextEdits

    By setting QApplication::setColorSpec( QApplication::ManyColor ) and passing the -visual TrueColor to the command line allowed me to see the image and print them.

Similar Threads

  1. Loading corrupt jpeg images with QImage
    By mikeee7 in forum Qt Programming
    Replies: 15
    Last Post: 3rd December 2010, 01:59
  2. WekKit won't load JPEG images.
    By andrem in forum Qt Programming
    Replies: 4
    Last Post: 10th December 2008, 00:24
  3. Problem with displaying jpeg and gif images, in QT4
    By node_ex in forum Installation and Deployment
    Replies: 1
    Last Post: 23rd September 2008, 15:29
  4. JPEG Images not shown in QiconView using QT3??
    By darpan in forum Qt Programming
    Replies: 1
    Last Post: 4th August 2006, 20:34

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.