Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Print QPixmap without scaling
QtWS25 Last Chance

Print QPixmap without scaling

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 4 Posters 1.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ZgemboZ Offline
    ZgemboZ Offline
    Zgembo
    wrote on last edited by
    #1

    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.

    raven-worxR 1 Reply Last reply
    0
    • ZgemboZ Zgembo

      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.

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @Zgembo said in Print QPixmap without scaling:

      What would be the best way of doing this?

      QPainter::drawPixmap(const QPoint & point, const QPixmap & pixmap)

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • ZgemboZ Offline
        ZgemboZ Offline
        Zgembo
        wrote on last edited by
        #3

        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.

        raven-worxR 1 Reply Last reply
        0
        • ZgemboZ Zgembo

          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.

          raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by
          #4

          @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.

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          1
          • L Offline
            L Offline
            Lukin523
            wrote on last edited by Lukin523
            #5

            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

            1 Reply Last reply
            0
            • mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              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 ?

              ZgemboZ 1 Reply Last reply
              0
              • mrjjM mrjj

                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 ?

                ZgemboZ Offline
                ZgemboZ Offline
                Zgembo
                wrote on last edited by
                #7

                @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.

                mrjjM 1 Reply Last reply
                0
                • ZgemboZ Zgembo

                  @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.

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @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.

                  ZgemboZ 1 Reply Last reply
                  1
                  • mrjjM mrjj

                    @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.

                    ZgemboZ Offline
                    ZgemboZ Offline
                    Zgembo
                    wrote on last edited by
                    #9

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

                    1 Reply Last reply
                    2

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved