本文整理匯總了Python中pyqtcore.QMap.constBegin方法的典型用法代碼示例。如果您正苦於以下問題:Python QMap.constBegin方法的具體用法?Python QMap.constBegin怎麽用?Python QMap.constBegin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pyqtcore.QMap
的用法示例。
在下文中一共展示了QMap.constBegin方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: VariantEditorFactory
# 需要導入模塊: from pyqtcore import QMap [as 別名]
# 或者: from pyqtcore.QMap import constBegin [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