Results 1 to 2 of 2

Thread: Qt 4.4.0 printing images

  1. #1
    Join Date
    Jun 2007
    Location
    Louisiana
    Posts
    77
    Thanks
    1
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Qt 4.4.0 printing images

    I must admit I am not up to speed on printing images. But I have a question in that regard.

    I am printing a QTextEdit object to QPrinter using a QTextCursor to format the rich text on a page. I have formatted the image and text but each time I try to print the image I just get the default "empty" image (you know - the page icon with the top corner turned down) with the right dimensions not my real graphic. The text prints as formatted.

    I am assuming (bad idea of course) that since the "empty" image is displayed that the syntax is correct. But why is the image not inserted into the cursor? It is present in the resources and called by the correct name.

    What am I missing?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt 4.4.0 printing images

    How do you insert that image exactly?

    This way?
    Qt Code:
    1. QImage img = ...
    2. textDocument->addResource(QTextDocument::ImageResource, QUrl("myimage"), img);
    3. cursor.insertImage("myimage");
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. import large number of images
    By sriluyarlagadda in forum Qt Programming
    Replies: 5
    Last Post: 15th May 2008, 10:26
  2. Printing problem in windows
    By joseph in forum Qt Programming
    Replies: 6
    Last Post: 12th July 2007, 08:04

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.