Automatic re-sizing of QWizardPage and QLable in it



  • I am loading an image on a QLabel in my QWizardPage. The images being loaded are of different sizes. I want to re-size the QLable and QWizardPage accordingly.

    Following code is not serving the purpose and I see a white are in my QLabel.

    @label1 = new QLabel(tr("imageHolder"));

    label1->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
    QPixmap pm1("Y:/background.png");
    
    label1->setPixmap(pm1);
    label1->setSizePolicy(QSizePolicy::MinimumExpanding,
                      QSizePolicy::MinimumExpanding);
    

    label1->adjustSize();
    label1->setScaledContents(true);
    rubberBand = new QRubberBand(QRubberBand::Rectangle, this);

    QHBoxLayout *hlayout1 = new QHBoxLayout();
    hlayout1->addWidget(label1);
    setLayout(hlayout1);@

  • Lifetime Qt Champion

    Hi,

    Are you sure the file can be found and opened ?



  • Thanks for your reply.
    Yes, the image for QPixmap is correct and the specified image is loaded in the QLable. My problem is with re-sizing of the QLabel and QWizardPage according to the image size.


  • Lifetime Qt Champion

    Then why do you call setScaledContents ?


Log in to reply
 

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