added Qt version check.
#!/usr/bin/python
+from distutils.version import LooseVersion
from sys import platform
from PySide2 import QtGui, QtCore, QtWidgets
@@ -40,6 +41,7 @@ class ContextMenu(object):
return ContextMenu(self.__view, menu)
def add_action(self, action):
+ if LooseVersion(QtCore.qVersion()) >= LooseVersion('5.10'):
action.setShortcutVisibleInContextMenu(True)
self.__menu.addAction(action)
@@ -51,6 +53,7 @@ class ContextMenu(object):
def add_command(self, name, func=None, shortcut=None):
action = QtWidgets.QAction(name, self.__view)
+ if LooseVersion(QtCore.qVersion()) >= LooseVersion('5.10'):
action.setShortcutVisibleInContextMenu(True)
if shortcut:
action.setShortcut(shortcut)
