Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you debug Qt layout problems

Tags:

layout

qt

I've got a complex dialog, and it is full of whitespace and I can't shrink it. In Designer, it has lots of components that then get dynamically hidden, and a few which are dynamically added. I've added dumping of size policies, size hints, and minimum sizes, but still can't figure out why Qt won't let me drag it smaller.

There must be some tools or techniques for troubleshooting this.

Please share.

like image 572
Mike Elkins Avatar asked Oct 24 '08 02:10

Mike Elkins


2 Answers

I don't know of any tools for doing this, but I have managed it before by changing the palette of the different elements in the dialog, then looking at what is taking up more (or less) room than I expected, and focusing my investigation on those elements.

In a more general sense, make sure you've set the dialog to not be a fixed size. That bit me once as well.

like image 125
Caleb Huitt - cjhuitt Avatar answered Sep 24 '22 03:09

Caleb Huitt - cjhuitt


You could capture QApplication::focusChanged(QWidget*,QWidget*) signal and change the background of currently focused widget. I think this would help to determine how much space each widget occupies.

like image 24
Sebastian Dusza Avatar answered Sep 21 '22 03:09

Sebastian Dusza