Drag & Drop in KListWidget (PyQt/PyKde programming) -


I am developing a small app in PyQt / PyKde (properly this is a KDE4 Plasmode)

I have a KListWidget full of some rows in my app, see this picture:

I need to implement drag and drop action for list rows, for example , I should be able to put any file in one line, then the app will send this file to the name in the list.

The list is created by snippet of this code:

  self.contactsList = KListWidget () self.contactsList.setFrameShape (QFrame.StyledPanel) self.contactsList.setFrameShadow ( QFrame.Sunken) self.contactsList.setIconSize (QSize (35, 35));  

The method has already been implemented to make a call when drag-and-drop is done, I need to methodically add this list in the same way as:

  self.connect (self.contactsList, signal ("signal_ ()"), self.method  

Any help would be appreciated

After the text "itemprop =" text ">

PyQt signals class that can be defined dynamically as self.contacts_list_method (unless otherwise) from QWidget Legacy, it's a dynamic Nket can emit.

For example, the contactList object is that by adding your list code, at the end of the method in handles:

  def contacts_list_method (self, someparameters): doStuff () doMoreStuff ) ... self.emit (QtCore.SIGNAL ('contacts_list_method_done ())))  

Then the class launcher that holds the contactList object (or even you feel a better place) in Put the following connection:

  auto. Connect (self.contactsList, signal ("contacts_lis t_method_done ()"), self.method)  

QtCore.SIGNAL (could be defined as "a variant As shall contacts_list_method_done () ") and when you throw it just Contacts_list_method mentioned object. In


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -