当前位置: 首页>>代码示例>>Python>>正文


Python QList.append方法代码示例

本文整理汇总了Python中pyqtcore.QList.append方法的典型用法代码示例。如果您正苦于以下问题:Python QList.append方法的具体用法?Python QList.append怎么用?Python QList.append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyqtcore.QList的用法示例。


在下文中一共展示了QList.append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: tileLayers

# 需要导入模块: from pyqtcore import QList [as 别名]
# 或者: from pyqtcore.QList import append [as 别名]
 def tileLayers(self):
     layers = QList()
     for layer in self.mLayers:
         tl = layer.asTileLayer()
         if tl:
             layers.append(tl)
     return layers
开发者ID:theall,项目名称:Python-Tiled,代码行数:9,代码来源:map.py

示例2: selectionChanged

# 需要导入模块: from pyqtcore import QList [as 别名]
# 或者: from pyqtcore.QList import append [as 别名]
    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
开发者ID:theall,项目名称:Python-Tiled,代码行数:36,代码来源:objectsdock.py

示例3: init

# 需要导入模块: from pyqtcore import QList [as 别名]
# 或者: from pyqtcore.QList import append [as 别名]
    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)
开发者ID:theall,项目名称:QtPropertyBrowserV2.6-for-pyqt5,代码行数:29,代码来源:qttreepropertybrowser.py

示例4: setSelectedObjectItems

# 需要导入模块: from pyqtcore import QList [as 别名]
# 或者: from pyqtcore.QList import append [as 别名]
 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)
开发者ID:theall,项目名称:Python-Tiled,代码行数:9,代码来源:mapscene.py

示例5: objectGroups

# 需要导入模块: from pyqtcore import QList [as 别名]
# 或者: from pyqtcore.QList import append [as 别名]
 def objectGroups(self):
     layers = QList()
     for layer in self.mLayers:
         og = layer.asObjectGroup()
         if og:
             layers.append(og)
     return layers
开发者ID:theall,项目名称:Python-Tiled,代码行数:9,代码来源:map.py

示例6: interfaces

# 需要导入模块: from pyqtcore import QList [as 别名]
# 或者: from pyqtcore.QList import append [as 别名]
 def interfaces(self):
     results = QList()
     for plugin in self.mPlugins:
         result = plugin.instance
         if result:
             results.append(result)
     return results
开发者ID:theall,项目名称:Python-Tiled,代码行数:9,代码来源:pluginmanager.py

示例7: FormatHelper

# 需要导入模块: from pyqtcore import QList [as 别名]
# 或者: from pyqtcore.QList import append [as 别名]
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)
开发者ID:theall,项目名称:Python-Tiled,代码行数:27,代码来源:mapformat.py

示例8: changingObjects

# 需要导入模块: from pyqtcore import QList [as 别名]
# 或者: from pyqtcore.QList import append [as 别名]
    def changingObjects(self):
        changingObjects = QList()
        
        for movingObject in self.mMovingObjects:
            changingObjects.append(movingObject.item.mapObject())

        return changingObjects
开发者ID:theall,项目名称:Python-Tiled,代码行数:9,代码来源:objectselectiontool.py

示例9: objects

# 需要导入模块: from pyqtcore import QList [as 别名]
# 或者: from pyqtcore.QList import append [as 别名]
 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
开发者ID:theall,项目名称:Python-Tiled,代码行数:9,代码来源:pluginmanager.py

示例10: commit

# 需要导入模块: from pyqtcore import QList [as 别名]
# 或者: from pyqtcore.QList import append [as 别名]
 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)
开发者ID:theall,项目名称:Python-Tiled,代码行数:10,代码来源:commanddatamodel.py

示例11: removeObject

# 需要导入模块: from pyqtcore import QList [as 别名]
# 或者: from pyqtcore.QList import append [as 别名]
 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
开发者ID:theall,项目名称:Python-Tiled,代码行数:12,代码来源:mapobjectmodel.py

示例12: layers

# 需要导入模块: from pyqtcore import QList [as 别名]
# 或者: from pyqtcore.QList import append [as 别名]
 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
开发者ID:theall,项目名称:Python-Tiled,代码行数:13,代码来源:map.py

示例13: intToEnum

# 需要导入模块: from pyqtcore import QList [as 别名]
# 或者: from pyqtcore.QList import append [as 别名]
    def intToEnum(self, metaEnum, intValue):
        valueMap = QMap() # dont show multiple enum values which have the same values
        values = QList()
        for i in range(metaEnum.keyCount()):
            value = metaEnum.value(i)
            if (not valueMap.contains(value)):
                valueMap[value] = True
                values.append(value)

        if (intValue >= values.count()):
            return -1
        return values.at(intValue)
开发者ID:theall,项目名称:QtPropertyBrowserV2.6-for-pyqt5,代码行数:14,代码来源:objectcontroller.py

示例14: copyObjectRegion

# 需要导入模块: from pyqtcore import QList [as 别名]
# 或者: from pyqtcore.QList import append [as 别名]
 def copyObjectRegion(self, srcLayer, srcX, srcY, width, height, dstLayer, dstX, dstY):
     undo = self.mMapDocument.undoStack()
     rect = QRectF(srcX, srcY, width, height)
     pixelRect = self.mMapDocument.renderer().tileToPixelCoords_(rect)
     objects = objectsInRegion(srcLayer, pixelRect.toAlignedRect())
     pixelOffset = self.mMapDocument.renderer().tileToPixelCoords(dstX, dstY)
     pixelOffset -= pixelRect.topLeft()
     clones = QList()
     for obj in objects:
         clone = obj.clone()
         clones.append(clone)
         clone.setX(clone.x() + pixelOffset.x())
         clone.setY(clone.y() + pixelOffset.y())
         undo.push(AddMapObject(self.mMapDocument, dstLayer, clone))
开发者ID:theall,项目名称:Python-Tiled,代码行数:16,代码来源:automapper.py

示例15: duplicateObjects

# 需要导入模块: from pyqtcore import QList [as 别名]
# 或者: from pyqtcore.QList import append [as 别名]
    def duplicateObjects(self, objects):
        if (objects.isEmpty()):
            return
        self.mUndoStack.beginMacro(self.tr("Duplicate %n Object(s)", "", objects.size()))
        clones = QList()
        for mapObject in objects:
            clone = mapObject.clone()
            clones.append(clone)
            self.mUndoStack.push(AddMapObject(self,
                                              mapObject.objectGroup(),
                                              clone))

        self.mUndoStack.endMacro()
        self.setSelectedObjects(clones)
开发者ID:theall,项目名称:Python-Tiled,代码行数:16,代码来源:mapdocument.py


注:本文中的pyqtcore.QList.append方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。