本文整理汇总了Python中pyqtcore.QList.removeAll方法的典型用法代码示例。如果您正苦于以下问题:Python QList.removeAll方法的具体用法?Python QList.removeAll怎么用?Python QList.removeAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyqtcore.QList
的用法示例。
在下文中一共展示了QList.removeAll方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: QtGroupBoxPropertyBrowserPrivate
# 需要导入模块: from pyqtcore import QList [as 别名]
# 或者: from pyqtcore.QList import removeAll [as 别名]
#.........这里部分代码省略.........
def propertyInserted(self, index, afterIndex):
afterItem = self.m_indexToItem[afterIndex]
parentItem = self.m_indexToItem.value(index.parent())
newItem = WidgetItem()
newItem.parent = parentItem
layout = 0
parentWidget = 0
row = -1
if (not afterItem):
row = 0
if (parentItem):
parentItem.children.insert(0, newItem)
else:
self.m_children.insert(0, newItem)
else:
if (parentItem):
row = parentItem.children.indexOf(afterItem) + 1
parentItem.children.insert(row, newItem)
else:
row = self.m_children.indexOf(afterItem) + 1
self.m_children.insert(row, newItem)
if (parentItem and self.hasHeader(parentItem)):
row += 2
if (not parentItem):
layout = self.m_mainLayout
parentWidget = self.q_ptr
else:
if not parentItem.groupBox:
self.m_recreateQueue.removeAll(parentItem)
par = parentItem.parent
w = 0
l = 0
oldRow = -1
if (not par):
w = self.q_ptr
l = self.m_mainLayout
oldRow = self.m_children.indexOf(parentItem)
else:
w = par.groupBox
l = par.layout
oldRow = par.children.indexOf(parentItem)
if (self.hasHeader(par)):
oldRow += 2
parentItem.groupBox = QGroupBox(w)
parentItem.layout = QGridLayout()
parentItem.groupBox.setLayout(parentItem.layout)
if (parentItem.label):
l.removeWidget(parentItem.label)
parentItem.label.close()
parentItem.label = 0
if (parentItem.widget):
l.removeWidget(parentItem.widget)
parentItem.widget.setParent(parentItem.groupBox)
parentItem.layout.addWidget(parentItem.widget, 0, 0, 1, 2)
parentItem.line = QFrame(parentItem.groupBox)
elif (parentItem.widgetLabel):
l.removeWidget(parentItem.widgetLabel)
parentItem.widgetLabel.close()
parentItem.widgetLabel = 0
示例2: QtButtonPropertyBrowserPrivate
# 需要导入模块: from pyqtcore import QList [as 别名]
# 或者: from pyqtcore.QList import removeAll [as 别名]
#.........这里部分代码省略.........
self.q_ptr.collapsedSignal.emit(self.m_itemToIndex[item])
def updateLater(self):
QTimer.singleShot(0, self.slotUpdate)
def propertyInserted(self, index, afterIndex):
afterItem = self.m_indexToItem[afterIndex]
parentItem = self.m_indexToItem.value(index.parent())
newItem = WidgetItem()
newItem.parent = parentItem
layout = 0
parentWidget = 0
row = -1
if (not afterItem):
row = 0
if (parentItem):
parentItem.children.insert(0, newItem)
else:
self.m_children.insert(0, newItem)
else:
row = self.gridRow(afterItem) + self.gridSpan(afterItem)
if (parentItem):
parentItem.children.insert(parentItem.children.indexOf(afterItem) + 1, newItem)
else:
self.m_children.insert(self.m_children.indexOf(afterItem) + 1, newItem)
if (not parentItem):
layout = self.m_mainLayout
parentWidget = self.q_ptr
else:
if (not parentItem.container):
self.m_recreateQueue.removeAll(parentItem)
grandParent = parentItem.parent
l = 0
oldRow = self.gridRow(parentItem)
if (grandParent):
l = grandParent.layout
else:
l = self.m_mainLayout
container = QFrame()
container.setFrameShape(QFrame.Panel)
container.setFrameShadow(QFrame.Raised)
parentItem.container = container
parentItem.button = self.createButton()
self.m_buttonToItem[parentItem.button] = parentItem
parentItem.button.toggled.connect(self.slotToggled)
parentItem.layout = QGridLayout()
container.setLayout(parentItem.layout)
if (parentItem.label):
l.removeWidget(parentItem.label)
parentItem.label.close()
parentItem.label = 0
span = 1
if (not parentItem.widget and not parentItem.widgetLabel):
span = 2
l.addWidget(parentItem.button, oldRow, 0, 1, span)
self.updateItem(parentItem)
layout = parentItem.layout
parentWidget = parentItem.container
newItem.label = QLabel(parentWidget)
示例3: MapDocument
# 需要导入模块: from pyqtcore import QList [as 别名]
# 或者: from pyqtcore.QList import removeAll [as 别名]
#.........这里部分代码省略.........
# Emits the editLayerNameRequested signal, to get renamed.
##
def emitEditLayerNameRequested(self):
self.editLayerNameRequested.emit()
##
# Emits the editCurrentObject signal, which makes the Properties window become
# visible and take focus.
##
def emitEditCurrentObject(self):
self.editCurrentObject.emit()
##
# Before forwarding the signal, the objects are removed from the list of
# selected objects, triggering a selectedObjectsChanged signal when
# appropriate.
##
def onObjectsRemoved(self, objects):
self.deselectObjects(objects)
self.objectsRemoved.emit(objects)
def onMapObjectModelRowsInserted(self, parent, first, last):
objectGroup = self.mMapObjectModel.toObjectGroup(parent)
if (not objectGroup): # we're not dealing with insertion of objects
return
self.objectsInserted.emit(objectGroup, first, last)
self.onMapObjectModelRowsInsertedOrRemoved(parent, first, last)
def onMapObjectModelRowsInsertedOrRemoved(self, parent, first, last):
objectGroup = self.mMapObjectModel.toObjectGroup(parent)
if (not objectGroup):
return
# Inserting or removing objects changes the index of any that come after
lastIndex = objectGroup.objectCount() - 1
if (last < lastIndex):
self.objectsIndexChanged.emit(objectGroup, last + 1, lastIndex)
def onObjectsMoved(self, parent, start, end, destination, row):
if (parent != destination):
return
objectGroup = self.mMapObjectModel.toObjectGroup(parent)
# Determine the full range over which object indexes changed
first = min(start, row)
last = max(end, row - 1)
self.objectsIndexChanged.emit(objectGroup, first, last)
def onLayerAdded(self, index):
self.layerAdded.emit(index)
# Select the first layer that gets added to the map
if (self.mMap.layerCount() == 1):
self.setCurrentLayerIndex(0)
def onLayerAboutToBeRemoved(self, index):
layer = self.mMap.layerAt(index)
if (layer == self.mCurrentObject):
self.setCurrentObject(None)
# Deselect any objects on this layer when necessary
og = layer
if type(og) == ObjectGroup:
self.deselectObjects(og.objects())
self.layerAboutToBeRemoved.emit(index)
def onLayerRemoved(self, index):
# Bring the current layer index to safety
currentLayerRemoved = self.mCurrentLayerIndex == self.mMap.layerCount()
if (currentLayerRemoved):
self.mCurrentLayerIndex = self.mCurrentLayerIndex - 1
self.layerRemoved.emit(index)
# Emitted after the layerRemoved signal so that the MapScene has a chance
# of synchronizing before adapting to the newly selected index
if (currentLayerRemoved):
self.currentLayerIndexChanged.emit(self.mCurrentLayerIndex)
def onTerrainRemoved(self, terrain):
if (terrain == self.mCurrentObject):
self.setCurrentObject(None)
def setFileName(self, fileName):
if (self.mFileName == fileName):
return
oldFileName = self.mFileName
self.mFileName = fileName
self.fileNameChanged.emit(fileName, oldFileName)
def deselectObjects(self, objects):
# Unset the current object when it was part of this list of objects
if (self.mCurrentObject and self.mCurrentObject.typeId() == Object.MapObjectType):
if (objects.contains(self.mCurrentObject)):
self.setCurrentObject(None)
removedCount = 0
for object in objects:
removedCount += self.mSelectedObjects.removeAll(object)
if (removedCount > 0):
self.selectedObjectsChanged.emit()
def disconnect(self):
try:
super().disconnect()
except:
pass