• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python pyqtcore.QList类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: tileLayers

 def tileLayers(self):
     layers = QList()
     for layer in self.mLayers:
         tl = layer.asTileLayer()
         if tl:
             layers.append(tl)
     return layers
开发者ID:theall,项目名称:Python-Tiled,代码行数:7,代码来源:map.py


示例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)
开发者ID:theall,项目名称:QtPropertyBrowserV2.6-for-pyqt5,代码行数:27,代码来源:qttreepropertybrowser.py


示例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)
开发者ID:theall,项目名称:Python-Tiled,代码行数:7,代码来源:mapscene.py


示例4: interfaces

 def interfaces(self):
     results = QList()
     for plugin in self.mPlugins:
         result = plugin.instance
         if result:
             results.append(result)
     return results
开发者ID:theall,项目名称:Python-Tiled,代码行数:7,代码来源:pluginmanager.py


示例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)
开发者ID:theall,项目名称:Python-Tiled,代码行数:25,代码来源:mapformat.py


示例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
开发者ID:theall,项目名称:Python-Tiled,代码行数:7,代码来源:pluginmanager.py


示例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
开发者ID:theall,项目名称:Python-Tiled,代码行数:29,代码来源:automapper.py


示例8: changingObjects

    def changingObjects(self):
        changingObjects = QList()
        
        for movingObject in self.mMovingObjects:
            changingObjects.append(movingObject.item.mapObject())

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


示例9: objectGroups

 def objectGroups(self):
     layers = QList()
     for layer in self.mLayers:
         og = layer.asObjectGroup()
         if og:
             layers.append(og)
     return layers
开发者ID:theall,项目名称:Python-Tiled,代码行数:7,代码来源:map.py


示例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
开发者ID:theall,项目名称:Python-Tiled,代码行数:34,代码来源:objectsdock.py


示例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)
开发者ID:theall,项目名称:Python-Tiled,代码行数:8,代码来源:commanddatamodel.py


示例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()
开发者ID:theall,项目名称:Python-Tiled,代码行数:8,代码来源:qtgroupboxpropertybrowser.py


示例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
开发者ID:theall,项目名称:Python-Tiled,代码行数:10,代码来源:mapobjectmodel.py


示例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
开发者ID:theall,项目名称:Python-Tiled,代码行数:11,代码来源:map.py


示例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())
开发者ID:theall,项目名称:Python-Tiled,代码行数:53,代码来源:mapdocument.py


示例16: intToEnum

    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,代码行数:12,代码来源:objectcontroller.py


示例17: duplicateObjects

    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,代码行数:14,代码来源:mapdocument.py


示例18: copyObjectRegion

 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,代码行数:14,代码来源:automapper.py


示例19: __init__

    def __init__(self, parent=None):
        super(MyController, self).__init__(parent)

        self.theClassNames = QList()
        self.theClassCombo = QComboBox(self)
        self.theControlledObject = None

        button = QToolButton(self)
        self.theController = ObjectController(self)
        buttonBox = QDialogButtonBox(self)

        button.clicked.connect(self.createAndControl)
        buttonBox.rejected.connect(self.reject)

        button.setText(self.tr("Create And Control"))
        buttonBox.setStandardButtons(QDialogButtonBox.Close)

        layout = QVBoxLayout(self)
        internalLayout = QHBoxLayout()
        internalLayout.addWidget(self.theClassCombo)
        internalLayout.addWidget(button)
        layout.addLayout(internalLayout)
        layout.addWidget(self.theController)
        layout.addWidget(buttonBox)

        self.theClassNames.append("QWidget")
        self.theClassNames.append("QPushButton")
        self.theClassNames.append("QDialogButtonBox")
        self.theClassNames.append("QTreeWidget")
        self.theClassNames.append("QCalendarWidget")
        self.theClassNames.append("QAction")
        self.theClassNames.append("QTimeLine")
        self.theClassNames.append("QTextDocument")

        self.theClassCombo.addItems(self.theClassNames)
开发者ID:theall,项目名称:QtPropertyBrowserV2.6-for-pyqt5,代码行数:35,代码来源:objectcontroller.py


示例20: __init__

    def __init__(self, parent):
        super().__init__(parent)
        
        self.mSettings = QSettings()
        self.mSaveBeforeExecute = False
        self.mCommands = QList()
        
        # Load saveBeforeExecute option
        s = self.mSettings.value("saveBeforeExecute", True)
        self.mSaveBeforeExecute = bool(s)
        # Load command list
        variant = self.mSettings.value("commandList")
        commands = variant
        if commands is None:
            commands = []
        for commandVariant in commands:
            self.mCommands.append(Command.fromQVariant(commandVariant))
        # Add default commands the first time the app has booted up.
        # This is useful on it's own and helps demonstrate how to use the commands.
        addPrefStr = "addedDefaultCommands"
        addedCommands = self.mSettings.value(addPrefStr, False)
        if (not addedCommands):
            # Disable default commands by default so user gets an informative
            # warning when clicking the command button for the first time
            command = Command(False)
            if sys.platform == 'linux':
                command.command = "gedit %mapfile"
            elif sys.platform == 'darwin':
                command.command = "open -t %mapfile"
            if (not command.command.isEmpty()):
                command.name = self.tr("Open in text editor")
                self.mCommands.push_back(command)

            self.commit()
            self.mSettings.setValue(addPrefStr, True)
开发者ID:theall,项目名称:Python-Tiled,代码行数:35,代码来源:commanddatamodel.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python pyqtcore.QMap类代码示例发布时间:2022-05-27
下一篇:
Python pyqrcode.create函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap