How to drag drop Houdini Node onto QtWidgets.QLineEdit

   2336   4   2
User Avatar
Member
10 posts
Joined: July 2014
Offline
Hey,

I made a little GUI using PySide2 QtWidgets and I have a QLineEdit that I want to be able to populate using information from a node.

For example, I'd like to drag a Filecache node over the input field and then have the input field populated with the output location of the filecache.

I've seen similar functionality inside Houdini itself.

I've added:

self.setAcceptDrops(True)
and
self.bgeoInput.setDragEnabled(True)

But that only works if a drag a file from windows explorer onto my input field.


Has anyone done this before?

Thanks,
User Avatar
Member
402 posts
Joined: June 2014
Offline
Hi,

unfortunately at the moment it doesn't seem to be possible to get drag and drop events to fire in a QtWidget outside of a python panel… are you launching a dialog or such from the tool shelf?

PS… really happy if I'm wrong though
Edited by friedasparagus - Feb. 22, 2018 09:53:27
Henry Dean
User Avatar
Member
10 posts
Joined: July 2014
Offline
Hey,

I'm running an external script from inside Houdini yeah, but no worries - I'll work around it.

Thanks for the reply
User Avatar
Member
10 posts
Joined: Nov. 2015
Offline
@eng, I am curious did you solve the problem, I run into the same problem
User Avatar
Member
10 posts
Joined: July 2014
Offline
pisces
@eng, I am curious did you solve the problem, I run into the same problem

Hey, I ended up just populating it by opening up an Explorer window to a specific location (to allow the user to select a file):

def selectInputFileSeq(self):
    textboxValue=QtWidgets.QFileDialog.getOpenFileName(self, 'Select file from bgeo sequence', currentHipFileLocation, '*.bgeo.sc')
    if textboxValue:
        try:
            bgeo = str(textboxValue[0]).split(".")[:-3][0] + ".$F4.bgeo.sc"
            self.bgeoInput.setText(bgeo)
        except:
            print "Please slecet a .bgeo.sc file!"
    else:
        print "Nothing selected!"

Not what you're after exactly, but I hope it helps.
Edited by GlassworksEng - Nov. 2, 2018 12:47:32
  • Quick Links