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. How to maintain aspect ratio of a Qlabel throughly??
Forum Updated to NodeBB v4.3 + New Features

How to maintain aspect ratio of a Qlabel throughly??

Scheduled Pinned Locked Moved Unsolved General and Desktop
qlabelqpixmapqt 5.9
1 Posts 1 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.
  • V Offline
    V Offline
    vasu_gupta
    wrote on last edited by vasu_gupta
    #1

    I have a Qlabel in which I want to load a qimage(658x492) , now i have loaded this image in the qlabel like this:

    QPixmap image("/home/vasu/IMG0231.jpg");
        image.scaled(ui->IMAGE_CAM->width(),ui->IMAGE_CAM->height(),Qt::KeepAspectRatio);
        ui->IMAGE_CAM->setPixmap(image);
    

    for now the aspect ratio is maintained by the Qlabel, however when i maximize or minimize my gui ithe aspect ratio of Qlabel doesent hold,like when i maximize it becomes 662x492

    In my code i have to select the roi on the qlabel which should precisely correspond to the input image and send it to a function for doing some processing.

    This require great precision(1-2 pix) thus i cannot afford to mess up the aspect ratio .
    how can i do that

    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