PDA

View Full Version : Some QTreeView Issues



kazibi
27th December 2009, 15:51
Hello, I have been experimenting some troubles with the D&D of a QTreeView widged.


1. When you drag an item to a dropable index it is drawn inside a black rectangle, is there any way to change this behavior so that the black box gets drawed in the whole row instead of a single item?
4021


2. I was looking at the QTreeView drawRow implementation and get dissapointed about this:


if (headerSection == 0) { // headerSection means the column
...
drawBranches(painter, branches, index);
...
} else {
...
}

I use model indexes based on QSqlRecords, so the column 0 == table id, so I set setColumnHidden(0,true) to hide the record ID field from the user and voila, branches dissapear. The obvious solution is to subclass, I need only change columnheader == Other_Columns and everything should be perfect. The problem arises when trying to create the subclass, I don't understand how to replace statements using the d-pointer like this:

const QPoint offset = d-> context scrollDelayOffset in the subclass
in the subclass context.


3. Is there a way to "move" nodes to another nodes on D&D operation instead of remove-add new rows? I mean, when you successful terminates a ActionMove drop operation, first the draged row is remove, then a new row is created and populated with the deleted row data. I just want to move.

Thanks in advance.