Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
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.
Please upload your image to an external site (e.g. postimage.org). The image upload here on the forums isn't working properly. Thanks.
Image uploaded there https://postimg.org/image/javwr1gaz/
You can draw one image over another image no problem. Just use the first QImage as a surface for
QPainterand draw the second image on top of it with one of the QPainter::drawImage overloads.
do you know of any example code for this ?
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 ... :)
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. :)