本文整理汇总了Python中PyQt5.QtCore.Qt.ItemIsEnabled方法的典型用法代码示例。如果您正苦于以下问题:Python Qt.ItemIsEnabled方法的具体用法?Python Qt.ItemIsEnabled怎么用?Python Qt.ItemIsEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtCore.Qt
的用法示例。
在下文中一共展示了Qt.ItemIsEnabled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: flags
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsEnabled [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: add_parent_folder
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsEnabled [as 别名]
def add_parent_folder(self):
row_idx = self.rowCount()
self.insertRow(row_idx)
items = []
p = Pixmap(":/icons/images/material/arrow_upward.svg")
p.replace_color(QColor(0, 0, 0), QColor(0x99, 0x99, 0x99))
items.append(CustomTableItem(QIcon(p), ""))
items.append(CustomTableItem(_("TEXT_FILE_TREE_PARENT_FOLDER")))
items.append(CustomTableItem())
items.append(CustomTableItem())
items.append(CustomTableItem())
for col, item in zip(Column, items):
item.setData(NAME_DATA_INDEX, "")
item.setData(TYPE_DATA_INDEX, FileType.ParentFolder)
item.setData(UUID_DATA_INDEX, None)
item.setFlags(Qt.ItemIsEnabled)
self.setItem(row_idx, col, item)
示例3: add_parent_workspace
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsEnabled [as 别名]
def add_parent_workspace(self):
row_idx = self.rowCount()
self.insertRow(row_idx)
items = []
p = Pixmap(":/icons/images/material/arrow_upward.svg")
p.replace_color(QColor(0, 0, 0), QColor(0x99, 0x99, 0x99))
items.append(CustomTableItem(QIcon(p), ""))
items.append(CustomTableItem(_("TEXT_FILE_TREE_PARENT_WORKSPACE")))
items.append(CustomTableItem())
items.append(CustomTableItem())
items.append(CustomTableItem())
for col, item in zip(Column, items):
item.setData(NAME_DATA_INDEX, "")
item.setData(TYPE_DATA_INDEX, FileType.ParentWorkspace)
item.setData(UUID_DATA_INDEX, None)
item.setFlags(Qt.ItemIsEnabled)
self.setItem(row_idx, col, item)
示例4: scan_finished
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsEnabled [as 别名]
def scan_finished(self, matches):
records = [[x.rule, a[0]] for x in matches for a in x.strings]
self._table.setRowCount(len(records))
for i in range(0, len(records)):
# TODO: Proper QTableView / model implementation instead of lazy use of QTableWidget
desc = QtWidgets.QTableWidgetItem(records[i][0])
desc.setFlags(Qt.ItemIsEnabled)
# TODO: meta tooltip
offset = QtWidgets.QTableWidgetItem('0x%.8x' % records[i][1])
offset.setFlags(Qt.ItemIsEnabled)
offset.setForeground(QtGui.QColor(162, 217, 175))
self._table.setItem(i, 0, offset)
self._table.setItem(i, 1, desc)
self._table.cellDoubleClicked.connect(self.cell_action)
self._thread.terminate()
self._core.show()
self._core.selectTab(self)
self.show()
示例5: load_endpoints
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsEnabled [as 别名]
def load_endpoints(self):
self.choose_endpoint.endpoints.clear()
for name in listdir(str(BASE_PATH / 'endpoints')):
if name.endswith('.json'):
item = QListWidgetItem(name.split('.json')[0], self.choose_endpoint.endpoints)
item.setFlags(item.flags() & ~Qt.ItemIsEnabled)
pb_msg_to_endpoints = defaultdict(list)
with open(str(BASE_PATH / 'endpoints' / name)) as fd:
for endpoint in load(fd, object_pairs_hook=OrderedDict):
pb_msg_to_endpoints[endpoint['request']['proto_msg'].split('.')[-1]].append(endpoint)
for pb_msg, endpoints in pb_msg_to_endpoints.items():
item = QListWidgetItem(' ' * 4 + pb_msg, self.choose_endpoint.endpoints)
item.setFlags(item.flags() & ~Qt.ItemIsEnabled)
for endpoint in endpoints:
path_and_qs = '/' + endpoint['request']['url'].split('/', 3).pop()
item = QListWidgetItem(' ' * 8 + path_and_qs, self.choose_endpoint.endpoints)
item.setData(Qt.UserRole, endpoint)
self.set_view(self.choose_endpoint)
示例6: pb_clone_behavior_clicked
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsEnabled [as 别名]
def pb_clone_behavior_clicked(self):
"""
clone the selected configuration
"""
if not self.twBehaviors.selectedIndexes():
QMessageBox.about(self, programName, "First select a behavior")
else:
self.twBehaviors.setRowCount(self.twBehaviors.rowCount() + 1)
row = self.twBehaviors.selectedIndexes()[0].row()
for field in behavioursFields:
item = QTableWidgetItem(self.twBehaviors.item(row, behavioursFields[field]))
self.twBehaviors.setItem(self.twBehaviors.rowCount() - 1, behavioursFields[field], item)
if field in [TYPE, "category", "excluded", "coding map", "modifiers"]:
item.setFlags(Qt.ItemIsEnabled)
item.setBackground(QColor(230, 230, 230))
示例7: pbAddBehavior_clicked
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsEnabled [as 别名]
def pbAddBehavior_clicked(self):
"""
add new behavior to ethogram
"""
try:
# Add behavior to table
self.twBehaviors.setRowCount(self.twBehaviors.rowCount() + 1)
for field_type in behavioursFields:
item = QTableWidgetItem()
if field_type == TYPE:
item.setText("Point event")
if field_type in [TYPE, "category", "excluded", "coding map", "modifiers"]:
item.setFlags(Qt.ItemIsEnabled)
item.setBackground(QColor(230, 230, 230))
self.twBehaviors.setItem(self.twBehaviors.rowCount() - 1, behavioursFields[field_type], item)
except Exception:
logging.critical(f"Error:<br><b>{sys.exc_info()[1]}</b>")
dialog.error_message("adding a new behavior", sys.exc_info())
示例8: flags
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsEnabled [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
示例9: display_utxos
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsEnabled [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)
示例10: _update_tree
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsEnabled [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)
示例11: fill_tableWidget
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsEnabled [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)
示例12: flags
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsEnabled [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
示例13: flags
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsEnabled [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
示例14: flags
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsEnabled [as 别名]
def flags(self, index):
return Qt.ItemIsEnabled | Qt.ItemIsSelectable
示例15: flags
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsEnabled [as 别名]
def flags(self, index):
return Qt.ItemIsEnabled | Qt.ItemIsSelectable | Qt.ItemIsEditable