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. Embed an image inside a widget

Embed an image inside a widget

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 540 Views 2 Watching
  • 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.
  • P Offline
    P Offline
    PinTxO
    wrote on last edited by
    #1

    Hi guys.

    I want to visualize an entire image inside a widget (for example inside a label) without losing information. I suppose I will need to do a process of deforming the image so that I can enter it completely or I do not know if Qt already brings something to do this kind of tasks.

    Thank you

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What do you mean by without losing information ?
      If you mean keep the full image but scaled then QImage::scaled is your friend.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      P 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi,

        What do you mean by without losing information ?
        If you mean keep the full image but scaled then QImage::scaled is your friend.

        P Offline
        P Offline
        PinTxO
        wrote on last edited by
        #3

        @SGaist Thanks for answering. Maybe I have not explained myself completely well. I have an image with a certain size and I need to embed it in a polygon with four vertex without cropping the image. The entire image must be displayed in the polygon.

        Gojir4G 1 Reply Last reply
        0
        • P PinTxO

          @SGaist Thanks for answering. Maybe I have not explained myself completely well. I have an image with a certain size and I need to embed it in a polygon with four vertex without cropping the image. The entire image must be displayed in the polygon.

          Gojir4G Offline
          Gojir4G Offline
          Gojir4
          wrote on last edited by
          #4

          @PinTxO Use QImage::scaled as suggested by @SGaist with ratio mode set to Qt::KeepAspectRatio

          P 1 Reply Last reply
          0
          • Gojir4G Gojir4

            @PinTxO Use QImage::scaled as suggested by @SGaist with ratio mode set to Qt::KeepAspectRatio

            P Offline
            P Offline
            PinTxO
            wrote on last edited by
            #5

            @Gojir4 said in Embed an image inside a widget:

            @PinTxO Use QImage::scaled as suggested by @SGaist with ratio mode set to Qt::KeepAspectRatio

            And what QSize I give to the scaled method if the image I have to insert it in a polygon and not in a rectangle? A trapezium for example. I need to distort the image.

            1 Reply Last reply
            0

            • Login

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