The short answer is: No.
PyQt's support for properties only allows you to set Qt-defined properties in the constructor. A quick skim of the properties section for QAction confirms that there is no separator
property, so you cannot set it in that way.
Of course, there is a very simple and obvious workaround for this. Just define your own subclass of QAction, and do the necessary configuration in its __init__
:
class Action(QtGui.QAction):
def __init__(self, *args, **kwargs):
super(Action, self).__init__(*args, **kwargs)
self.setSeparator(kwargs.get('separator', False))