Print QPixmap without scaling



  • Hi all,

    I am working on a project where I need to print some ECG lines that are presented by QCustomPlot. I am able to grab these ECG lines to QPixmap using QCustomPlot::toPixmap() function.
    What I need now is to print this image to default printer without any scaling. Which means that only a portion of an image will be printed. I am drawing this QCustomPlot on a 24" monitor and I need to print unscaled portion of a image on a A4 landscape orientated paper.

    What would be the best way of doing this?

    Thank you.


  • Moderators



  • Well yes I can use drawPixmap and I am using it to print an image, but the image is still scaled to some extend and it does not represent part of the unscaled image that can be seen on the screen.


  • Moderators

    @Zgembo
    hard to say, you are not providing enough information.
    If you use the the method i posted the QPixmap will not scaled.

    It may be that your QPainter transofrmation is scaling.
    Or that your QPixmap is scaled against your assumption.



  • Anyway it does what i tell it to do which is scale, so it is performing how i expect not how i want. What i want to do is resize the QPixmap Graphics Item so that it crops the rest of the sprite sheet. Here is what it looks like at the moment when scales mybkexperience


  • Lifetime Qt Champion

    Hi
    Im not seeing any image ?
    Anyway, can you explain a bit mroe what

    • What i want to do is resize the QPixmap Graphics Item so that it crops the rest of the sprite sheet.

    You mean you want to print part of a lager Image to A4 paper and not have it scale but
    but be its pixel size even on the paper ?



  • @mrjj Yes exactly. I have an image on screen which needs to be printed as it is on the printer. No scaling or anything. Lets say you have an image on 24" screen and you put over a screen A4 paper. The image that is under that paper needs to be printed.


  • Lifetime Qt Champion

    @Zgembo
    But what resolution is that screen?
    A 300/600/1200 dpi printer will have much, much higher resolution so
    it most cases all of the image will fit the A4 paper.
    unless images is HUGE in resolution, the A4 is much bigger.

    Anyway, if you just draw the image on a printer. its not scaled.
    so it's unclear what you still need to make it work for you.



  • @mrjj Definitely my bad. I printed unscaled image and it cropped the image to A4 paper size. It is ok now.


Log in to reply
 

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