本文整理汇总了Python中PyQt5.QtCore.Qt.ItemIsSelectable方法的典型用法代码示例。如果您正苦于以下问题:Python Qt.ItemIsSelectable方法的具体用法?Python Qt.ItemIsSelectable怎么用?Python Qt.ItemIsSelectable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtCore.Qt
的用法示例。
在下文中一共展示了Qt.ItemIsSelectable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: flags
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsSelectable [as 别名]
def flags(self, index):
"""Return the item flags for index.
Override QAbstractItemModel::flags.
Return: The item flags, or Qt.NoItemFlags on error.
"""
if not index.isValid():
return Qt.NoItemFlags
if index.parent().isValid():
# item
return (Qt.ItemIsEnabled | Qt.ItemIsSelectable |
Qt.ItemNeverHasChildren)
else:
# category
return Qt.NoItemFlags
示例2: display_utxos
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsSelectable [as 别名]
def display_utxos(self):
def item(value):
item = QTableWidgetItem(value)
item.setTextAlignment(Qt.AlignCenter)
item.setFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable)
return item
self.tableW.setRowCount(len(self.utxos))
for row, utxo in enumerate(self.utxos):
pivxAmount = round(int(utxo.get('satoshis', 0))/1e8, 8)
self.tableW.setItem(row, 0, item(str(pivxAmount)))
self.tableW.setItem(row, 1, item(str(utxo['confirmations'])))
self.tableW.setItem(row, 2, item(utxo.get('txid', None)))
self.tableW.setItem(row, 3, item(str(utxo.get('vout', None))))
if len(self.utxos):
self.tableW.resizeColumnsToContents()
self.lblMessage.setVisible(False)
self.tableW.horizontalHeader().setSectionResizeMode(2, QHeaderView.Stretch)
else:
self.lblMessage.setText('<b style="color:purple">No UTXO found for current address.\nEnter tx manually</b>')
self.lblMessage.setVisible(True)
示例3: _update_tree
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsSelectable [as 别名]
def _update_tree(self, conf, value):
"""Update the block tree"""
self._block_tree.clear()
for block in self._helper.cf.log.log_blocks:
item = QtWidgets.QTreeWidgetItem()
item.setFlags(Qt.ItemIsEnabled |
Qt.ItemIsSelectable)
item.setData(0, Qt.DisplayRole, block.id)
item.setData(1, Qt.EditRole, block.name)
item.setData(2, Qt.DisplayRole, (block.period_in_ms))
item.setData(3, Qt.DisplayRole, block.added)
item.setData(4, Qt.EditRole, block.started)
item.setData(5, Qt.EditRole, block.err_no)
for var in block.variables:
subItem = QtWidgets.QTreeWidgetItem()
subItem.setFlags(Qt.ItemIsEnabled |
Qt.ItemIsSelectable)
subItem.setData(6, Qt.EditRole, var.name)
item.addChild(subItem)
self._block_tree.addTopLevelItem(item)
self._block_tree.expandItem(item)
示例4: fill_tableWidget
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsSelectable [as 别名]
def fill_tableWidget(self):
''' Fill table widget with data. '''
numRows = self.ui.tableWidget.rowCount()
for row in range(0, numRows):
self.ui.tableWidget.removeRow(0)
self.ui.tableWidget.setColumnCount(len(self.fields))
for c, field in enumerate(self.fields):
item = QtWidgets.QTableWidgetItem(field + "\n" + self.fields_type[c] + "\n")
self.ui.tableWidget.setHorizontalHeaderItem(c, item)
self.ui.tableWidget.setRowCount(len(self.data))
for row in range(0, len(self.data)):
for col in range(0, len(self.fields)):
value = str(self.data[row][col])
item = QtWidgets.QTableWidgetItem(value)
item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled) # not editatble
self.ui.tableWidget.setItem(row, col, item)
self.ui.tableWidget.resizeColumnsToContents()
for col in range(0, self.ui.tableWidget.columnCount()):
if self.ui.tableWidget.columnWidth(col) > 200:
self.ui.tableWidget.setColumnWidth(col, 200)
示例5: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsSelectable [as 别名]
def __init__(self, segment, scaler, text_for_segment, code_av_dialog):
super(SegmentGraphicsItem, self).__init__(None)
self.segment = segment
self.scaler = scaler
#self.text_for_segment = text_for_segment
self.code_av_dialog = code_av_dialog
self.reload_segment = False
self.setFlag(self.ItemIsSelectable, True)
tooltip = self.segment['codename'] + " "
seg_time = "[" + msecs_to_mins_and_secs(self.segment['pos0']) + " - "
seg_time += msecs_to_mins_and_secs(self.segment['pos1']) + "]"
tooltip += seg_time
if self.segment['memo'] != "":
tooltip += "\n" + _("Memo: ") + self.segment['memo']
self.setToolTip(tooltip)
self.draw_segment()
示例6: flags
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsSelectable [as 别名]
def flags(self, index):
if not index.isValid():
return 0
if index.column() == 0:
return Qt.ItemIsEnabled | Qt.ItemIsSelectable
return Qt.ItemIsEditable | Qt.ItemIsEnabled | Qt.ItemIsSelectable
示例7: flags
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsSelectable [as 别名]
def flags(self, index):
flags = QAbstractTableModel.flags(self, index)
if not index.isValid():
return flags
prop = self.getProperty(index)
if prop is None:
return flags
flags |= Qt.ItemIsEnabled
flags |= Qt.ItemIsSelectable
mode = prop.get('mode', "Read/Write")
if "Write" in mode:
flags |= Qt.ItemIsEditable
return flags
示例8: flags
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsSelectable [as 别名]
def flags(self, index):
return Qt.ItemIsEnabled | Qt.ItemIsSelectable | Qt.ItemIsEditable
示例9: __InitFieldItem
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsSelectable [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
示例10: initCategories
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsSelectable [as 别名]
def initCategories(self):
generalButton = QListWidgetItem(self.categories)
generalButton.setIcon(QIcon(':/images/settings-general.png'))
generalButton.setText('General')
generalButton.setToolTip('General settings')
generalButton.setTextAlignment(Qt.AlignHCenter)
generalButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
videoButton = QListWidgetItem(self.categories)
videoButton.setIcon(QIcon(':/images/settings-video.png'))
videoButton.setText('Video')
videoButton.setToolTip('Video settings')
videoButton.setTextAlignment(Qt.AlignHCenter)
videoButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
themeButton = QListWidgetItem(self.categories)
themeButton.setIcon(QIcon(':/images/settings-theme.png'))
themeButton.setText('Theme')
themeButton.setToolTip('Theme settings')
themeButton.setTextAlignment(Qt.AlignHCenter)
themeButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
ffmpegButton = QListWidgetItem(self.categories)
ffmpegButton.setIcon(QIcon(':/images/settings-ffmpeg.png'))
ffmpegButton.setText('Tools')
ffmpegButton.setToolTip('Tools settings')
ffmpegButton.setTextAlignment(Qt.AlignHCenter)
ffmpegButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
logsButton = QListWidgetItem(self.categories)
logsButton.setIcon(QIcon(':/images/settings-logs.png'))
logsButton.setText('Logs')
logsButton.setToolTip('Logging settings')
logsButton.setTextAlignment(Qt.AlignHCenter)
logsButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
self.categories.currentItemChanged.connect(self.changePage)
self.categories.setCurrentRow(0)
self.categories.setMaximumWidth(self.categories.sizeHintForColumn(0) + 2)
示例11: renderClips
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsSelectable [as 别名]
def renderClips(self, cliptimes: list) -> int:
self.clear()
externalCount = 0
for index, clip in enumerate(cliptimes):
chapterName, endItem = '', ''
if isinstance(clip[1], QTime):
endItem = clip[1].toString(self.parent.timeformat)
self.parent.totalRuntime += clip[0].msecsTo(clip[1])
listitem = QListWidgetItem(self)
listitem.setToolTip('Drag to reorder clips')
if len(clip[3]):
listitem.setToolTip(clip[3])
externalCount += 1
if self.parent.createChapters:
chapterName = clip[4] if clip[4] is not None else 'Chapter {}'.format(index + 1)
listitem.setStatusTip('Reorder clips with mouse drag & drop or right-click menu on the clip to be moved')
listitem.setTextAlignment(Qt.AlignVCenter)
listitem.setData(Qt.DecorationRole + 1, clip[2])
listitem.setData(Qt.DisplayRole + 1, clip[0].toString(self.parent.timeformat))
listitem.setData(Qt.UserRole + 1, endItem)
listitem.setData(Qt.UserRole + 2, clip[3])
listitem.setData(Qt.UserRole + 3, chapterName)
listitem.setFlags(Qt.ItemIsSelectable | Qt.ItemIsDragEnabled | Qt.ItemIsEnabled)
self.addItem(listitem)
if isinstance(clip[1], QTime) and not len(clip[3]):
self.parent.seekSlider.addRegion(clip[0].msecsSinceStartOfDay(), clip[1].msecsSinceStartOfDay())
return externalCount
示例12: flags
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsSelectable [as 别名]
def flags(self, QModelIndex):
return Qt.ItemIsSelectable | Qt.ItemIsEnabled
示例13: flags
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsSelectable [as 别名]
def flags(self, QModelIndex):
return Qt.ItemIsEditable | Qt.ItemIsSelectable | Qt.ItemIsEnabled
示例14: flags
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsSelectable [as 别名]
def flags(self, index):
if not index.isValid():
return 0
flags = Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsDropEnabled
return flags
示例15: flags
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsSelectable [as 别名]
def flags(self, index):
base_flag = Qt.ItemIsEnabled | Qt.ItemIsSelectable
if self.is_editable:
return base_flag | Qt.ItemIsEditable
else:
return base_flag