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


Python QtGui.QItemDelegate类代码示例

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


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

示例1: setModelData

 def setModelData(self, editor, model, index):
     """ save data from editor back to model """
     if index.column() == self.column:
         model.setData(index, editor.currentText())
     else:
         # use default
         QItemDelegate.setModelData(self, editor, model, index)
开发者ID:alexdsz,项目名称:DsgTools,代码行数:7,代码来源:manageComplex.py

示例2: __init__

 def __init__(self, parent, itemsDict, column):
     """
     Constructor
     """
     QItemDelegate.__init__(self, parent)
     self.itemsDict = itemsDict
     self.column = column
开发者ID:lcoandrade,项目名称:DsgTools,代码行数:7,代码来源:manageComplex.py

示例3: __init__

 def __init__(self, min, max, *args):
     """
     min and max are the limits that the spin box can scroll to/accept.
     """
     QItemDelegate.__init__(self, *args)
     self.min = min
     self.max = max
开发者ID:bbreslauer,项目名称:PySciPlot,代码行数:7,代码来源:Delegates.py

示例4: setModelData

 def setModelData(self,editor,model,index):
     """Save value changes"""
     if index.column() == 1:
         value, ok = editor.itemData(editor.currentIndex()).toInt()
         model.setData(index,QVariant(value),Qt.EditRole)
     else:
         QItemDelegate.setModelData(self,editor,model,index)
开发者ID:toyg,项目名称:plasmaapplets,代码行数:7,代码来源:main.py

示例5: updateEditorGeometry

 def updateEditorGeometry(self, editor, option, index):
     ''' PyQt API Method -- See the PyQt documentation for a description '''
     if type(editor) == QComboBox:
         editor.setGeometry(option.rect)
         editor.showPopup()
     else:
         QItemDelegate.updateEditorGeometry(self, editor, option, index)
开发者ID:janowicz,项目名称:urbansim_drcog,代码行数:7,代码来源:xml_item_delegate.py

示例6: __init__

    def __init__(self, columns=(), parent=None):
        """ Construtor.

        @param columns sequence of column numbers for LCD widgets
        @param parent ancestor object
        """
        QItemDelegate.__init__(self, parent)
        self.columns = columns
开发者ID:InfiniteAlpha,项目名称:profitpy,代码行数:8,代码来源:accountsummary.py

示例7: __init__

 def __init__(self, distObjects, parent=None):
     """Init TracepointModel
     """
     QAbstractTableModel.__init__(self, parent)
     QItemDelegate.__init__(self, parent)
     self.tracepoints = []
     self.distObjects = distObjects
     self.connector = distObjects.gdb_connector
开发者ID:gledr,项目名称:ricodebug,代码行数:8,代码来源:tracepointmodel.py

示例8: __init__

    def __init__(self, parent_view):
        """
        @param parent_view (QAbstractItemView): parent view for this item editor
        """
        QItemDelegate.__init__(self, parent_view)
        self.parent_view = parent_view

        # List of database connection names. Used for populating the editor for a db_connection_hook
        self.known_db_connection_names = []
开发者ID:christianurich,项目名称:VIBe2UrbanSim,代码行数:9,代码来源:xml_item_delegate.py

示例9: setEditorData

 def setEditorData(self, editor, index):
     text = from_qvariant(index.model().data(index, Qt.DisplayRole), str)
     if index.column() in (MOD1, MOD2, MOD3, KEY):
         i = editor.findText(text)
         if i == -1:
             i = 0
         editor.setCurrentIndex(i)
     else:
         QItemDelegate.setEditorData(self, editor, index)
开发者ID:koll00,项目名称:Gui_SM,代码行数:9,代码来源:shortcuts.py

示例10: setEditorData

 def setEditorData(self, editor, index):
     """ load data from model to editor """
     m = index.model()
     if index.column() == 1:
         txt = m.data(index, Qt.DisplayRole)
         editor.setEditText(txt)
     else:
         # use default
         QItemDelegate.setEditorData(self, editor, index)
开发者ID:Geoneer,项目名称:QGIS,代码行数:9,代码来源:dlg_create_table.py

示例11: setModelData

 def setModelData(self, editor, model, index):
     """ save data from editor back to model """
     if index.column() == 1:
         model.setData(index, editor.currentText())
     else:
         # use default
         QItemDelegate.setModelData(self, editor, model, index)
         if index.column() == 0:
             self.emit(SIGNAL("columnNameChanged()"))
开发者ID:Geoneer,项目名称:QGIS,代码行数:9,代码来源:dlg_create_table.py

示例12: setEditorData

 def setEditorData(self,editor,index):
     """Set initial data for the editor"""
     if index.column() == 0:
         current = index.model().data(index,Qt.DisplayRole)
         editor.setText(current)
     elif index.column() == 1:
         current = index.model().data(index,Qt.DisplayRole)
         editor.setCurrentIndex(editor.findData(current))
     else:
         QItemDelegate.setEditorData(self,editor,index)
开发者ID:toyg,项目名称:plasmaapplets,代码行数:10,代码来源:main.py

示例13: paint

 def paint(self, painter, option, index):
 
     if index.column() != 0:
         QItemDelegate.paint(self, painter, option, index)
         return
     
     painter.fillRect(option.rect, option.palette.brush(QPalette.Base))
     painter.setPen(QPen(option.palette.color(QPalette.Text)))
     painter.drawText(option.rect.adjusted(4, 4, -4, -4),
         Qt.TextShowMnemonic | Qt.AlignLeft | Qt.AlignVCenter,
         index.data().toString())
开发者ID:RaphaelRochet,项目名称:puddletag,代码行数:11,代码来源:shortcutsettings.py

示例14: paint

 def paint(self, painter, option, index):
     option.palette.setColor(
         QPalette.Highlight,QColor(
             index.data(Qt.BackgroundRole)).darker(107))
     option.palette.setColor(
         QPalette.HighlightedText,QColor(
             index.data(Qt.ForegroundRole)).darker(115))
     QItemDelegate.paint(self, painter, option, index)
     if option.showDecorationSelected and \
             (option.state & QStyle.State_Selected):
         painter.drawRect(option.rect)
开发者ID:Araneidae,项目名称:iocbuilder,代码行数:11,代码来源:delegates.py

示例15: __init__

    def __init__(self, parent=None, editable=True, **kwargs):
        """:param parent: the parent object for the delegate
        :param editable: a boolean indicating if the field associated to the delegate
        is editable

        """
        QItemDelegate.__init__(self, parent)
        self.editable = editable
        self.kwargs = kwargs
        self._font_metrics = QtGui.QFontMetrics(QtGui.QApplication.font())
        self._height = self._font_metrics.lineSpacing() + 10
        self._width = self._font_metrics.averageCharWidth() * 20
开发者ID:kurtraschke,项目名称:camelot,代码行数:12,代码来源:customdelegate.py


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