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


Python Qt.CheckStateRole方法代码示例

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


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

示例1: data

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import CheckStateRole [as 别名]
def data(self, index, role):
        if not index.isValid():
            return None
        if index.column() == 0:
            value = ('' if self.my_data[index.row()][index.column() + 1]
                     else 'Skip')
        else:
            value = self.my_data[index.row()][index.column() + 1]
        if role == Qt.EditRole:
            return value
        elif role == Qt.DisplayRole:
            return value
        elif role == Qt.CheckStateRole:
            if index.column() == 0:
                return (
                    Qt.Checked if self.my_data[index.row()][index.column() + 1]
                    else Qt.Unchecked) 
开发者ID:jprouty,项目名称:mint-amazon-tagger,代码行数:19,代码来源:qt.py

示例2: data

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import CheckStateRole [as 别名]
def data(self, index, rola=Qt.DisplayRole):
        """ Wyświetlanie danych """
        i = index.row()
        j = index.column()

        if rola == Qt.DisplayRole:
            return '{0}'.format(self.tabela[i][j])
        elif rola == Qt.CheckStateRole and (j == 3 or j == 4):
            if self.tabela[i][j]:
                return Qt.Checked
            else:
                return Qt.Unchecked
        elif rola == Qt.EditRole and j == 1:
            return self.tabela[i][j]
        else:
            return QVariant() 
开发者ID:koduj-z-klasa,项目名称:python101,代码行数:18,代码来源:tabmodel_z5.py

示例3: setData

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import CheckStateRole [as 别名]
def setData(self, index: QModelIndex, value, role=None):
        if not index.isValid():
            return False

        i, j = index.row(), index.column()
        device = self.get_device_at(i)
        if role == Qt.CheckStateRole:
            enabled = bool(value)
            if j == 0:
                device.is_enabled = enabled
            if j == 2:
                if enabled and device.has_native_backend:
                    device.selected_backend = Backends.native
                elif not enabled and device.has_gnuradio_backend:
                    device.selected_backend = Backends.grc
            elif j == 3:
                if enabled and device.has_gnuradio_backend:
                    device.selected_backend = Backends.grc
                elif not enabled and device.has_native_backend:
                    device.selected_backend = Backends.native

            self.update()
            device.write_settings()
            return True 
开发者ID:jopohl,项目名称:urh,代码行数:26,代码来源:OptionsDialog.py

示例4: setData

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import CheckStateRole [as 别名]
def setData(self, index: QModelIndex, value, role=None):
        row = index.row()
        lbl = self.display_labels[row]
        if role == Qt.EditRole and index.column() in (0, 1, 2, 3):
            if index.column() == 0:
                lbl.name = value
                new_field_type = self.controller.field_types_by_caption.get(value, None)
                self.controller.active_message_type.change_field_type_of_label(lbl, new_field_type)
            elif index.column() == 1:
                lbl.color_index = value
                self.label_color_changed.emit(lbl)
            elif index.column() == 2:
                lbl.display_format_index = value
            elif index.column() == 3:
                lbl.display_order_str = value

            self.dataChanged.emit(self.index(row, 0),
                                  self.index(row, self.columnCount()))
        elif role == Qt.CheckStateRole and index.column() == 0:
            lbl.show = value
            self.protolabel_visibility_changed.emit(lbl)
            return True 
开发者ID:jopohl,项目名称:urh,代码行数:24,代码来源:LabelValueTableModel.py

示例5: data

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import CheckStateRole [as 别名]
def data(self, index, role=Qt.DisplayRole):
        row = index.row()
        if row >= len(self.labels):
            return

        if role == Qt.DisplayRole:
            nfuzzval = len(self.labels[row].fuzz_values)
            nfuzzval = str(nfuzzval - 1) if nfuzzval > 1 else "empty"
            try:
                return self.labels[row].name + " (" + nfuzzval + ")"
            except TypeError:
                return ""
        elif role == Qt.CheckStateRole:
            return self.labels[row].fuzz_me
        elif role == Qt.BackgroundColorRole:
            return settings.LABEL_COLORS[self.labels[row].color_index] 
开发者ID:jopohl,项目名称:urh,代码行数:18,代码来源:GeneratorListModel.py

示例6: data

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import CheckStateRole [as 别名]
def data(self, index: QModelIndex, role=None):
        item = self.getItem(index)
        if role == Qt.DisplayRole:
            return item.data()
        elif role == Qt.DecorationRole and item.is_group:
            return QIcon.fromTheme("folder")
        elif role == Qt.CheckStateRole:
            return item.show
        elif role == Qt.FontRole:
            if item.is_group and self.rootItem.index_of(item) in self.controller.active_group_ids:
                font = QFont()
                font.setBold(True)
                return font
            elif item.protocol in self.controller.selected_protocols:
                font = QFont()
                font.setBold(True)
                return font
        elif role == Qt.ToolTipRole:
            return item.data() 
开发者ID:jopohl,项目名称:urh,代码行数:21,代码来源:ProtocolTreeModel.py

示例7: data

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import CheckStateRole [as 别名]
def data(self, index, role=Qt.DisplayRole):
        row = index.row()
        if not index.isValid() or row >= len(self.message_types):
            return

        message_type = self.message_types[row]

        if role == Qt.DisplayRole:
            if index.column() == 0:
                return message_type.name
            elif index.column() == 1:
                return ""
        elif role == Qt.CheckStateRole:
            if index.column() == 0:
                return message_type.show
            elif index.column() == 1:
                return None
        elif role == Qt.EditRole:
            if index.column() == 0:
                return message_type.name
        elif role == Qt.FontRole and index.column() == 0:
            font = QFont()
            font.setBold(index.row() in self.selected_message_type_indices)
            return font 
开发者ID:jopohl,项目名称:urh,代码行数:26,代码来源:MessageTypeTableModel.py

示例8: data

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import CheckStateRole [as 别名]
def data(self, index: QModelIndex, role=None):
        row = index.row()
        if role == Qt.DisplayRole:
            if row == 0:
                return "not assigned"
            else:
                try:
                    return str(self.participants[row-1])
                except IndexError:
                    return None

        elif role == Qt.CheckStateRole:
            if row == 0:
                return Qt.Checked if self.show_unassigned else Qt.Unchecked
            else:
                try:
                    return Qt.Checked if self.participants[row-1].show else Qt.Unchecked
                except IndexError:
                    return None 
开发者ID:jopohl,项目名称:urh,代码行数:21,代码来源:ParticipantListModel.py

示例9: data

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import CheckStateRole [as 别名]
def data(self, index, role=None):
        value = self._anchor_positions[index.row()][index.column()]
        if index.isValid():
            if index.column() == 0:
                if role == Qt.CheckStateRole:
                    return QVariant(value)
            elif index.column() == 1:
                if role == Qt.DisplayRole:
                    return QVariant(value)
            else:
                if role == Qt.DisplayRole:
                    return QVariant('%.2f' % (value))
                elif role == Qt.EditRole:
                    return QVariant(value)
                elif role == Qt.BackgroundRole:
                    return self._get_background(index.row(), index.column())

        return QVariant() 
开发者ID:bitcraze,项目名称:crazyflie-clients-python,代码行数:20,代码来源:anchor_position_dialog.py

示例10: data

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

        item = index.internalPointer()

        if role == Qt.DisplayRole:
            return item.data(index.column())
        elif role == Qt.CheckStateRole and index.column() == 0:
            return item.getCheckedState()
        else:
            return None 
开发者ID:borgbase,项目名称:vorta,代码行数:14,代码来源:extract_dialog.py

示例11: setData

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import CheckStateRole [as 别名]
def setData(self, index, value, role=Qt.EditRole):
        if role == Qt.CheckStateRole:
            item = index.internalPointer()
            item.setCheckedState(value)
            self.dataChanged.emit(QModelIndex(), QModelIndex(), [])

        return True 
开发者ID:borgbase,项目名称:vorta,代码行数:9,代码来源:tree_view.py

示例12: data

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import CheckStateRole [as 别名]
def data(self, index, role):
        if role == Qt.DisplayRole:
            if index.column() == 1:
                rowdata = self.macros[index.row()]
                macro = rowdata[index.column()]
                return macro.fname
        if role == Qt.CheckStateRole:
            if index.column() == 0:
                if self.macros[index.row()][0]:
                    return 2
                return 0
        return QVariant() 
开发者ID:roglew,项目名称:guppy-proxy,代码行数:14,代码来源:macros.py

示例13: setData

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import CheckStateRole [as 别名]
def setData(self, index, value, role):
        if role == Qt.CheckStateRole and index.column() == 0:
            if value:
                self.enable_macro(index.row())
            else:
                self.disable_macro(index.row())
            return True
        return False

    # Non model functions 
开发者ID:roglew,项目名称:guppy-proxy,代码行数:12,代码来源:macros.py

示例14: setData

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import CheckStateRole [as 别名]
def setData(self, index, value, role):
        if not index.isValid():
            return False
        if role == Qt.CheckStateRole and index.column() == 0:
            self.my_data[index.row()][index.column() + 1] = value == Qt.Checked
        self.dataChanged.emit(index, index)
        return True 
开发者ID:jprouty,项目名称:mint-amazon-tagger,代码行数:9,代码来源:qt.py

示例15: setData

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import CheckStateRole [as 别名]
def setData(self, index, value, rola=Qt.DisplayRole):
        """ Zmiana danych """
        i = index.row()
        j = index.column()
        if rola == Qt.EditRole and j == 1:
            self.tabela[i][j] = value
        elif rola == Qt.CheckStateRole and (j == 3 or j == 4):
            if value:
                self.tabela[i][j] = True
            else:
                self.tabela[i][j] = False

        return True 
开发者ID:koduj-z-klasa,项目名称:python101,代码行数:15,代码来源:tabmodel_z5.py


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