PDA

View Full Version : problem while dropping into QTableView



jay
9th September 2008, 13:35
Dear all,

I am using QTableView+QDirModel for displaying local file system files and folders.

at first, it is showing all Drives using "model->setRootIndex("/");".

If a row in the table is double clicked, I am displaying clicked folder contents. again I am using
"setRootIndex(clicked path)" method.

I have enabled Drag and Drop for this View and also reimplemented Drag and Drop related functions in the MyDirModel class. In the same way flags function is also reimplemented by returning the below flags.

return Qt::ItemIsEnabled | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled;

My problem is,
This view is accepting drops only if the "/" contents were in display.
it is not accepting drops when all other path's contents were displayed.

Please any one help me.

Thanks.

wysota
9th September 2008, 17:43
Could you provide a minimal compilable example reproducing the problem?

jay
10th September 2008, 08:20
Dear wysota,

I have attached a Zip file contains 4 files.

I am using
Qt 4.4.0 in windows.

Thanks you.

jpn
12th September 2008, 19:22
For QDirModel, it is enough to setReadOnly(false) to enable drag and drop functionality. See Extended Dir View example for more details.