1

I need to update the QSplitterHandle position when QSplitter child widget is resized due to other reason, than moving splitter handle. Particularly, I have the composite widget inside the splitter, and one of it's children is hidden. I've tried the following things:

  1. setting QSizePolicy to widget.
  2. setting QSizePolicy to the other widgets in QSplitter
  3. setting stretch factors to the widgets inside QSplitter
LogicStuff
  • 19,397
  • 6
  • 54
  • 74
  • Actually there is a way to do this using QSplitter::setSizes(), but in that case I need to recalculate the widgets sizes. I need a solution to do that automatically – Albert Torosyan Mar 18 '15 at 08:56
  • I have the same issue in a recent project with a horizontal QSplitter having 2 childs ( 1 "composite", 1 sole widget). In addition I want to limit the width max width of the first child to 75% of the window size. When reducing the windows width, the child resizes, while the splitter handle stays at its position. My current solution involves using `QSplitter::setSizes()` triggered via a signal from its child – Martin Dec 09 '20 at 13:40

1 Answers1

1

I've asked the same question at QT support center, and here is the answer: Unfortunately there is no automated update function for handle position. The setSizes() function is a good option to update the sizes, but I can see the problem with recalculating the sizes every time. Another way is to implement your own splitter and call its protected function moveSplitter(). You still need to calculate the position where the splitter handle needs to be moved to, but you don't have to recalculate all widget sizes.