> On Sun, Aug 29, 2010 at 7:05 AM, Ville M. Vainio <[email protected]> wrote:
>> I pushed a branch that shows how to add drag & drop support for Qt:
Ville's big hint made everything easy. What I did:
1. Added c to the ctor of LeoQTreeWidget.__init__. self.c.p becomes
the node to be dragged.
2. dropEvent is straightforward using tree.item2positionDict::
def dropEvent(self,ev):
if not ev: return
c = self.c ; tree = c.frame.tree
ev.setDropAction(QtCore.Qt.IgnoreAction)
ev.accept()
item = self.itemAt(ev.pos())
if not item: return
itemHash = tree.itemHash(item)
p = tree.item2positionDict.get(itemHash)
if not p or c.p == p: return
c.p.moveAfter(p)
c.redraw_now()
I'll add this to the trunk after a bit more testing. Also, this
should be undoable, and ctrl-drags should copy instead of move.
Edward
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/leo-editor?hl=en.