PDA

View Full Version : QTableView header dragging



cmaxb
27th November 2006, 01:49
How can I override the behavior of movable columns and rows in a table? It seems like the consistent thing to do is have them respond to Ctrl-click move. However, Trolls have single click move. I want to be able to click once on header and open an editor, to change lable, then Ctrl-click to move.

wysota
9th December 2006, 12:11
Are we talking Qt4 here? First of all you should connect to the QHeaderView::sectionClicked() signal of the header and implement showing the editor there. Moving columns shouldn't interfere with that. You can disable section moving with QHeaderView::setMovable() just to make sure. If you'll still want to move headers, it should be enough to reimplement mouseMoveEvent for the header to call appropriate methods from the header class which handle moving.