Image within an Image, can it be done ?

  • A little help please ..

    I have a rather unique situation and want to find out if it can be done. I've been told by one QT programmer that it can't I wanted to check with the experts.

    I would like to be able to display a legal form image within a window for people to edit fields upon. There is an area at the on the page that requires a barcode that is created just before printing and combined with the form on print out to look like one image (the barcode contains data that is filled in on the form) .. a flattening of the images on printing. Prior to printing a dummy barcode is used as a place holder, then at printing the real one is generated and combined with the form image and printed.

    If this can be done, suggestions would be helpful.


  • A short example of what I mean... The background "Current Inventory" being one image, while the barcode is another.0_1473197264253_barcode.jpg

  • Qt Champions 2017

    Please upload your image to an external site (e.g. The image upload here on the forums isn't working properly. Thanks.

  • Qt Champions 2017

    You can draw one image over another image no problem. Just use the first QImage as a surface for QPainter and draw the second image on top of it with one of the QPainter::drawImage overloads.

  • do you know of any example code for this ?


  • Qt Champions 2017

    Well, no, but Qt's examples are always a good place to start. An image is a paint device as any window, so anything you can draw on a window with the painter you can draw onto an image. Take a look here and here for the actual examples.

  • A comment. I understand that I can subclass a widget, however it seems kind of strange coming from a windows c++ C# background using a "Widget" as a drawing/image surface. I guess I just maybe it's just a terminology thing, but it would seem that having an image view would be more appropriate ... :)

  • Lifetime Qt Champion

    While it would be easy to make an Image View widget as seen in c# and friends, its not
    really needed and soon you be painting to the printer in same manner so at that
    time I guess it will make more sense. :)

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.