Hmm, in Reference Documentation is something like this:
Sets the flag determining whether the widget's preferred height depends on its width, to dependent.
void QSizePolicy::setHeightForWidth ( bool dependent )
Sets the flag determining whether the widget's preferred height depends on its width, to dependent.
To copy to clipboard, switch view to plain text mode
But it doesn't work... Maybe I do something wrong...
sizePolicy.setHeightForWidth(true);
setLayout(MyGrid);
ImageLabel1->setScaledContents(true);
ImageLabel1->setSizePolicy(sizePolicy);
ImageLabel1->setPixmap(Pixmap1->scaled(300,300,Qt::KeepAspectRatio));
ImageLabel2->setScaledContents(true);
ImageLabel1->setSizePolicy(sizePolicy);
ImageLabel2->setPixmap(Pixmap2->scaled(300,300,Qt::KeepAspectRatio));
MyGrid->addWidget(ImageLabel1,0,0);
MyGrid->addWidget(ImageLabel2,0,1);
QSizePolicy sizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
sizePolicy.setHeightForWidth(true);
MyGrid=new QGridLayout();
setLayout(MyGrid);
Image1=new QImage(1000,1000,QImage::Format_RGB32);
Image2=new QImage(1000,1000,QImage::Format_RGB32);
Pixmap1=new QPixmap(QPixmap::fromImage(*Image1));
Pixmap2=new QPixmap(QPixmap::fromImage(*Image2));
ImageLabel1=new QLabel();
ImageLabel1->setScaledContents(true);
ImageLabel1->setSizePolicy(sizePolicy);
ImageLabel1->setPixmap(Pixmap1->scaled(300,300,Qt::KeepAspectRatio));
ImageLabel2=new QLabel();
ImageLabel2->setScaledContents(true);
ImageLabel1->setSizePolicy(sizePolicy);
ImageLabel2->setPixmap(Pixmap2->scaled(300,300,Qt::KeepAspectRatio));
MyGrid->addWidget(ImageLabel1,0,0);
MyGrid->addWidget(ImageLabel2,0,1);
To copy to clipboard, switch view to plain text mode
Bookmarks