本文整理汇总了Python中pyqtcore.QList.contains方法的典型用法代码示例。如果您正苦于以下问题:Python QList.contains方法的具体用法?Python QList.contains怎么用?Python QList.contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyqtcore.QList
的用法示例。
在下文中一共展示了QList.contains方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TileStampModel
# 需要导入模块: from pyqtcore import QList [as 别名]
# 或者: from pyqtcore.QList import contains [as 别名]
#.........这里部分代码省略.........
self.beginRemoveRows(parent, row, row + count - 1)
for x in range(count, 0, -1):
self.mThumbnailCache.remove(stamp.variations().at(row).map)
stamp.deleteVariation(row)
self.endRemoveRows()
if (stamp.variations().isEmpty()):
# remove stamp since all its variations were removed
self.beginRemoveRows(QModelIndex(), parent.row(), parent.row())
self.stampRemoved.emit(stamp)
self.mStamps.removeAt(parent.row())
self.endRemoveRows()
else :
if (row == 0):
# preview on stamp and probability sum need update
# (while technically I think this is correct, it triggers a
# repainting issue in QTreeView)
#emit dataChanged(index(parent.row(), 0),
# self.index(parent.row(), 1))
pass
self.stampChanged.emit(stamp)
else :
# removing stamps
self.beginRemoveRows(parent, row, row + count - 1)
for x in range(count, 0, -1):
for variation in self.mStamps.at(row).variations():
self.mThumbnailCache.remove(variation.map)
self.stampRemoved.emit(self.mStamps.at(row))
self.mStamps.removeAt(row)
self.endRemoveRows()
return True
##
# Returns the stamp at the given \a index.
##
def stampAt(self, index):
return self.mStamps.at(index.row())
def isStamp(self, index):
return index.isValid() \
and not index.parent().isValid() \
and index.row() < self.mStamps.size()
def variationAt(self, index):
if (not index.isValid()):
return None
parent = index.parent()
if (self.isStamp(parent)):
stamp = self.mStamps.at(parent.row())
return stamp.variations().at(index.row())
return None
def stamps(self):
return self.mStamps
def addStamp(self, stamp):
if (self.mStamps.contains(stamp)):
return
self.beginInsertRows(QModelIndex(), self.mStamps.size(), self.mStamps.size())
self.mStamps.append(stamp)
self.stampAdded.emit(stamp)
self.endInsertRows()
def removeStamp(self, stamp):
index = self.mStamps.indexOf(stamp)
if (index == -1):
return
self.beginRemoveRows(QModelIndex(), index, index)
self.mStamps.removeAt(index)
self.endRemoveRows()
for variation in stamp.variations():
self.mThumbnailCache.remove(variation.map)
self.stampRemoved.emit(stamp)
def addVariation(self, stamp, variation):
index = self.mStamps.indexOf(stamp)
if (index == -1):
return
variationCount = stamp.variations().size()
if (variationCount == 1):
self.beginInsertRows(TileStampModel.index(index, 0), 0, 1)
else:
self.beginInsertRows(TileStampModel.index(index, 0),
variationCount, variationCount)
self.mStamps[index].addVariation(variation)
self.endInsertRows()
probabilitySumIndex = TileStampModel.index(index, 1)
self.dataChanged.emit(probabilitySumIndex, probabilitySumIndex)
self.stampChanged.emit(stamp)
def clear(self):
self.beginResetModel()
self.mStamps.clear()
self.mThumbnailCache.clear()
self.endResetModel()