Important: Please read the Qt Code of Conduct -

QLabel -> QPixmap -> get real image position?!

  • Hi Guys,

    I need to get the scaled image position and size of a QPixmap drawn on to a QLabel. How can I achieve this? Unfortunately I only found out how to get the label or image size (before scaling).

    Code snippet from label class:
    QLabel::setPixmap(pix.scaled(this->size(), Qt::KeepAspectRatio, Qt::FastTransformation);

    Code snippet from main class:

    Best regards,

  • Lifetime Qt Champion


    Are you looking for the QLabel::pixmap() function ?

Log in to reply