Skip to content

Commit

Permalink
db_manager: replace toPyObject() (old sip api; fixes #9991)
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Jun 1, 2014
1 parent dcc9d39 commit 272ac2e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions python/plugins/db_manager/db_plugins/data_model.py
Expand Up @@ -266,8 +266,9 @@ def _getNewObject(self):
return TableConstraint(None)

def getObject(self, row):
val = self.data(self.index(row, 0), Qt.UserRole)
constr = val.toPyObject() if val.isValid() else self._getNewObject()
constr = self.data(self.index(row, 0), Qt.UserRole)
if not constr:
constr = self._getNewObject()
constr.name = self.data(self.index(row, 0)) or ""
constr.type = self.data(self.index(row, 1), Qt.UserRole)
constr.columns = self.data(self.index(row, 2), Qt.UserRole)
Expand Down Expand Up @@ -297,8 +298,9 @@ def _getNewObject(self):
return TableIndex(None)

def getObject(self, row):
val = self.data(self.index(row, 0), Qt.UserRole)
idx = val.toPyObject() if val.isValid() else self._getNewObject()
idx = self.data(self.index(row, 0), Qt.UserRole)
if not idx:
idx = self._getNewObject()
idx.name = self.data(self.index(row, 0))
idx.columns = self.data(self.index(row, 1), Qt.UserRole)
return idx
Expand All @@ -308,4 +310,3 @@ def getIndexes(self):
for idx in self.getObjectIter():
idxs.append( idx )
return idxs

0 comments on commit 272ac2e

Please sign in to comment.