PDA

View Full Version : QTreeWidget



allensr
14th November 2006, 00:12
Hi,

I have a QTreeWidget that has 4 columns with several records. Three of the columns contains positional data (x,y,z) that I would like to be able to select for drag and drop. My 1st question is can you set it up like MS Excel where you can select a column (getting all of its data) and 2nd assuming you can select a column how do you set up the drag and drop of that column into a QTableWidget that has 3 columns?

Hope this makes sense.

TIA

wysota
14th November 2006, 07:11
If you use a table widget and not a tree widget, you should be able to select the whole column. As for drag and drop, you need to set a draggable flag for the items you want to drag, make the treewidget accept drops and also maybe set particular items to accept drops (depending on where you want to drop those items). Then you have to assure that the same mime type is used (I think QTreeWidget and QTableWidget will do that for you automatically).

allensr
14th November 2006, 17:18
Thanks, that's good info on the drag and drop.

I actually need the tree widget, though. What I currently have only has 4 fixed columns now, but will eventually grow into a widget for browsing attributes of objects. So are you saying there is no way for selecting columns is a tree widget? If so, do you have any suggestions for selecting this data in a tree widget?

Thanks.

wysota
14th November 2006, 17:24
I didn't say there was no way for selecting columns within a tree widget :) You can connect to the headerviews clicked signal and select all items in a particular column from within a custom slot.