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


Python QStyledItemDelegate.setEditorData方法代码示例

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


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

示例1: setEditorData

# 需要导入模块: from PyQt5.QtWidgets import QStyledItemDelegate [as 别名]
# 或者: from PyQt5.QtWidgets.QStyledItemDelegate import setEditorData [as 别名]
 def setEditorData(self, editor, index):
     text = index.model().data(index, Qt.DisplayRole)
     if index.column() == residNum:
         if text is None:
             value = 0
         elif isinstance(text, int):
             value = text
         else:
             value = int(re.sub(r"[., ]", "", text))
         editor.setValue(value)
         # elif index.column() == residName:
         # editor.setText(text)
     elif index.column() == atomName:
         editor.setText(text)
     elif index.column() == atomNum:
         if text is None:
             value = 0
         elif isinstance(text, int):
             value = text
         else:
             value = int(re.sub(r"[., ]", "", text))
         editor.setValue(value)
     elif index.column() in (X, Y, Z):
         if text is None:
             value = 0
         elif isinstance(text, int):
             value = text
         else:
             value = float(text)
         editor.setValue(value)
     else:
         QStyledItemDelegate.setEditorData(self, editor, index)
开发者ID:hovo1990,项目名称:GROM,代码行数:34,代码来源:gro_model.py

示例2: setEditorData

# 需要导入模块: from PyQt5.QtWidgets import QStyledItemDelegate [as 别名]
# 或者: from PyQt5.QtWidgets.QStyledItemDelegate import setEditorData [as 别名]
 def setEditorData(self, editor, index):
     text = index.model().data(index, Qt.DisplayRole)
     if index.column() == name:
         editor.setText(text)
         # elif index.column() == resName:
         # editor.setItemText(text)
     elif index.column() == ChainID:
         editor.setText(text)
     elif index.column() == resNum:
         if text is None:
             value = 0
         elif isinstance(text, int):
             value = text
         else:
             value = int(re.sub(r"[., ]", "", text))
         editor.setValue(value)
     elif index.column() in (serial, X, Y, Z, occupancy, charge):
         if text is None:
             value = 0
         elif isinstance(text, int):
             value = text
         else:
             try:
                 value = float(text)
             except:
                 value = 0
         editor.setValue(value)
     elif index.column() == element:
         editor.setText(text)
     else:
         QStyledItemDelegate.setEditorData(self, editor, index)
开发者ID:hovo1990,项目名称:GROM,代码行数:33,代码来源:pdb_model_0_88.py

示例3: setEditorData

# 需要导入模块: from PyQt5.QtWidgets import QStyledItemDelegate [as 别名]
# 或者: from PyQt5.QtWidgets.QStyledItemDelegate import setEditorData [as 别名]
 def setEditorData(self, editor, idx):
     #print(editor.metaObject().className() )
     name = idx.sibling(idx.row(), 0).data()
     if self.editors[name][0] == self.TEXT_DELEGATE:
         QStyledItemDelegate.setEditorData(self, editor, idx)
     else:
         value = idx.model().data(idx, Qt.EditRole)
         editor.set_index(value)
开发者ID:harryzhurov,项目名称:kicad-tools,代码行数:10,代码来源:inspector.py

示例4: setEditorData

# 需要导入模块: from PyQt5.QtWidgets import QStyledItemDelegate [as 别名]
# 或者: from PyQt5.QtWidgets.QStyledItemDelegate import setEditorData [as 别名]
 def setEditorData(self, editor: QWidget, model_index: QModelIndex):
     column = model_index.column()
     if column == NAME_COL:  # Part Name
         text_QString = model_index.model().data(model_index, Qt.EditRole)
         editor.setText(text_QString)
     # elif column == VISIBLE_COL: # Visibility
     #     value = model_index.model().data(model_index, Qt.EditRole)
     #     editor.setChecked(value)
     elif column == COLOR_COL:  # Color
         value = model_index.model().data(model_index, Qt.EditRole)
         editor.setCurrentColor(QColor(value))
     else:
         QStyledItemDelegate.setEditorData(self, editor, model_index)
开发者ID:cadnano,项目名称:cadnano2.5,代码行数:15,代码来源:outlinertreewidget.py

示例5: setEditorData

# 需要导入模块: from PyQt5.QtWidgets import QStyledItemDelegate [as 别名]
# 或者: from PyQt5.QtWidgets.QStyledItemDelegate import setEditorData [as 别名]
 def setEditorData(self, editor, index):
     layer = index.data()
     if isinstance(layer, Layer):
         editor.layer = layer
     else:
         QStyledItemDelegate.setEditorData(self, editor, index)
开发者ID:ilastik,项目名称:volumina,代码行数:8,代码来源:layerwidget.py

示例6: setEditorData

# 需要导入模块: from PyQt5.QtWidgets import QStyledItemDelegate [as 别名]
# 或者: from PyQt5.QtWidgets.QStyledItemDelegate import setEditorData [as 别名]
 def setEditorData(self, editor, index):
     if index.column() in DATE_TIME_COLUMN_LIST:
         value = index.model().data(index, Qt.EditRole)
         editor.setDateTime(value)     # value cannot be a string, it have to be a datetime...
     else:
         return QStyledItemDelegate.setEditorData(self, editor, index)
开发者ID:jeremiedecock,项目名称:snippets,代码行数:8,代码来源:app_skeleton_logger.py


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