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


Python Qt.ItemIsUserCheckable方法代码示例

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


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

示例1: flags

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

        j = index.column()
        device = self.get_device_at(index.row())
        if j == 0 and not device.has_native_backend and not device.has_gnuradio_backend:
            return Qt.NoItemFlags

        if j in [1, 2, 3] and not device.is_enabled:
            return Qt.NoItemFlags

        if j == 2 and not device.has_native_backend:
            return Qt.NoItemFlags

        if j == 3 and not device.has_gnuradio_backend:
            return Qt.NoItemFlags

        flags = Qt.ItemIsEnabled

        if j in [0, 2, 3]:
            flags |= Qt.ItemIsUserCheckable

        return flags 
开发者ID:jopohl,项目名称:urh,代码行数:26,代码来源:OptionsDialog.py

示例2: load_profile

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsUserCheckable [as 别名]
def load_profile(self, profile: dict):
        self.blockSignals(True)
        self.setSortingEnabled(False)
        self.clear()

        for name, settings in profile.items():
            parent = self.make_option(name, self, settings['state'], 0, settings['tooltip'], settings['dependency'])
            if settings['options']:
                for number, choice in enumerate(settings['options']):
                    if settings['active option'] == number:
                        option = self.make_option(str(choice), parent, True, 1, subindex=number)
                        option.setFlags(option.flags() ^ Qt.ItemIsUserCheckable)
                    else:
                        option = self.make_option(str(choice), parent, False, 1, subindex=number)
            self.make_exclusive(parent)

        self.hock_dependency()
        self.update_size()
        self.setSortingEnabled(True)
        self.sortByColumn(0, Qt.AscendingOrder)
        self.blockSignals(False) 
开发者ID:Thomasedv,项目名称:Grabber,代码行数:23,代码来源:parameter_tree.py

示例3: fill_item

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsUserCheckable [as 别名]
def fill_item(item, value):
    global n
    # item.setExpanded(True)
    if type(value) is dict:
        for key, val in sorted(value.items()):
            child = QTreeWidgetItem()
            child.setText(0, str(key))
            child.setText(1, str(key))
            child.setText(2, str(key))
            child.setFlags(child.flags() | Qt.ItemIsUserCheckable)
            child.setCheckState(0, Qt.Unchecked)
            item.addChild(child)
            n += 1
            fill_item(child, val)
    elif type(value) is list:
        for val in value:
            child = QTreeWidgetItem()
            child.setFlags(child.flags() | Qt.ItemIsUserCheckable)
            child.setCheckState(0, Qt.Unchecked)
            item.addChild(child)
            n += 1
            if type(val) is dict:
                child.setText(0, "[dict]")
                fill_item(child, val)
            elif type(val) is list:
                child.setText(0, "[list]")
                fill_item(child, val)
            else:
                child.setText(0, str(val))
    else:
        child = QTreeWidgetItem()
        child.setText(0, str(value))
        child.setFlags(child.flags() | Qt.ItemIsUserCheckable)
        child.setCheckState(0, Qt.Unchecked)
        item.addChild(child)
        n += 1 
开发者ID:Mebus,项目名称:restatic,代码行数:38,代码来源:extract_dialog.py

示例4: display_connection_list

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsUserCheckable [as 别名]
def display_connection_list(self):
        self.lstConns.clear()
        for cfg in self.connections_current:
            item = QListWidgetItem(cfg.get_description())
            item.setFlags(item.flags() | Qt.ItemIsUserCheckable)
            item.setCheckState(Qt.Checked if cfg.enabled else Qt.Unchecked)
            item.checkState()
            self.lstConns.addItem(item) 
开发者ID:Bertrand256,项目名称:dash-masternode-tool,代码行数:10,代码来源:config_dlg.py

示例5: on_action_new_connection_triggered

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsUserCheckable [as 别名]
def on_action_new_connection_triggered(self):
        cfg = DashNetworkConnectionCfg('rpc')
        cfg.testnet = True if self.cboDashNetwork.currentIndex() == 1 else False
        self.connections_current.append(cfg)

        # add config to the connections list:
        item = QListWidgetItem(cfg.get_description())
        item.setFlags(item.flags() | Qt.ItemIsUserCheckable)
        item.setCheckState(Qt.Checked if cfg.enabled else Qt.Unchecked)
        item.checkState()
        self.lstConns.addItem(item)
        self.lstConns.setCurrentItem(item)
        self.set_modified() 
开发者ID:Bertrand256,项目名称:dash-masternode-tool,代码行数:15,代码来源:config_dlg.py

示例6: __InitFieldItem

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsUserCheckable [as 别名]
def __InitFieldItem(self, parent, item):
        treeItem = QTreeWidgetItem(parent)
        treeItem.setText(0, item)
        treeItem.setFlags(Qt.ItemIsUserCheckable | Qt.ItemIsEnabled | Qt.ItemIsSelectable)
        treeItem.setCheckState(0, Qt.Unchecked)

        return treeItem 
开发者ID:moyuanz,项目名称:DevilYuan,代码行数:9,代码来源:DyTreeWidget.py

示例7: __init__

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsUserCheckable [as 别名]
def __init__(self,
                 name,
                 ais=None,
                 shape=None,
                 shape_display=None,
                 sig=None,
                 alpha=0.,
                 color='f4a824',
                 **kwargs):

        super(ObjectTreeItem,self).__init__([name],**kwargs)
        self.setFlags( self.flags() | Qt.ItemIsUserCheckable)
        self.setCheckState(0,Qt.Checked)

        self.ais = ais
        self.shape = shape
        self.shape_display = shape_display
        self.sig = sig

        self.properties = Parameter.create(name='Properties',
                                           children=self.props)

        self.properties['Name'] = name
        self.properties['Alpha'] = ais.Transparency()
        self.properties['Color'] = get_occ_color(ais) if ais else color
        self.properties.sigTreeStateChanged.connect(self.propertiesChanged) 
开发者ID:CadQuery,项目名称:CQ-editor,代码行数:28,代码来源:object_tree.py

示例8: dialog_helper_init

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsUserCheckable [as 别名]
def dialog_helper_init(self):
        self.check_all_button.clicked.connect(self.handle_check_all_clicked)
        self.check_none_button.clicked.connect(self.handle_check_none_clicked)
        for attr in self.get_attrs():
            it = QListWidgetItem()
            it.setText(attr)
            it.setData(Qt.UserRole, attr)
            it.setFlags(Qt.ItemIsUserCheckable | Qt.ItemIsEnabled)
            it.setCheckState(
                Qt.Checked if self.is_default_attr(attr) else Qt.Unchecked)
            self.attr_list.addItem(it) 
开发者ID:fre-sch,项目名称:mhw_armor_edit,代码行数:13,代码来源:import_export.py

示例9: flags

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsUserCheckable [as 别名]
def flags(self, index):
        f = Qt.ItemIsEnabled | Qt.ItemIsSelectable
        if index.column() == 0:
            f = f | Qt.ItemIsUserCheckable | Qt.ItemIsEditable
        return f 
开发者ID:roglew,项目名称:guppy-proxy,代码行数:7,代码来源:macros.py

示例10: make_exclusive

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsUserCheckable [as 别名]
def make_exclusive(self, item: QTreeWidgetItem):
        """
        Handles changes to self. Ensure options are expand_options, and resizes self when needed.
        """
        if self.signalsBlocked():
            unblock = False
        else:
            unblock = True

        if item.data(0, 33) == 0:
            self.expand_options(item)
            self.resizer(item)

        elif item.data(0, 33) == 1:
            self.blockSignals(True)
            for i in range(item.parent().childCount()):

                TWI = item.parent().child(i)
                try:
                    if TWI == item:
                        TWI.setFlags(TWI.flags() ^ Qt.ItemIsUserCheckable)
                    else:
                        TWI.setCheckState(0, Qt.Unchecked)
                        TWI.setFlags(TWI.flags() | Qt.ItemIsUserCheckable)
                except Exception as e:
                    # Log error
                    print(e)
        elif item.data(0, 33) == 2:
            pass  # Custom options should not have options, not now at least.
        else:
            pass  # TODO: Log error: state state not set.

        if unblock:
            self.blockSignals(False) 
开发者ID:Thomasedv,项目名称:Grabber,代码行数:36,代码来源:parameter_tree.py

示例11: __init__

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsUserCheckable [as 别名]
def __init__(self, value, changed_fun, avail_plugins):
        super().__init__()
        self.changed_fun = changed_fun
        self.curvalue = {v.upper() for v in value}
        if avail_plugins:
            for name in avail_plugins:
                row = QListWidgetItem(name)
                row.name = name
                row.setFlags(row.flags()|Qt.ItemIsUserCheckable)
                row.setCheckState(Qt.Checked if name in self.curvalue else Qt.Unchecked)
                self.addItem(row)
        self.itemChanged.connect(self.onitemchanged) 
开发者ID:TUDelft-CNS-ATM,项目名称:bluesky,代码行数:14,代码来源:settingswindow.py

示例12: flags

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsUserCheckable [as 别名]
def flags(self, index):
        if not index.isValid():
            return None
        if index.column() == 0:
            return (
                Qt.ItemIsEnabled | Qt.ItemIsSelectable |
                Qt.ItemIsUserCheckable)
        else:
            return Qt.ItemIsEnabled | Qt.ItemIsSelectable 
开发者ID:jprouty,项目名称:mint-amazon-tagger,代码行数:11,代码来源:qt.py

示例13: flags

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsUserCheckable [as 别名]
def flags(self, index):
        """ Zwraca właściwości kolumn tabeli """
        flags = super(TabModel, self).flags(index)
        j = index.column()
        if j == 1:
            flags |= Qt.ItemIsEditable
        elif j == 3 or j == 4:
            flags |= Qt.ItemIsUserCheckable

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

示例14: flags

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsUserCheckable [as 别名]
def flags(self, index: QModelIndex):
        flags = super().flags(index)
        if index.column() in (0, 1, 2, 3):
            flags |= Qt.ItemIsEditable
        if index.column() == 0:
            flags |= Qt.ItemIsUserCheckable

        return flags 
开发者ID:jopohl,项目名称:urh,代码行数:10,代码来源:LabelValueTableModel.py

示例15: flags

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsUserCheckable [as 别名]
def flags(self, index):
        flags = Qt.ItemIsEnabled | Qt.ItemIsSelectable | Qt.ItemIsEditable

        try:
            lbl = self.labels[index.row()]
        except IndexError:
            return flags

        if len(lbl.fuzz_values) > 1:
            flags |= Qt.ItemIsUserCheckable
        else:
            lbl.fuzz_me = False
        return flags 
开发者ID:jopohl,项目名称:urh,代码行数:15,代码来源:GeneratorListModel.py


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