Set QDialog fixed size without cutting text

I am currently setting QDialog for a fixed size using the following code

dlg->setWindowModality(Qt::WindowModal); 
dlg->setFixedSize(dlg->size());

Now, as a result of this code, regardless of size, I save the ui form in QT Designer. He sticks to that size. This, however, becomes a problem in some systems and displays. Where my Qlabels start to shrink due to lack of space. I wanted to know what would be the right way to do this? How would I determine which size would fit the layout on the form. Does the form itself have a horizontal layout that has multiple layouts in it?

+4
source share
1 answer

Try

dlg->adjustSize();
dlg->setFixedSize(dlg->sizeHint());
+1
source

Source: https://habr.com/ru/post/1532719/


All Articles