本文整理汇总了Python中pyqtcore.QMap.constEnd方法的典型用法代码示例。如果您正苦于以下问题:Python QMap.constEnd方法的具体用法?Python QMap.constEnd怎么用?Python QMap.constEnd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyqtcore.QMap
的用法示例。
在下文中一共展示了QMap.constEnd方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: VariantEditorFactory
# 需要导入模块: from pyqtcore import QMap [as 别名]
# 或者: from pyqtcore.QMap import constEnd [as 别名]
class VariantEditorFactory(QtVariantEditorFactory):
def __init__(self, parent = None):
super().__init__(parent)
self.mCreatedEditors = QMapList()
self.mEditorToProperty = QMap()
def __del__(self):
self.mEditorToProperty.clear()
def connectPropertyManager(self, manager):
manager.valueChangedSignal.connect(self.slotPropertyChanged)
manager.attributeChangedSignal.connect(self.slotPropertyAttributeChanged)
super().connectPropertyManager(manager)
def createEditor(self, manager, property, parent):
type = manager.propertyType(property)
if (type == VariantPropertyManager.filePathTypeId()):
editor = FileEdit(parent)
editor.setFilePath(manager.value(property))
editor.setFilter(manager.attributeValue(property, "filter"))
self.mCreatedEditors[property].append(editor)
self.mEditorToProperty[editor] = property
editor.filePathChanged.connect(self.slotSetValue)
editor.destroyed.connect(self.slotEditorDestroyed)
return editor
editor = super().createEditor(manager, property, parent)
if (type == QVariant.String):
# Add support for "suggestions" attribute that adds a QCompleter to the QLineEdit
suggestions = manager.attributeValue(property, "suggestions")
if suggestions and len(suggestions)>0:
lineEdit = editor
if lineEdit:
completer = QCompleter(suggestions, lineEdit)
completer.setCaseSensitivity(Qt.CaseInsensitive)
lineEdit.setCompleter(completer)
return editor
def disconnectPropertyManager(self, manager):
manager.valueChangedSignal.disconnect(self.slotPropertyChanged)
manager.attributeChangedSignal.disconnect(self.slotPropertyAttributeChanged)
super().disconnectPropertyManager(manager)
def slotPropertyChanged(self, property, value):
if (not self.mCreatedEditors.contains(property)):
return
editors = self.mCreatedEditors[property]
for itEditor in editors:
itEditor.setFilePath(value.toString())
def slotPropertyAttributeChanged(self, property, attribute, value):
if (not self.mCreatedEditors.contains(property)):
return
if (attribute != "filter"):
return
editors = self.mCreatedEditors[property]
for itEditor in editors:
itEditor.setFilter(value.toString())
def slotSetValue(self, value):
object = self.sender()
itEditor = self.mEditorToProperty.constBegin()
while (itEditor != self.mEditorToProperty.constEnd()):
if (itEditor.key() == object):
property = itEditor.value()
manager = self.propertyManager(property)
if (not manager):
return
manager.setValue(property, value)
return
itEditor += 1
def slotEditorDestroyed(self, object):
for itEditor in self.mEditorToProperty:
if (itEditor.key() == object):
editor = itEditor.key()
property = itEditor.value()
self.mEditorToProperty.remove(editor)
self.mCreatedEditors[property].removeAll(editor)
if (self.mCreatedEditors[property].isEmpty()):
self.mCreatedEditors.remove(property)
return