PDA

View Full Version : [QT4] Any way to disable window resizing ?



Amalsek
14th May 2006, 23:34
Well, as the title of the thread suggest, I'm searching for a way to disable window-resizing on a QDialog (isn't a QDialog no-resizable by default ?). I've tried several Qt::WindowFlags, but without success...

I'm currently running QT4 4.1.2 on kubuntu dapper.

wysota
15th May 2006, 00:33
Use setFixedSize(). It should disable resizing.

For example:

QDialog dlg;
dlg.show();
//...
dlg.setFixedSize(dlg.size());

Amalsek
15th May 2006, 03:14
Thanks a lot, that solved it...
(I wonder why this isn't a window property, oh well...)

Edit: well, it IS a property and I found where you can specify this in QT Designer : -> sizePolicy. Sometimes I think I should search more carefully.

wysota
15th May 2006, 10:26
Edit: well, it IS a property and I found where you can specify this in QT Designer : -> sizePolicy. Sometimes I think I should search more carefully.

Not exactly. Size policy only specifies the behaviour while in a layout. It doesn't have influence on top-level widgets (like QDialog).

Amalsek
15th May 2006, 12:28
Well, I removed the code you gave me, and modified setPolicy, and the result was the same. I was working on a QDialog widget.

Edit : Nevermind, you were rignt (forgot to remove old .o file)

wysota
15th May 2006, 12:36
Which version? I am able to resize the dialog despite the policy unless minimum and maximum sizes are set for the same values (which is exactly the same as you would call setFixedSize).