PDA

View Full Version : QSplitter::setChildrenCollapsible doesn't work



Cyrano
16th November 2009, 13:19
Even if I set in my splitter the property "childrenCollapsible" to false the user can resize the child-widgets to zero. Does anybody know why? Do i need to set other properties too?
(I'm using QT4.5.3 with MSVC2008 in WindowVista)

montuno
17th November 2009, 08:17
It should work if you call it manually:


ui.setupUi();
ui.splitter->setChildrenCollapsible(false);

Cyrano
17th November 2009, 16:49
Well, actually, I've tried it but it isn't the solution to the problem (the "setupUi" function already calls the "setChidlrenCollapsible"... so, there is no need to call it again").

Anyway, I found the problem. It was my fault (of course... hehe). In my program I'm using the functions "readSettings" and "writeSeetings" to save some info into the registry and reload them at the next use:

setupUi(this);
readSettings();

In details, I save/load the splitter-sizes too. The problem is that I use the functions "saveState"/"restoreState" to do that. The "saveState" function saves not only the sizes of the splitter (the Qt-documentation doesn't explain the meaning of "state" of a QSplitter). I suppose it saves the property "ChildrenCollapsible" too.
So, even if I changed (using the designer) the initial value of that property, I was always using the value stored in the registry (at the begin of the project the value of that property was TRUE).

So the solution is not to use the functions "saveState"/"restoreState" (I only need to load/save the sizes, so I wrote two function to save/restore only the sizes).

Thanks, anyway
bye bye...