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. QCamera - Window size not same as aspect ratio SOLVED
Qt 6.11 is out! See what's new in the release blog

QCamera - Window size not same as aspect ratio SOLVED

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 1.3k Views 1 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.
  • G Offline
    G Offline
    gpuckett54
    wrote on last edited by
    #1

    I am working on a windows desktop application that normally displays input from a camera on half the screen. But I will have the ability to bring the camera display up to fill the window. I am just learning Qt and Qt Creator so progress has been slow. But at least there has been progress.

    With the window split in half the size of the widget containing the camera output does not match the aspect ratio of the camera. At this point it is stretching the image. The first thought was to force the displayed image to match the proper aspect ration of the camera. However I don't want it to have letter boxing. And I will probably have the same problem when I switch to fill the window. So how do I establish a view from the camera that I can fill whatever the size of the window is without stretching. I'd much rather cut off the sides or top and bottom instead of stretching or having it letter box.

    I am using QCamera and QCameraViewfinder. If necessary I can provide code.

    1 Reply Last reply
    0
    • G Offline
      G Offline
      gpuckett54
      wrote on last edited by
      #2

      I finally rewrote the code to use QGraphicsView and QGraphicsScene. I used QGraphicsPixmapItem for the image. In order to properly center the image I used the setPos function of QGraphicsItem with a negative x and/or y to get the area of the image that I wanted to be visible.

      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