PDA

View Full Version : QSplitter and re-arranging widgets within



poppenspeler
3rd October 2011, 15:39
Hiho!

I want to be able to drag a widget from one position inside a splitter to another position in the same splitter.

For example: i have a vertical splitter and if i dragged a widget up (or down) wards the space that this widget occupied should be taken by the widget above (or below) it thus giving room to drop the dragged widget there. also i should not be able to drag a widget outside of the splitters boundaries.
What do i have to do to accomplish this?

I am rather new to Qt and using verision 4.7.

Best regards

fullmetalcoder
19th October 2011, 21:48
reimplement mousePressEvent and mouseMoveEvent in your splitter to initiate the drag operation (refer to the various drag and drop (http://doc.qt.nokia.com/stable/dnd.html) examples in the docs for more details)
use QWidget::childAt to determine which child to move
use QSplitter::insertWidget to do the actual move
Use the docs (http://doc.qt.nokia.com/) Luke ;)