PDA

View Full Version : [QSplitter] How to prevent splitter snapping?



faizol
21st October 2012, 17:21
Hi all,

I can't seem to find the right method to disable QSplitter handle from snapping to the edge of the geometry when it's close to it. This snapping doesn't happen if one uses Designer instead of coding by hand. Also already tried to look into the code generated by Designer but there's nothing there to indicate the right method to prevent this.

Any pointers as to what method should I be looking for?

TIA.

Best Regards,
Faizol

Ashkan_s
21st October 2012, 18:59
use QSplitter::setCollapsible

faizol
22nd October 2012, 05:28
I realized now that the snapping behavior is totally depending on the child widget. The snapping doesn't occur if the child widget is a QFrame object, but will happen if it's a QTextEdit object, for example.

Thanks.

Ashkan_s
22nd October 2012, 10:23
QTextEdit is also a QFrame it inherits QFrame.
Using something like
splitter.setCollapsible(index,false); to prevent the effect.

faizol
22nd October 2012, 14:34
Thanks. I actually did try that, but the handle just stop at certain percentage instead of collapsing. What I wanted to do was to be able to drag the handle to the edge of the area without snapping. I could achieve this with QFrame.

Again, thanks.

wysota
22nd October 2012, 16:10
It depends on the size hint and size policy of the widget, not its class.