Hi there,
I think I'm misunderstanding something fundamental about QT and Maya UI
interactions.
I've created a small PyQt window that contains some tabs and, in one of my
test tabs, I have a grid populated by a couple of custom QLabel widgets.
Those widgets are the bits I want to drag into the Maya viewport and, in
turn, execute some code when the drop is recognized.
In my custom QLabel, I have a dragEnterEvent and mousePressEvent.
For the main Maya window, I install an eventFilter that checks for
QEvent.Enter, DragEnter and Drop.
The eventFilter only ever seems to fire off the QEvent.Enter code but never
DragEnter or Drop.
Here's my eventFilter:
def eventFilter(self, receiver, event):
self.receiver = receiver
if event.type() is QEvent.Enter:
print("ENTERED, FOOL!")
self.mouse_button = QApplication.mouseButtons()
event.accept()
return True
if event.type() is QEvent.DragEnter:
print("DRAG ENTERED!")
self.mouse_button = QApplication.mouseButtons()
event.accept()
return True
if event.type() is QEvent.Drop:
print("DROPPED")
library_w = event.source()
if self.mouse_button == Qt.LeftButton:
print 'you dropped the bomb.'
return True
else:
print 'nothing dropped.'
Is there something more I need to do to get DragEnter and Drop to function
in the eventFilter?
Thanks,
Alec
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/4565ad58-3009-4ef6-a9ae-3a28e390aab2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.