PDA

View Full Version : disabling resizing of a dialog



deepakn
21st June 2007, 07:48
Hello all...

I have a dialog whose default size i have set [to some desired value]. After that, i want its resizing disabled. Could anyone please tell how to do that?

Here is a part of the code:

QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(headerLabel);
mainLayout->addWidget(onoffGbx());
.....
mainLayout->addStretch();
mainLayout->addLayout(buttonLayout);

resize(380, 420); //here i have fixed the size. i want it to remain the same throughout.
//mainLayout->setSizeConstraint(QLayout::SetFixedSize);
setLayout(mainLayout);

setWindowTitle("Testbed settings");

I tried mainLayout->setSizeConstraint(QLayout::SetFixedSize); but its changing the size to some default value of its own.

Also, by using mainLayout->addStretch(); can we fix the value of space[gap]? i saw mainLayout->addStretch(1); somewhere in the examples. Whats the significance of '1' there?

Thank you.:)

guilugi
21st June 2007, 09:10
Hi,

Simply use setFixedSize( QSize(380, 420) );

It sets both minimum and maximum size in one call :)

Guilugi.

deepakn
21st June 2007, 09:14
:) That worked. Thanks a lot. :)