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


Python QStyledItemDelegate.setModelData方法代码示例

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


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

示例1: redo

# 需要导入模块: from PyQt5.QtWidgets import QStyledItemDelegate [as 别名]
# 或者: from PyQt5.QtWidgets.QStyledItemDelegate import setModelData [as 别名]
 def redo(self):
     if self.first_time == True:
         QStyledItemDelegate.setModelData(self.parent, self.editor, self.model,
                                          self.index)  # this is very important this is the one that changes the text
         self.redo_value = self.index.model().data(self.index, Qt.DisplayRole)
         self.first_time = False
     elif self.first_time == False:
         self.model.setData(self.index, self.redo_value)
     self.model.dataChanged.emit(self.index, self.index)
开发者ID:hovo1990,项目名称:GROM,代码行数:11,代码来源:undoCommands.py

示例2: setModelData

# 需要导入模块: from PyQt5.QtWidgets import QStyledItemDelegate [as 别名]
# 或者: from PyQt5.QtWidgets.QStyledItemDelegate import setModelData [as 别名]
        def setModelData(self, editor, model, idx):
            name = idx.sibling(idx.row(), 0).data()
            if self.editors[name][0] == self.TEXT_DELEGATE:
                QStyledItemDelegate.setModelData(self, editor, model, idx)
            else:
                value = editor.currentText()
                values = self.editors[name][1]
                if value not in values:
                    values.append(value)

                QStyledItemDelegate.setModelData(self, editor, model, idx)
开发者ID:harryzhurov,项目名称:kicad-tools,代码行数:13,代码来源:inspector.py

示例3: setModelData

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

示例4: setModelData

# 需要导入模块: from PyQt5.QtWidgets import QStyledItemDelegate [as 别名]
# 或者: from PyQt5.QtWidgets.QStyledItemDelegate import setModelData [as 别名]
 def setModelData(self, editor, model, index):
     if index.column() in DATE_TIME_COLUMN_LIST:
         editor.interpretText()
         str_value = editor.text()
         model.setData(index, str_value, Qt.EditRole)
     else:
         return QStyledItemDelegate.setModelData(self, editor, model, index)
开发者ID:jeremiedecock,项目名称:snippets,代码行数:9,代码来源:app_skeleton_logger.py

示例5: setModelData

# 需要导入模块: from PyQt5.QtWidgets import QStyledItemDelegate [as 别名]
# 或者: from PyQt5.QtWidgets.QStyledItemDelegate import setModelData [as 别名]
 def setModelData(self, editor, model, idx):
     """
     Called when editor has finished editing data
     Here we call the default implementation and save our values
     """
     QStyledItemDelegate.setModelData(self, editor, model, idx)
     root = model.item(0, 0)
     uries = []
     count = 0
     while True:
         child = root.child(count, 2)
         count += 1
         if not child:
             break
         uries.append(child.text())
     logger.info("Writting namespace array: %s", uries)
     self.widget.node.set_value(uries)
开发者ID:FreeOpcUa,项目名称:opcua-modeler,代码行数:19,代码来源:namespace_widget.py

示例6: setModelData

# 需要导入模块: from PyQt5.QtWidgets import QStyledItemDelegate [as 别名]
# 或者: from PyQt5.QtWidgets.QStyledItemDelegate import setModelData [as 别名]
 def setModelData(self, editor, model, index):
     # This call below is to give a chance to the editor to tweak its content a little bit before
     # we send it to the model.
     if hasattr(editor, 'prepareDataForCommit'):
         editor.prepareDataForCommit()
     QStyledItemDelegate.setModelData(self, editor, model, index)
开发者ID:patrickatamaniuk,项目名称:moneyguru,代码行数:8,代码来源:item_delegate.py

示例7: setModelData

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

示例8: setModelData

# 需要导入模块: from PyQt5.QtWidgets import QStyledItemDelegate [as 别名]
# 或者: from PyQt5.QtWidgets.QStyledItemDelegate import setModelData [as 别名]
 def setModelData(self, editor, model, idx):
     
     value    = editor.currentText() if editor.metaObject().className() == 'TComboBox' else editor.text()
     prev_val = idx.sibling(idx.row(), 0).data()
     self.edit_finished.emit( [idx, prev_val, value ] )
     QStyledItemDelegate.setModelData(self, editor, model, idx)
开发者ID:harryzhurov,项目名称:kicad-tools,代码行数:8,代码来源:selector.py


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