Quote Originally Posted by zell99 View Post
The thing is that in a QTreeWidget the default drag and drop action is Copy, to make a Move action you have to hold SHIFT. I was wondering if I could change it so I don't have to hold shift in order to make a Move action. I restricted actions to MoveAction using the "supportedActions()" function and "setSupportedActions()". Now, it works if I shift-drag but if I just drag normally it doesn't work (since it's trying to make a Copy action which is not supported)
You can always reimplement QWidget::mousePressEvent(QMouseEvent*) and create your own QDrag object specifying the drag type (move or copy) by hand.

Quote Originally Posted by zell99 View Post
I have another newbie question. I have a class (MyMainWindow) which reimplements QMainWindow and in that class, I created the MyTreeWidget class (which inherits QTreeWidget). I understand that in MyTreeWidget I can use the "parentWidget()" function which returns a QWidget pointer on my parent (MyMainWindow), but how can I have access to the private variables I have in MyMainWindow, since the pointer is of QWidget type?
You shouldn't ask two very different questions in the same thread (and especially you shouldn't ask this one at all :P ). All you have to do is to use
Qt Code:
  1. qobject_cast<MyMainWindow*>(parentWidget())
To copy to clipboard, switch view to plain text mode 
to get a pointer of the type you're interested in. Then you shall use friendship to let your tree widget access private members of your main window.