[SOLVED] How to shrink QMainWindow with a QLabel including an image?



  • Hi,
    I am using several QLabels for displaying videos in my MainWindow.
    Now I have a problem with re-sizing the window.
    I can easily use my mouse to make the MainWindow bigger while the program executes.
    All the videos are automatically resized using the code below.
    But if I try to make the window smaller it is not working.
    It looks like the QLabels cannot be resized to a smaller size.

    What can I do that the user is able to make the MainWindow bigger and also smaller?

    Thank you very much :-)

    void MainWindow::updateGuiVid1(QImage img)
    {
        if (!img.isNull())
        {
            ui->video1_lbl->setAlignment(Qt::AlignCenter);
            ui->video1_lbl->setPixmap(QPixmap::fromImage(img).scaled(ui->video1_lbl->size(),Qt::KeepAspectRatio,Qt::FastTransformation));
        }
    }
    

  • Qt Champions 2016

    hi
    have you tried with
    label->setMinimumSize(1, 1)



  • Sorry for the late reply, I was away for a while.

    Actually your suggestion works perfect :-)

    Thank you very much!


Log in to reply
 

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