Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/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:
    ui->imageViewerLabel->imagePixmap...???

    Best regards,
    Eddi0406


  • Lifetime Qt Champion

    Hi,

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


Log in to reply