How to scale QImage or QPixmap to fit the parent Width X Height?

  • Hello,
    I am trying to scale a PNG ( which I am not sure is right ) to match the parent WxH. Here is my code:
    QImage test3(":/resources/images/test3.png");
    test3 = test3.scaled(width, height, Qt::IgnoreAspectRatio);
    Where "width" and "height" are passed from parent class who calls this code. The result is shown here:
    I want the screen to be filled with the background image. As in the examples with Qt::IgnoreAspectRatio is shown - it should fill to max width and height. Also - can I use SVG to achieve the effect without losing quality of the image? And what are the costs for rendering SVG?

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.