How to override event (dropEvent) of a widget in dynamic UI of PyQt?
<p><strong>What am I doing/ What I have so far :</strong></p>

<p>I am using Qt-designer to create PyQt .ui file which I am loading in my python script using QUiLoader which gives me access to the widgets/components as :</p>

<pre><code>self.ui.tree_widget_of_items ( which is a QTreeWidget created in Qt-designer)
</code></pre>

<p>I am able to read and write the values of widgets and I am able to use the signal on TreeWidget like this :</p>

<pre><code>self.ui.tree_widget_of_items.itemSelectionChanged.connect(self.myFunction)
</code></pre>

<p><strong>What I am trying to do ?</strong> </p>

<ul>
<li>I want to override dropEvent of treeWidget in my python script</li>
</ul>

<p><strong>What I have tried but didn't work :</strong></p>

<pre><code>self.ui.tree_widget_of_items.dropEvent = self.drop_action

def drop_action(self,e):
    print "drop action"
</code></pre>

<p>I have tried assigning a my own function to dropEvent of TreeWidget but it doesn't get triggered when I drop an item on TreeWidget.</p>

<p>I have also tried :</p>

<pre><code>self.ui.tree_widget_of_items.dragEnterEvent = self.drop_action
</code></pre>

<p>I made sure that Drag and Drop is enabled on TreeWidget.</p>