[Qt-interest] remove QSplitter children / disable splitter dragging.
Thomi Richards
thomir at gmail.com
Thu Oct 22 09:48:52 CEST 2009
Hi,
I'm trying to build a UI that contains a QSplitter with two child
widgets (one on each side). Under normal operations, the user can
interact with this QSplitter as you would expect. However, I want a
toggle button that hides / removes one of the two children of the
splitter, and only shows the one remaining widget.
Right now I'm simply calling "childWidget->hide()" when this mode is
enabled. However, the splitter can still be moved, which looks very
odd, since one side of the splitter is showing nothing.
Looking at the QSplitter API, it seems there are methods to add child
widgets, but not to remove them. My theory is that a splitter with
only one child widget will do what I want - not allow the user to drag
the splitter handle. I've also tried calling
"splitter->setEnabled(false)", which does prevent the user from moving
the splitter, but also disables the remaining child widgets.
Am I missing something? It seems odd to me that the QSplitter public
API allows for child addition but not removal.
Cheers,
More information about the Qt-interest-old
mailing list