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


Python QTableWidgetItem.setCheckState方法代码示例

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


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

示例1: populate_table_row

# 需要导入模块: from PyQt5.Qt import QTableWidgetItem [as 别名]
# 或者: from PyQt5.Qt.QTableWidgetItem import setCheckState [as 别名]
    def populate_table_row(self, row, line):

        if True:
            checkbox_cell = QTableWidgetItem()
            checkbox_cell.setFlags(Qt.ItemIsUserCheckable | Qt.ItemIsEnabled)
            checkbox_cell.setCheckState(Qt.Unchecked)
            checkbox_cell.setToolTip(_('Checked sections will be included in <i>all</i> split books.<br>Default title will still be taken from the first <i>selected</i> section, and section order will remain as shown.')+
                                     '<br>'+_('Use Context Menu (right-click) on selected sections to check or uncheck all selected sections.'))
            self.setItem(row, 0, checkbox_cell)

        href = line['href']
        if line['anchor']:
            href = "%s#%s"%(href,line['anchor'])

        href_cell = ReadOnlyTableWidgetItem(href)
        href_cell.setToolTip(line['sample']+SAMPLE_NOTE)
        self.setItem(row, 1, href_cell)

        if 'guide' in line:
            guide = "(%s):%s"%line['guide']
        else:
            guide = ""
        guide_cell = ReadOnlyTableWidgetItem(guide)
        guide_cell.setToolTip(_("Indicates 'special' pages: copyright, titlepage, etc."))
        self.setItem(row, 2, guide_cell)

        toc_str = "|".join(line['toc'])
        toc_cell = QTableWidgetItem(toc_str)
        toc_cell.setData(Qt.UserRole, toc_str)
        toc_cell.setToolTip(_('''Click and copy hotkey to copy text.
Double-click to edit ToC entry.
Pipes(|) divide different ToC entries to the same place.'''))
        self.setItem(row, 3, toc_cell)
开发者ID:JimmXinu,项目名称:EpubSplit,代码行数:35,代码来源:dialogs.py

示例2: setup_row

# 需要导入模块: from PyQt5.Qt import QTableWidgetItem [as 别名]
# 或者: from PyQt5.Qt.QTableWidgetItem import setCheckState [as 别名]
    def setup_row(self, field_metadata, row, col, oldkey=None):
        flags = Qt.ItemIsEnabled | Qt.ItemIsSelectable

        item = QTableWidgetItem(col)
        item.setFlags(flags)
        self.opt_columns.setItem(row, 1, item)

        if col.startswith('#'):
            fm = self.custcols[oldkey if oldkey is not None else col]
        else:
            fm = field_metadata[col]

        if col == 'title':
            coltype = _('Text')
        elif col == 'ondevice':
            coltype = _('Yes/No with text')
        else:
            dt = fm['datatype']
            if fm['is_multiple']:
                if col == 'authors' or fm.get('display', {}).get('is_names', False):
                    coltype = _('Ampersand separated text, shown in the Tag browser')
                else:
                    coltype = self.column_desc['*' + dt]
            else:
                coltype = self.column_desc[dt]
        coltype_info = (coltype if oldkey is None else
                          ' ' + _('(lookup name was {0}) {1}'.format(oldkey, coltype)))

        item = QTableWidgetItem(coltype_info)
        item.setFlags(flags)
        self.opt_columns.setItem(row, 2, item)

        desc = fm['display'].get('description', "")
        item = QTableWidgetItem(desc)
        item.setFlags(flags)
        self.opt_columns.setItem(row, 3, item)

        item = QTableWidgetItem(fm['name'])
        item.setData(Qt.UserRole, (col))
        item.setFlags(flags)
        self.opt_columns.setItem(row, 0, item)

        if col.startswith('#'):
            item.setData(Qt.DecorationRole, (QIcon(I('column.png'))))
        if col != 'ondevice':
            flags |= Qt.ItemIsUserCheckable
        item.setFlags(flags)
        if col != 'ondevice':
            item.setCheckState(Qt.Unchecked if col in self.hidden_cols else
                    Qt.Checked)
开发者ID:MarioJC,项目名称:calibre,代码行数:52,代码来源:columns.py

示例3: update_table

# 需要导入模块: from PyQt5.Qt import QTableWidgetItem [as 别名]
# 或者: from PyQt5.Qt.QTableWidgetItem import setCheckState [as 别名]
 def update_table(self, init=False):
     if init:
         self.init_table()
     records = DatabaseManager.get_all_keyboards()
     self.keyboard_table.setRowCount(records[0])
     for idx, record in enumerate(records[1]):
         self.keyboard_table.setItem(idx, 1, QTableWidgetItem(record.language_name))
         self.keyboard_table.setItem(idx, 2, QTableWidgetItem(str(record.id)))
         chk_box = QTableWidgetItem()
         chk_box.setFlags(Qt.ItemIsUserCheckable | Qt.ItemIsEnabled)
         chk_box.setCheckState(Qt.Unchecked)
         self.keyboard_table.setItem(idx, 0, chk_box)
     self.keyboard_table.resizeRowsToContents()
     return
开发者ID:kuruntham,项目名称:pykalappai,代码行数:16,代码来源:EKWindow.py

示例4: __init__

# 需要导入模块: from PyQt5.Qt import QTableWidgetItem [as 别名]
# 或者: from PyQt5.Qt.QTableWidgetItem import setCheckState [as 别名]
    def __init__(self, parent, items):
        QDialog.__init__(self, parent)
        Ui_DeleteMatchingFromDeviceDialog.__init__(self)
        self.setupUi(self)

        self.explanation.setText('<p>'+_('All checked books will be '
                                   '<b>permanently deleted</b> from your '
                                   'device. Please verify the list.')+'</p>')
        self.buttonBox.accepted.connect(self.accepted)
        self.buttonBox.rejected.connect(self.rejected)
        self.table.cellClicked.connect(self.cell_clicked)
        self.table.setSelectionMode(QAbstractItemView.NoSelection)
        self.table.setColumnCount(7)
        self.table.setHorizontalHeaderLabels(
                                    ['', _('Location'), _('Title'), _('Author'),
                                      _('Date'), _('Format'), _('Path')])
        rows = 0
        for card in items:
            rows += len(items[card][1])
        self.table.setRowCount(rows)
        row = 0
        for card in items:
            (model,books) = items[card]
            for (id,book) in books:
                item = QTableWidgetItem()
                item.setFlags(Qt.ItemIsUserCheckable|Qt.ItemIsEnabled)
                item.setCheckState(Qt.Checked)
                item.setData(Qt.UserRole, (model, id, book.path))
                self.table.setItem(row, 0, item)
                self.table.setItem(row, 1, tableItem(card))
                self.table.setItem(row, 2, titleTableItem(book.title))
                self.table.setItem(row, 3, authorTableItem(book))
                self.table.setItem(row, 4, dateTableItem(book.datetime))
                self.table.setItem(row, 5, centeredTableItem(book.path.rpartition('.')[2]))
                self.table.setItem(row, 6, tableItem(book.path))
                row += 1
        self.table.setCurrentCell(0, 1)
        self.table.resizeColumnsToContents()
        self.table.setSortingEnabled(True)
        self.table.sortByColumn(2, Qt.AscendingOrder)
        self.table.setCurrentCell(0, 1)
开发者ID:AtulKumar2,项目名称:calibre,代码行数:43,代码来源:delete_matching_from_device.py

示例5: setup_row

# 需要导入模块: from PyQt5.Qt import QTableWidgetItem [as 别名]
# 或者: from PyQt5.Qt.QTableWidgetItem import setCheckState [as 别名]
    def setup_row(self, field_metadata, row, col):
        item = QTableWidgetItem(col)
        self.opt_columns.setItem(row, 1, item)

        if col.startswith('#'):
            fm = self.custcols[col]
        else:
            fm = field_metadata[col]

        if col == 'title':
            coltype = _('Text')
        elif col == 'ondevice':
            coltype = _('Yes/No with text')
        else:
            dt = fm['datatype']
            if fm['is_multiple']:
                dt = '*' + dt
            coltype = self.column_desc[dt]
        item = QTableWidgetItem(coltype)
        self.opt_columns.setItem(row, 2, item)

        desc = fm['display'].get('description', "")
        item = QTableWidgetItem(desc)
        self.opt_columns.setItem(row, 3, item)

        item = QTableWidgetItem(fm['name'])
        item.setData(Qt.UserRole, (col))
        self.opt_columns.setItem(row, 0, item)

        if col.startswith('#'):
            item.setData(Qt.DecorationRole, (QIcon(I('column.png'))))
        flags = Qt.ItemIsEnabled|Qt.ItemIsSelectable
        if col != 'ondevice':
            flags |= Qt.ItemIsUserCheckable
        item.setFlags(flags)
        if col != 'ondevice':
            item.setCheckState(Qt.Unchecked if col in self.hidden_cols else
                    Qt.Checked)
开发者ID:Britlantine,项目名称:calibre,代码行数:40,代码来源:columns.py


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