本文整理汇总了Python中pyqtcore.QList类的典型用法代码示例。如果您正苦于以下问题:Python QList类的具体用法?Python QList怎么用?Python QList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: tileLayers
def tileLayers(self):
layers = QList()
for layer in self.mLayers:
tl = layer.asTileLayer()
if tl:
layers.append(tl)
return layers
示例2: init
def init(self, parent):
layout = QHBoxLayout(parent)
layout.setContentsMargins(0, 0, 0, 0)
self.m_treeWidget = QtPropertyEditorView(parent)
self.m_treeWidget.setEditorPrivate(self)
self.m_treeWidget.setIconSize(QSize(18, 18))
layout.addWidget(self.m_treeWidget)
parent.setFocusProxy(self.m_treeWidget)
self.m_treeWidget.setColumnCount(2)
labels = QList()
labels.append(QCoreApplication.translate("QtTreePropertyBrowser", "Property"))
labels.append(QCoreApplication.translate("QtTreePropertyBrowser", "Value"))
self.m_treeWidget.setHeaderLabels(labels)
self.m_treeWidget.setAlternatingRowColors(True)
self.m_treeWidget.setEditTriggers(QAbstractItemView.EditKeyPressed)
self.m_delegate = QtPropertyEditorDelegate(parent)
self.m_delegate.setEditorPrivate(self)
self.m_treeWidget.setItemDelegate(self.m_delegate)
self.m_treeWidget.header().setSectionsMovable(False)
self.m_treeWidget.header().setSectionResizeMode(QHeaderView.Stretch)
self.m_expandIcon = drawIndicatorIcon(self.q_ptr.palette(), self.q_ptr.style())
self.m_treeWidget.collapsed.connect(self.slotCollapsed)
self.m_treeWidget.expanded.connect(self.slotExpanded)
self.m_treeWidget.currentItemChanged.connect(self.slotCurrentTreeItemChanged)
示例3: setSelectedObjectItems
def setSelectedObjectItems(self, items):
# Inform the map document about the newly selected objects
selectedObjects = QList()
#selectedObjects.reserve(items.size())
for item in items:
selectedObjects.append(item.mapObject())
self.mMapDocument.setSelectedObjects(selectedObjects)
示例4: interfaces
def interfaces(self):
results = QList()
for plugin in self.mPlugins:
result = plugin.instance
if result:
results.append(result)
return results
示例5: FormatHelper
class FormatHelper():
def __init__(self, capabilities, initialFilter):
self.mFilter = initialFilter
self.mFormats = QList()
self.mFormatByNameFilter = QMap()
def t(self, format):
if (format.hasCapabilities(capabilities)):
nameFilter = format.nameFilter()
self.mFilter += ";;"
self.mFilter += nameFilter
self.mFormats.append(format)
self.mFormatByNameFilter.insert(nameFilter, format)
PluginManager.each(self, t)
def filter(self):
return self.mFilter
def formats(self):
return self.mFormats
def formatByNameFilter(self, nameFilter):
return self.mFormatByNameFilter.value(nameFilter)
示例6: objects
def objects(_type=None):
results = QList()
for object in PluginManager.instance().mObjects:
if _type!=None and type(object)!=_type:
continue
results.append(object)
return results
示例7: setupRuleList
def setupRuleList(self):
combinedRegions = coherentRegions(
self.mLayerInputRegions.region() +
self.mLayerOutputRegions.region())
combinedRegions = QList(sorted(combinedRegions, key=lambda x:x.y(), reverse=True))
rulesInput = coherentRegions(
self.mLayerInputRegions.region())
rulesOutput = coherentRegions(
self.mLayerOutputRegions.region())
for i in range(combinedRegions.size()):
self.mRulesInput.append(QRegion())
self.mRulesOutput.append(QRegion())
for reg in rulesInput:
for i in range(combinedRegions.size()):
if (reg.intersects(combinedRegions[i])):
self.mRulesInput[i] += reg
break
for reg in rulesOutput:
for i in range(combinedRegions.size()):
if (reg.intersects(combinedRegions[i])):
self.mRulesOutput[i] += reg
break
for i in range(self.mRulesInput.size()):
checkCoherent = self.mRulesInput.at(i).united(self.mRulesOutput.at(i))
coherentRegions(checkCoherent).length() == 1
return True
示例8: changingObjects
def changingObjects(self):
changingObjects = QList()
for movingObject in self.mMovingObjects:
changingObjects.append(movingObject.item.mapObject())
return changingObjects
示例9: objectGroups
def objectGroups(self):
layers = QList()
for layer in self.mLayers:
og = layer.asObjectGroup()
if og:
layers.append(og)
return layers
示例10: selectionChanged
def selectionChanged(self, selected, deselected):
super().selectionChanged(selected, deselected)
if (not self.mMapDocument or self.mSynching):
return
selectedRows = self.selectionModel().selectedRows()
currentLayerIndex = -1
selectedObjects = QList()
for index in selectedRows:
og = self.model().toLayer(index)
if og:
i = self.mMapDocument.map().layers().indexOf(og)
if (currentLayerIndex == -1):
currentLayerIndex = i
elif (currentLayerIndex != i):
currentLayerIndex = -2
o = self.model().toMapObject(index)
if o:
selectedObjects.append(o)
# Switch the current object layer if only one object layer (and/or its objects)
# are included in the current selection.
if (currentLayerIndex >= 0 and currentLayerIndex != self.mMapDocument.currentLayerIndex()):
self.mMapDocument.setCurrentLayerIndex(currentLayerIndex)
if (selectedObjects != self.mMapDocument.selectedObjects()):
self.mSynching = True
if (selectedObjects.count() == 1):
o = selectedObjects.first()
center = o.bounds().center()
DocumentManager.instance().centerViewOn(center)
self.mMapDocument.setSelectedObjects(selectedObjects)
self.mSynching = False
示例11: commit
def commit(self):
# Save saveBeforeExecute option
self.mSettings.setValue("saveBeforeExecute", self.mSaveBeforeExecute)
# Save command list
commands = QList()
for command in self.mCommands:
commands.append(command.toQVariant())
self.mSettings.setValue("commandList", commands)
示例12: __init__
def __init__(self):
self.q_ptr = None
self.m_indexToItem = QMap()
self.m_itemToIndex = QMap()
self.m_widgetToItem = QMap()
self.m_mainLayout = 0
self.m_children = QList()
self.m_recreateQueue = QList()
示例13: removeObject
def removeObject(self, og, o):
objects = QList()
objects.append(o)
row = og.objects().indexOf(o)
self.beginRemoveRows(self.index(og), row, row)
og.removeObjectAt(row)
self.mObjects.remove(o)
self.endRemoveRows()
self.objectsRemoved.emit(objects)
return row
示例14: layers
def layers(self, *args):
l = len(args)
if l==0:
return QList(self.mLayers)
elif l==1:
tp = args[0]
layers = QList()
for layer in self.mLayers:
if (layer.layerType() == tp):
layers.append(layer)
return layers
示例15: __init__
def __init__(self, map, fileName = QString()):
super().__init__()
##
# The filename of a plugin is unique. So it can be used to determine
# the right plugin to be used for saving or reloading the map.
# The nameFilter of a plugin can not be used, since it's translatable.
# The filename of a plugin must not change while maps are open using this
# plugin.
##
self.mReaderFormat = None
self.mWriterFormat = None
self.mExportFormat = None
self.mSelectedArea = QRegion()
self.mSelectedObjects = QList()
self.mSelectedTiles = QList()
self.mCurrentLayerIndex = 0
self.mLastSaved = QDateTime()
self.mLastExportFileName = ''
self.mFileName = fileName
self.mMap = map
self.mLayerModel = LayerModel(self)
self.mCurrentObject = map ## Current properties object. ##
self.mRenderer = None
self.mMapObjectModel = MapObjectModel(self)
self.mTerrainModel = TerrainModel(self, self)
self.mUndoStack = QUndoStack(self)
self.createRenderer()
if (map.layerCount() == 0):
_x = -1
else:
_x = 0
self.mCurrentLayerIndex = _x
self.mLayerModel.setMapDocument(self)
# Forward signals emitted from the layer model
self.mLayerModel.layerAdded.connect(self.onLayerAdded)
self.mLayerModel.layerAboutToBeRemoved.connect(self.onLayerAboutToBeRemoved)
self.mLayerModel.layerRemoved.connect(self.onLayerRemoved)
self.mLayerModel.layerChanged.connect(self.layerChanged)
# Forward signals emitted from the map object model
self.mMapObjectModel.setMapDocument(self)
self.mMapObjectModel.objectsAdded.connect(self.objectsAdded)
self.mMapObjectModel.objectsChanged.connect(self.objectsChanged)
self.mMapObjectModel.objectsRemoved.connect(self.onObjectsRemoved)
self.mMapObjectModel.rowsInserted.connect(self.onMapObjectModelRowsInserted)
self.mMapObjectModel.rowsRemoved.connect(self.onMapObjectModelRowsInsertedOrRemoved)
self.mMapObjectModel.rowsMoved.connect(self.onObjectsMoved)
self.mTerrainModel.terrainRemoved.connect(self.onTerrainRemoved)
self.mUndoStack.cleanChanged.connect(self.modifiedChanged)
# Register tileset references
tilesetManager = TilesetManager.instance()
tilesetManager.addReferences(self.mMap.tilesets())