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


Python Qt.DisplayRole方法代码示例

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


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

示例1: __init__

# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import DisplayRole [as 别名]
def __init__(self, param, parent, editable):
        """ A parameter. If editable, the user can edit it. This does not change the value, but
            sends a request to the flie to update the value. The flie returns the new value which
            is then updated in this row
        """
        super(ParamItem, self).__init__(parent, type=1003)

        # Our param data
        self.param = param
        if editable:
            self.setFlags(self.flags() | Qt.ItemIsEditable)

        # Initial Populate
        QtGui.QTreeWidgetItem.setData(self, 0, Qt.DisplayRole, QVariant(param.name))
        QtGui.QTreeWidgetItem.setData(self, 1, Qt.DisplayRole, QVariant(param.ctype))
        QtGui.QTreeWidgetItem.setData(self, 2, Qt.DisplayRole, "Updating...")

        # Flie Updates
        self.cf = self.treeWidget().cf
        self.cf.param.add_update_callback(group=param.group, name=param.name, cb=self.updateValueCB) 
开发者ID:omwdunkley,项目名称:crazyflieROS,代码行数:22,代码来源:paramManager.py

示例2: setModelData

# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import DisplayRole [as 别名]
def setModelData(self, editor, model, index):
        """
        Gets data from the editor widget and stores
        it in the specified model at the item index.
        :param editor: combobox
        :type editor: QComboBox
        :param model: QModel
        :type model: QModel
        :param index: The index of the data
        to be inserted.
        :type index: QModelIndex
        """
        if self.options['type'] == 'combobox':
            value = editor.currentIndex()
            data = editor.itemData(editor.currentIndex())

            separator_item = QStandardItem(value)
            model.setItem(index.row(), index.column(), separator_item)
            separator_item.setData(data)
            model.setData(
                index,
                editor.itemData(value, Qt.DisplayRole)
            ) 
开发者ID:gltn,项目名称:stdm,代码行数:25,代码来源:generic_delegate.py

示例3: headerData

# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import DisplayRole [as 别名]
def headerData(self, section, orientation, role=Qt.DisplayRole):
        if role != Qt.DisplayRole:
            return QVariant()

        if orientation == Qt.Horizontal:
            try:
                return self.df.columns.tolist()[section]
            except (IndexError, ):
                return QVariant()
        elif orientation == Qt.Vertical:
            try:
                # return self.df.index.tolist()
                return self.df.index.tolist()[section]
            except (IndexError, ):
                return QVariant() 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:17,代码来源:qtpandas.py

示例4: data

# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import DisplayRole [as 别名]
def data(self, index, role=Qt.DisplayRole):
        if role != Qt.DisplayRole:
            return QVariant()

        if not index.isValid():
            return QVariant()

        return QVariant(str(self.df.ix[index.row(), index.column()])) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:10,代码来源:qtpandas.py

示例5: data

# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import DisplayRole [as 别名]
def data(self, modelIndex, role=None):
        if not modelIndex.isValid():
            return None

        row = modelIndex.row()
        col = modelIndex.column()

        if role == Qt.DisplayRole:
            if col in [PlayerModel.PLAYER, PlayerModel.PING, PlayerModel.OPPONENT]:
                return self.players[row][col]
        elif role == Qt.ToolTipRole and col in [PlayerModel.PLAYER, PlayerModel.OPPONENT]:
            name = self.players[row][col]
            if name in self.controller.players:
                if self.controller.players[name].city:
                    return self.controller.players[name].country + ', ' + self.controller.players[name].city
                else:
                    return self.controller.players[name].country
        elif role == Qt.CheckStateRole and col == PlayerModel.IGNORE:
            return self.players[row][col]
        elif role == Qt.DecorationRole:
            return self.dataIcon(row, col)
        elif role == Qt.TextAlignmentRole:
            if col == PlayerModel.PING:
                return Qt.AlignRight | Qt.AlignVCenter
        elif role == Qt.TextColorRole:
            if col in [PlayerModel.PLAYER, PlayerModel.OPPONENT]:
                name = self.players[row][col]
                if name == 'ponder':
                    return QtGui.QBrush(QtGui.QColor(Qt.red)) 
开发者ID:doctorguile,项目名称:pyqtggpo,代码行数:31,代码来源:playermodel.py

示例6: headerData

# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import DisplayRole [as 别名]
def headerData(self, section, Qt_Orientation, role=None):
        if role == Qt.DisplayRole and Qt_Orientation == Qt.Horizontal and 0 <= section < PlayerModel.N_DISPLAY_COLS:
            return PlayerModel.displayColumns[section]
        if role == Qt.DecorationRole and Qt_Orientation == Qt.Horizontal:
            if section == PlayerModel.IGNORE:
                return QtGui.QIcon(':/assets/face-ignore.png') 
开发者ID:doctorguile,项目名称:pyqtggpo,代码行数:8,代码来源:playermodel.py

示例7: data

# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import DisplayRole [as 别名]
def data(self, modelIndex, role=None):
        if not modelIndex.isValid():
            return None
        elif role == Qt.DisplayRole:
            r = modelIndex.row()
            c = modelIndex.column()
            return self.filteredGames[r][c] 
开发者ID:doctorguile,项目名称:pyqtggpo,代码行数:9,代码来源:savestatesdialog.py

示例8: headerData

# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import DisplayRole [as 别名]
def headerData(self, section, orientation, role=None):
        if role == Qt.DisplayRole and orientation == Qt.Horizontal:
            return {0: 'Filename', 1: 'Manufacturer', 2: 'Year', 3: 'Description'}[section] 
开发者ID:doctorguile,项目名称:pyqtggpo,代码行数:5,代码来源:savestatesdialog.py

示例9: data

# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import DisplayRole [as 别名]
def data(self, index, role=None):
        if index.isValid() and role in [Qt.DisplayRole, Qt.EditRole]:
            row = index.row()
            col = index.column()
            if col == 0 and 0 <= row < self.rowCount():
                return self._filtered[row] 
开发者ID:doctorguile,项目名称:pyqtggpo,代码行数:8,代码来源:completionlineedit.py

示例10: __init__

# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import DisplayRole [as 别名]
def __init__(self, parent, name, children, hz=50):
        super(LogGroup, self).__init__(parent)
        self.name = name
        self.setFlags(self.flags() | Qt.ItemIsEditable | Qt.ItemIsUserCheckable)

        # Keep track of if all/none of the children are active
        self.cAll = True
        self.cNone = True
        self.validHZ = list(OrderedDict.fromkeys([round(100/floor(100/x),2) for x in range(1,100)]))
        self.hzTarget = hz

        # Monitor the incoming frequency
        self.fm = None
        self.fmOn = True

        # log config
        self.lg = None

        # Show text
        QtGui.QTreeWidgetItem.setData(self, 0, Qt.DisplayRole, QVariant(name))
        QtGui.QTreeWidgetItem.setData(self, 0, Qt.CheckStateRole, Qt.Unchecked)
        QtGui.QTreeWidgetItem.setData(self, 1, Qt.DisplayRole, "Off")
        QtGui.QTreeWidgetItem.setData(self, 3, Qt.DisplayRole, QVariant(0))
        #QtGui.QTreeWidgetItem.setData(self, 4, Qt.CheckStateRole, Qt.Unchecked)
        self.readSettings()

        # Initialise Children
        for c in sorted(children.keys()):
            self.addChild(LogItem(self, children[c]))

        self.c = 0


        # Now everything is initialised except the logging
        # Start logging if active
        if self.checkState(0) == Qt.Checked:
            self.requestLog() 
开发者ID:omwdunkley,项目名称:crazyflieROS,代码行数:39,代码来源:logManager.py

示例11: readSettings

# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import DisplayRole [as 别名]
def readSettings(self):
        """ Read the HZ and selected things to log from previous session """
        settings = QSettings("omwdunkley", "flieROS")

        # Read target HZ
        hzQv = settings.value("log_"+self.name+"_hz",QVariant(20))
        QtGui.QTreeWidgetItem.setData(self, 2, Qt.DisplayRole, hzQv)
        self.hzTarget = self.getValidHZ(hzQv.toFloat()[0])

        # Read if checked. If partially checked, uncheck
        onQv = settings.value("log_"+self.name+"_on", QVariant(Qt.Unchecked))
        QtGui.QTreeWidgetItem.setData(self, 0, Qt.CheckStateRole, onQv if onQv.toInt()[0]!=Qt.PartiallyChecked else Qt.Unchecked)

        #onRos = settings.value("ros_"+self.name+"_on", QVariant(Qt.Unchecked))
        #QtGui.QTreeWidgetItem.setData(self, 0, Qt.CheckStateRole, onRos) 
开发者ID:omwdunkley,项目名称:crazyflieROS,代码行数:17,代码来源:logManager.py

示例12: writeSettings

# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import DisplayRole [as 别名]
def writeSettings(self):
        """ Save the HZ and selected things to log between sessions"""
        settings = QSettings("omwdunkley", "flieROS")

        # Save target HZ
        settings.setValue("log_"+self.name+"_hz", self.data(2, Qt.DisplayRole))

        # Save checked state
        settings.setValue("log_"+self.name+"_on", self.data(0, Qt.CheckStateRole))
        #settings.setValue("ros_"+self.name+"_on", self.data(4, Qt.CheckStateRole))

        # Save children state too

        for x in range(self.childCount()):
            self.child(x).writeSettings() 
开发者ID:omwdunkley,项目名称:crazyflieROS,代码行数:17,代码来源:logManager.py

示例13: updateFM

# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import DisplayRole [as 别名]
def updateFM(self):
        # if not self.isActive()
        if self.fm:
            hz = self.fm.get_hz()
            QtGui.QTreeWidgetItem.setData(self, 3, Qt.DisplayRole, round(hz,2))
            return self.name, hz#, -1.0 if self.lg is None else self.hzTarget
        else:
            return self.name, -1.0#, -1.0 if self.lg is None else self.hzTarget 
开发者ID:omwdunkley,项目名称:crazyflieROS,代码行数:10,代码来源:logManager.py

示例14: logStartedCB

# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import DisplayRole [as 别名]
def logStartedCB(self, on):
        """ Called when we actually start logging """
        self.c+=1
        #print "counter[%s]"%self.name, self.c
        #if self.c % 2 == 1:
         #   return


        if on:
            rospy.loginfo( "[%d: %s @ %.2fhz] LogCB STARTED" % (self.lg.id, self.name, self.hzTarget))
            QtGui.QTreeWidgetItem.setData(self, 0, Qt.CheckStateRole, Qt.Checked)
            QtGui.QTreeWidgetItem.setData(self, 1, Qt.DisplayRole, "On")
            self.setAllState(Qt.Checked, activeOnly=True)
        else:
            rospy.loginfo( "[%s] LogCB STOPPED" % ( self.name))
            #print "[%s]LogCB ENDED(%d) " % (self.name, self.c)
            #if self.allSelected():
            #    self.setAllState(Qt.Unchecked)
            ##else:
            ##    self.setAllState(Qt.Checked, activeOnly=True)
            #QtGui.QTreeWidgetItem.setData(self, 0, Qt.CheckStateRole, Qt.Unchecked)
            #QtGui.QTreeWidgetItem.setData(self, 1, Qt.DisplayRole, "Off")

    # def logAddedCB(self, l):
    #     """ Called when log added """
    #     print "LogCB added"
    #     QtGui.QTreeWidgetItem.setData(self, 0, Qt.CheckStateRole, Qt.Checked)
    #     QtGui.QTreeWidgetItem.setData(self, 1, Qt.DisplayRole, "Added") 
开发者ID:omwdunkley,项目名称:crazyflieROS,代码行数:30,代码来源:logManager.py

示例15: stopLog

# 需要导入模块: from PyQt4.QtCore import Qt [as 别名]
# 或者: from PyQt4.QtCore.Qt import DisplayRole [as 别名]
def stopLog(self):
        """ User request halt """
        #print "Requested log stop"
        if self.lg:
            self.lg.delete() #Invokes logStarted(False)
            self.lg = None
        if self.allSelected():
            self.setAllState(Qt.Unchecked)
        #else:
        #    self.setAllState(Qt.Checked, activeOnly=True)
        QtGui.QTreeWidgetItem.setData(self, 0, Qt.CheckStateRole, Qt.Unchecked)
        QtGui.QTreeWidgetItem.setData(self, 1, Qt.DisplayRole, "Off")
        self.treeWidget().sig_logStatus.emit(self.name, -1)
        self.fm = None 
开发者ID:omwdunkley,项目名称:crazyflieROS,代码行数:16,代码来源:logManager.py


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