self.widget_layers.setContextMenuPolicy(Qt.ActionsContextMenu)
removeLayerAction = QAction('Remove selected layer', self)
self.connect(removeLayerAction, SIGNAL('triggered()'), self.
    layers_widget_controller.remove_selected_layer)
Invoking context menu in QTreeWidget