--- a/Toolbox/PyQt4ImportHook.py Mon Jul 10 19:12:12 2017 +0200 +++ b/Toolbox/PyQt4ImportHook.py Tue Jul 11 21:25:35 2017 +0200 @@ -44,6 +44,21 @@ return None + @staticmethod + def QComboBox_currentData(other, role=None): + """ + Public method to emulate the currentData method of Qt5. + + @param role role of which data should be retrived + @return stored data at current selection + """ + import PyQt4.Qt + if role is None: + role = PyQt4.Qt.Qt.UserRole + + idx = other.currentIndex() + return other.itemData(idx, role) + def load_module(self, fullname): """ Public method to load a module. @@ -69,6 +84,8 @@ PyQt4.QtGui.QSortFilterProxyModel module.QAbstractProxyModel = PyQt4.QtGui.QAbstractProxyModel module.QStringListModel = PyQt4.QtGui.QStringListModel + + PyQt4.QtGui.QComboBox.currentData = self.QComboBox_currentData return module sys.meta_path.insert(0, PyQt4Importer())