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


Python QTableWidgetItem.setFlags方法代码示例

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


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

示例1: populate_table_row

# 需要导入模块: from PyQt5.Qt import QTableWidgetItem [as 别名]
# 或者: from PyQt5.Qt.QTableWidgetItem import setFlags [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 setFlags [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 setFlags [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 setFlags [as 别名]
    def __init__(self, parent, get_option, get_help, db=None, book_id=None):
        # Dummy attributes to fool the Widget() option handler code. We handle
        # everything in our *handler methods.
        for i in range(1, 4):
            x = 'sr%d_'%i
            for y in ('search', 'replace'):
                z = x + y
                setattr(self, 'opt_'+z, z)
        self.opt_search_replace = 'search_replace'

        Widget.__init__(self, parent,
                ['search_replace',
                 'sr1_search', 'sr1_replace',
                 'sr2_search', 'sr2_replace',
                 'sr3_search', 'sr3_replace']
                )
        self.db, self.book_id = db, book_id

        self.sr_search.set_msg(_('&Search Regular Expression'))
        self.sr_search.set_book_id(book_id)
        self.sr_search.set_db(db)

        self.sr_search.doc_update.connect(self.update_doc)

        proto = QTableWidgetItem()
        proto.setFlags(Qt.ItemFlags(Qt.ItemIsSelectable + Qt.ItemIsEnabled))
        self.search_replace.setItemPrototype(proto)
        self.search_replace.setColumnCount(2)
        self.search_replace.setColumnWidth(0, 320)
        self.search_replace.setColumnWidth(1, 320)
        self.search_replace.setHorizontalHeaderLabels([
            _('Search Regular Expression'), _('Replacement Text')])

        self.sr_add.clicked.connect(self.sr_add_clicked)
        self.sr_change.clicked.connect(self.sr_change_clicked)
        self.sr_remove.clicked.connect(self.sr_remove_clicked)
        self.sr_load.clicked.connect(self.sr_load_clicked)
        self.sr_save.clicked.connect(self.sr_save_clicked)
        self.sr_up.clicked.connect(self.sr_up_clicked)
        self.sr_down.clicked.connect(self.sr_down_clicked)
        self.search_replace.currentCellChanged.connect(self.sr_currentCellChanged)

        self.initialize_options(get_option, get_help, db, book_id)

        try:
            self.rh_label.setText(self.rh_label.text() % localize_user_manual_link(
                'https://manual.calibre-ebook.com/regexp.html'))
        except TypeError:
            pass  # link already localized
开发者ID:davidfor,项目名称:calibre,代码行数:51,代码来源:search_and_replace.py

示例5: __init__

# 需要导入模块: from PyQt5.Qt import QTableWidgetItem [as 别名]
# 或者: from PyQt5.Qt.QTableWidgetItem import setFlags [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

示例6: setup_row

# 需要导入模块: from PyQt5.Qt import QTableWidgetItem [as 别名]
# 或者: from PyQt5.Qt.QTableWidgetItem import setFlags [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.setFlags方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。