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


Python QtCore.QVariant方法代码示例

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


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

示例1: readSettings

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QVariant [as 别名]
def readSettings(self):
        settings = QtCore.QSettings("Arabeyes.org", "Qutrub")
        try:
            family=settings.value("font_base_family", QtCore.QVariant(QString("Traditional Arabic"))).toString()
            size,ok=settings.value("font_base_size", QtCore.QVariant(12)).toInt();
            bold=settings.value("font_base_bold", QtCore.QVariant(True)).toBool()
            dictsetting,ok=settings.value("DictSetting", QtCore.QVariant(1)).toInt();
        except TypeError:
            family=settings.value("font_base_family", "Traditional Arabic")
            size=settings.value("font_base_size", "12")
            size= int(size)
            ok = bool(size)
            bold=settings.value("font_base_bold", True)
            bold = bool(bold)
            dictsetting =settings.value("DictSetting", "1")
            dictsetting = int(dictsetting)
        if not ok:size=12;
        self.font_result.setFamily(family)
        self.font_result.setPointSize(size)
        self.font_result.setBold(bold)
        #read of dictsetting options
        
        if not ok:dictsetting=1;

##        self.BDictSetting.setCheckState(dictsetting); 
开发者ID:linuxscout,项目名称:mishkal,代码行数:27,代码来源:setting.py

示例2: from_qvariant

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QVariant [as 别名]
def from_qvariant(qobj=None, convfunc=None):
        """Convert QVariant object to Python object
        This is a transitional function from PyQt API #1 (QVariant exist)
        to PyQt API #2 and Pyside (QVariant does not exist)"""
        if PYQT_API_1:
            # PyQt API #1
            assert isinstance(convfunc, collections.Callable)
            if convfunc in TEXT_TYPES or convfunc is to_text_string:
                return convfunc(qobj.toString())
            elif convfunc is bool:
                return qobj.toBool()
            elif convfunc is int:
                return qobj.toInt()[0]
            elif convfunc is float:
                return qobj.toDouble()[0]
            else:
                return convfunc(qobj)
        else:
            # PyQt API #2
            return qobj 
开发者ID:birforce,项目名称:vnpy_crypto,代码行数:22,代码来源:compat.py

示例3: readSettings

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QVariant [as 别名]
def readSettings(self):
        """ Load settings from previous session """
        rospy.logdebug("Loading previous session settings")
        settings = QSettings("omwdunkley", "reset" if self.options.reset else "flieROS"+str(self.options.radio) )
        self.resize(settings.value("size", QVariant(QSize(300, 500))).toSize())
        self.move(settings.value("pos", QVariant(QPoint(200, 200))).toPoint())

        self.ui.checkBox_reconnect.setChecked(settings.value("autoReconnect", QVariant(self.ui.checkBox_reconnect.isChecked())).toBool())
        self.ui.checkBox_beep.setChecked(settings.value("beepOn", QVariant(self.ui.checkBox_beep.isChecked())).toBool())
        self.ui.checkBox_xmode.setChecked(settings.value("xmodeOn", QVariant(self.ui.checkBox_xmode.isChecked())).toBool())
        self.ui.checkBox_kill.setChecked(settings.value("killOn", QVariant(self.ui.checkBox_kill.isChecked())).toBool())
        self.ui.checkBox_startupConnect.setChecked(settings.value("startConnect", QVariant(self.ui.checkBox_startupConnect)).toBool())

        self.ui.checkBox_pktHZ.setChecked(settings.value("pktHzOn", QVariant(self.ui.checkBox_pktHZ.isChecked())).toBool())
        self.ui.checkBox_logHZ.setChecked(settings.value("logHzOn", QVariant(self.ui.checkBox_logHZ.isChecked())).toBool())
        self.ui.horizontalSlider_pktHZ.setValue(settings.value("pktHzVal", QVariant(self.ui.horizontalSlider_pktHZ.value())).toInt()[0])
        self.ui.horizontalSlider_logHZ.setValue(settings.value("logHzVal", QVariant(self.ui.horizontalSlider_logHZ.value())).toInt()[0])
        self.ui.horizontalSlider_guiHZ.setValue(settings.value("guiHzVal", QVariant(self.ui.horizontalSlider_guiHZ.value())).toInt()[0])
        self.ui.horizontalSlider_AI.setValue(settings.value("aiHzVal", QVariant(self.ui.horizontalSlider_AI.value())).toInt()[0])

        self.logManager.header().restoreState(settings.value("logTreeH", self.logManager.header().saveState()).toByteArray())
        self.paramManager.header().restoreState(settings.value("paramTreeH", self.paramManager.header().saveState()).toByteArray()) 
开发者ID:omwdunkley,项目名称:crazyflieROS,代码行数:24,代码来源:driverWindow.py

示例4: writeSettings

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QVariant [as 别名]
def writeSettings(self):
        """ Write settings to load at next start up """
        rospy.logdebug("Saving session settings")
        settings = QSettings("omwdunkley", "flieROS"+str(self.options.radio))
        settings.setValue("pos", QVariant(self.pos()))
        settings.setValue("size", QVariant(self.size()))

        settings.setValue("autoReconnect", QVariant(self.ui.checkBox_reconnect.isChecked()))
        settings.setValue("beepOn", QVariant(self.ui.checkBox_beep.isChecked()))
        settings.setValue("xmodeOn", QVariant(self.ui.checkBox_xmode.isChecked()))
        settings.setValue("killOn", QVariant(self.ui.checkBox_kill.isChecked()))
        settings.setValue("startConnect", QVariant(self.ui.checkBox_startupConnect.isChecked()))

        settings.setValue("pktHzOn", QVariant(self.ui.checkBox_pktHZ.isChecked()))
        settings.setValue("logHzOn", QVariant(self.ui.checkBox_logHZ.isChecked()))
        settings.setValue("pktHzVal", QVariant(self.ui.horizontalSlider_pktHZ.value()))
        settings.setValue("logHzVal", QVariant(self.ui.horizontalSlider_logHZ.value()))
        settings.setValue("guiHzVal", QVariant(self.ui.horizontalSlider_guiHZ.value()))
        settings.setValue("aiHzVal", QVariant(self.ui.horizontalSlider_AI.value()))

        settings.setValue("logTreeH",QVariant(self.logManager.header().saveState()))
        settings.setValue("paramTreeH",QVariant(self.paramManager.header().saveState())) 
开发者ID:omwdunkley,项目名称:crazyflieROS,代码行数:24,代码来源:driverWindow.py

示例5: flags

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QVariant [as 别名]
def flags(self, index):
        if not index.isValid():
            return 0

        # Prevent groups from selection
        if not index.internalPointer().obj:
            return Qt.Qt.ItemIsEnabled
        else:
            return Qt.Qt.ItemIsEnabled | Qt.Qt.ItemIsSelectable | Qt.Qt.ItemIsEditable

        return QtCore.QAbstractItemModel.flags(self, index)

    # def data(self, index, role=Qt.Qt.DisplayRole):
    #     if not index.isValid() or not 0 <= index.row() < self.rowCount():
    #         return QtCore.QVariant()
    #     row = index.row()
    #     if role == Qt.Qt.DisplayRole:
    #         return self.object_list[row].options["name"]
    #     if role == Qt.Qt.DecorationRole:
    #         return self.icons[self.object_list[row].kind]
    #     # if role == Qt.Qt.CheckStateRole:
    #     #     if row in self.checked_indexes:
    #     #         return Qt.Qt.Checked
    #     #     else:
    #     #         return Qt.Qt.Unchecked 
开发者ID:Denvi,项目名称:FlatCAM,代码行数:27,代码来源:ObjectCollection.py

示例6: headerData

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

        data = None
        if section == 0:
            if role == QtCore.Qt.DisplayRole:
                data = 'Key'
            elif role == QtCore.Qt.ToolTipRole:
                data = 'Variable name'
        elif section == 1:
            if role == QtCore.Qt.DisplayRole:
                data = 'Value'
            elif role == QtCore.Qt.ToolTipRole:
                data = 'Variable value'

        return QtCore.QVariant(data) 
开发者ID:mazaclub,项目名称:hashmal,代码行数:19,代码来源:variables.py

示例7: data

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QVariant [as 别名]
def data(self, index, role = QtCore.Qt.DisplayRole):
        if role not in [QtCore.Qt.DisplayRole, QtCore.Qt.UserRole]:
            return QtCore.QVariant(None)
        data = None
        r = index.row()
        c = index.column()
        key = self.vars_data.keys()[r]

        if c == 0:
            data = key
        elif c == 1:
            if role == QtCore.Qt.DisplayRole:
                data = self.vars_data[key]
            elif role == QtCore.Qt.UserRole:
                value = self.vars_data[key]
                cached = self.classification_cache.get(value, None)
                if cached is None:
                    data = classify_data(value)
                    self.classification_cache[value] = data
                else:
                    data = cached

        return QtCore.QVariant(data) 
开发者ID:mazaclub,项目名称:hashmal,代码行数:25,代码来源:variables.py

示例8: set_fields

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QVariant [as 别名]
def set_fields(self, script=None, txTo=None, inIdx=None, hashType=None):
        """Populate model.

        Args:
            script (str): Human-readable script.
            txTo (Transaction): Transaction.
            inIdx (int): Input index.
            hashType (int): SigHash type.

        """
        if script is not None:
            self.setData(self.index(0, 0), QVariant(script))
        if txTo is not None:
            self.setData(self.index(0, 1), QVariant(b2x(txTo.serialize())))
        if inIdx is not None:
            self.setData(self.index(0, 2), QVariant(inIdx))
        if hashType is not None:
            self.setData(self.index(0, 3), QVariant(hashType & 0x1f), RawRole)
            self.setData(self.index(0, 4), QVariant(hashType & SIGHASH_ANYONECANPAY)) 
开发者ID:mazaclub,项目名称:hashmal,代码行数:21,代码来源:tx_builder.py

示例9: readSettings

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QVariant [as 别名]
def readSettings(self):
        settings = QtCore.QSettings("Arabeyes.org", "Qutrub")
        try:
            family=settings.value("font_base_family", QtCore.QVariant(QString("Traditional Arabic"))).toString()
        except TypeError:
            family = str(settings.value("font_base_family", "Traditional Arabic"))
        try:
            size,ok=settings.value("font_base_size", QtCore.QVariant(12)).toInt();
        except TypeError:
            size = settings.value("font_base_size", 12)
            size = int(size)
            ok = bool(size)
            
        if not ok:size=12;
        try:
            bold=settings.value("font_base_bold", QtCore.QVariant(True)).toBool()
        except TypeError:
            bold= bool(settings.value("font_base_bold", True))
        self.font_result.setFamily(family)
        self.font_result.setPointSize(size)
        self.font_result.setBold(bold)
        #read of dictsetting options
        try:
            dictsetting,ok = settings.value("DictSetting", QtCore.QVariant(1)).toInt();
        except TypeError:
            dictsetting = settings.value("DictSetting", 1);
            ok = bool(dictsetting)
        if not ok:dictsetting=1;

        self.BDictOption=dictsetting; 
开发者ID:linuxscout,项目名称:mishkal,代码行数:32,代码来源:appgui.py

示例10: writeSettings

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QVariant [as 别名]
def writeSettings(self):
        settings = QtCore.QSettings("Arabeyes.org", "Qutrub")
        try:
            settings.setValue("font_base_family", QtCore.QVariant(self.font_result.family()))
            settings.setValue("font_base_size", QtCore.QVariant(self.font_result.pointSize()))
            settings.setValue("font_base_bold", QtCore.QVariant(self.font_result.bold()))
        except:
            settings.setValue("font_base_family", self.font_result.family())
            settings.setValue("font_base_size", self.font_result.pointSize())
            settings.setValue("font_base_bold", self.font_result.bold())
        #write of dictsetting options
##        settings.setValue("DictSetting", QtCore.QVariant(self.BDictSetting.checkState())); 
开发者ID:linuxscout,项目名称:mishkal,代码行数:14,代码来源:setting.py

示例11: to_qvariant

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QVariant [as 别名]
def to_qvariant(pyobj=None):
        """Convert Python object to QVariant
        This is a transitional function from PyQt API #1 (QVariant exist)
        to PyQt API #2 and Pyside (QVariant does not exist)"""
        if PYQT_API_1:
            # PyQt API #1
            from PyQt4.QtCore import QVariant
            return QVariant(pyobj)
        else:
            # PyQt API #2
            return pyobj 
开发者ID:birforce,项目名称:vnpy_crypto,代码行数:13,代码来源:compat.py

示例12: headerData

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QVariant [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

示例13: data

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QVariant [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

示例14: setData

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QVariant [as 别名]
def setData(self, index, value, role):
        row = self.df.index[index.row()]
        col = self.df.columns[index.column()]
        if hasattr(value, 'toPyObject'):
            # PyQt4 gets a QVariant
            value = value.toPyObject()
        else:
            # PySide gets an unicode
            dtype = self.df[col].dtype
            if dtype != object:
                value = None if value == '' else dtype.type(value)
        self.df.set_value(row, col, value)
        return True 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:15,代码来源:qtpandas.py

示例15: __init__

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QVariant [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


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