本文整理汇总了Python中PySide2.QtCore.Qt.DisplayRole方法的典型用法代码示例。如果您正苦于以下问题:Python Qt.DisplayRole方法的具体用法?Python Qt.DisplayRole怎么用?Python Qt.DisplayRole使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide2.QtCore.Qt
的用法示例。
在下文中一共展示了Qt.DisplayRole方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: data
# 需要导入模块: from PySide2.QtCore import Qt [as 别名]
# 或者: from PySide2.QtCore.Qt import DisplayRole [as 别名]
def data(self, index, role):
if not index.isValid():
return None
if index.row() < 0 or index.row() >= len(self.rows):
return None
info = self.rows[index.row()]
if role == Qt.DisplayRole:
# Format data into displayable text
if self.columns[index.column()] == "Address":
text = '0x%x' % info['address']
elif self.columns[index.column()] == "Name":
text = info['modpath']
if '/' in text:
text = text[text.rfind('/')+1:]
elif self.columns[index.column()] == "Full Path":
text = info['modpath']
else:
raise NotImplementedError('Unknown column')
return text
return None
示例2: data
# 需要导入模块: from PySide2.QtCore import Qt [as 别名]
# 或者: from PySide2.QtCore.Qt import DisplayRole [as 别名]
def data(self, index, role):
if not index.isValid():
return None
if index.row() < 0 or index.row() >= len(self.rows):
return None
contents = self.rows[index.row()][index.column()]
info = self.row_info[index.row()]
if role == Qt.DisplayRole:
# Format data into displayable text
if index.column() == 1:
# Address is like a pointer
text = '0x%x' % contents
else:
# TID should just be integer
text = '%x' % contents
return text
elif role == Qt.UserRole:
return info['state'] # 'updated', 'modified', 'unchanged'
# TODO: look into Qt::CheckStateRole for whether thread selected or not
return None
# called back after user edits
示例3: data
# 需要导入模块: from PySide2.QtCore import Qt [as 别名]
# 或者: from PySide2.QtCore.Qt import DisplayRole [as 别名]
def data(self, index, role):
if not index.isValid():
return None
if index.row() < 0 or index.row() >= len(self.rows):
return None
if role != Qt.DisplayRole:
return None
conts = self.rows[index.row()]
# Format data into displayable text
if self.columns[index.column()] == 'Location':
text = '%s+0x%x' % (conts['module'], conts['offset'])
elif self.columns[index.column()] == 'Remote Address':
text = '%x' % conts['address']
elif self.columns[index.column()] == 'Enabled':
text = str(conts['enabled'])
return text
示例4: data
# 需要导入模块: from PySide2.QtCore import Qt [as 别名]
# 或者: from PySide2.QtCore.Qt import DisplayRole [as 别名]
def data(self, index, role):
if not index.isValid():
return None
if index.row() < 0 or index.row() >= len(self.rows):
return None
conts = self.rows[index.row()][index.column()]
info = self.row_info[index.row()]
if role == Qt.DisplayRole:
# Format data into displayable text
if index.column() == 1:
# Pad out to ceil(bitlength/4) nibbles
text = ('%x' % conts).rjust((info['bits'] + 3) // 4, "0")
else:
text = str(conts)
return text
elif role == Qt.UserRole:
return info['state']
return None
示例5: data
# 需要导入模块: from PySide2.QtCore import Qt [as 别名]
# 或者: from PySide2.QtCore.Qt import DisplayRole [as 别名]
def data(self, index, role=Qt.DisplayRole):
if role == Qt.CheckStateRole:
return None
if role == Qt.FontRole:
return QFont(self.font_name, self.font_size)
regs = self.view.session_data['emulator.registers']
if len(regs) == 0 and index.row() == 0:
return None
if regs[index.row()][index.column()] is None:
return None
elif index.column() == 0:
return regs[index.row()][0]
else:
return hex(regs[index.row()][1])
示例6: data
# 需要导入模块: from PySide2.QtCore import Qt [as 别名]
# 或者: from PySide2.QtCore.Qt import DisplayRole [as 别名]
def data(self, index, role):
if not index.isValid():
return None
row = index.row()
if row >= len(self.xrefs):
return None
col = index.column()
xref = self.xrefs[row]
if role == Qt.DisplayRole:
return self._get_column_text(xref, col)
elif role == Qt.FontRole:
return Conf.tabular_view_font
return None
示例7: data
# 需要导入模块: from PySide2.QtCore import Qt [as 别名]
# 或者: from PySide2.QtCore.Qt import DisplayRole [as 别名]
def data(self, index, role=None) -> Any:
if not index.isValid():
return None
row = index.row()
if row >= len(self.values):
return None
col = index.column()
v = self.values[row]
if role == Qt.DisplayRole:
return self._get_column_text(v, col)
elif role == Qt.FontRole:
return Conf.tabular_view_font
return None
示例8: headerData
# 需要导入模块: from PySide2.QtCore import Qt [as 别名]
# 或者: from PySide2.QtCore.Qt import DisplayRole [as 别名]
def headerData(self, section, orientation, role):
if role != Qt.DisplayRole:
return None
if orientation == Qt.Vertical:
return None
return self.columns[section]
示例9: threadRowClicked
# 需要导入模块: from PySide2.QtCore import Qt [as 别名]
# 或者: from PySide2.QtCore.Qt import DisplayRole [as 别名]
def threadRowClicked(self, index):
index = self.model.createIndex(index.row(), 0)
tid_str = self.model.data(index, Qt.DisplayRole)
#print('clicked to change to thread %s' % tid_str)
stateObj = binjaplug.get_state(self.bv)
if stateObj.connected and not stateObj.running:
tid = int(tid_str, 16)
stateObj.threads.current = tid
stateObj.ui.context_display()
stateObj.ui.on_step()
else:
print('cannot set thread in current state')
# called from plugin's context_display() function
示例10: data
# 需要导入模块: from PySide2.QtCore import Qt [as 别名]
# 或者: from PySide2.QtCore.Qt import DisplayRole [as 别名]
def data(self, index, role):
if not index.isValid():
return None
if index.row() < 0 or index.row() >= len(self.rows):
return None
info = self.rows[index.row()]
debug_state = binjaplug.get_state(self.bv)
if role == Qt.DisplayRole:
# Format data into displayable text
column = self.columns[index.column()]
if column == "Value":
conts = info['value']
if debug_state.remote_arch.endianness == Endianness.LittleEndian:
conts = conts[::-1]
text = conts.hex()
elif column == "Offset":
text = str(hex(info['offset']))
elif column == "Address":
text = str(hex(info['address']))
elif column == "References":
texts = []
for ref in info['refs']:
if ref['source'] == 'register':
register = ref['register']
if ref['dest'] == 'address':
texts.append(register)
elif ref['dest'] == 'value':
texts.append('&' + register)
text = ", ".join(texts)
else:
text = "???"
return text
elif role == Qt.UserRole:
return info['state']
return None
示例11: data
# 需要导入模块: from PySide2.QtCore import Qt [as 别名]
# 或者: from PySide2.QtCore.Qt import DisplayRole [as 别名]
def data(self, index, role=Qt.DisplayRole):
try:
monitor = self.monitors[index.row()]
except IndexError:
return
key = self._roles[role].decode()
if key in self.exposed_properties:
return self.exposed_properties[key](monitor)
示例12: data
# 需要导入模块: from PySide2.QtCore import Qt [as 别名]
# 或者: from PySide2.QtCore.Qt import DisplayRole [as 别名]
def data(self, index, role=Qt.DisplayRole):
if role == Qt.CheckStateRole:
return None
if role == Qt.FontRole:
return QFont(self.font_name, self.font_size)
size = len(self.stack)
if 0 == size or size < index.row():
return
return hex(self.stack[index.row()][index.column()])
示例13: headerData
# 需要导入模块: from PySide2.QtCore import Qt [as 别名]
# 或者: from PySide2.QtCore.Qt import DisplayRole [as 别名]
def headerData(self, section, orientation, role=Qt.DisplayRole):
if orientation == Qt.Orientation.Vertical:
return None
if role != Qt.DisplayRole:
return None
return ['Address', 'Value'][
section
]
示例14: data
# 需要导入模块: from PySide2.QtCore import Qt [as 别名]
# 或者: from PySide2.QtCore.Qt import DisplayRole [as 别名]
def data(self, index, role=Qt.DisplayRole):
if role == Qt.CheckStateRole:
return None
if role == Qt.FontRole:
return QFont(self.font_name, self.font_size)
memory = self.view.session_data.get('emulator.memory')
if memory is None:
return
row = memory[index.row()]
if index.column() == 0:
return hex(row.start)
elif index.column() == 1:
return hex(row.end)
elif index.column() == 2:
return hex(row.data_offset)
elif index.column() == 3:
return hex(row.data_length)
elif index.column() == 4:
return (
f'{"r" if row.readable else "-"}'
f'{"w" if row.writable else "-"}'
f'{"x" if row.executable else "-"}'
)
示例15: headerData
# 需要导入模块: from PySide2.QtCore import Qt [as 别名]
# 或者: from PySide2.QtCore.Qt import DisplayRole [as 别名]
def headerData(self, section, orientation, role=Qt.DisplayRole):
if orientation == Qt.Orientation.Vertical:
return None
if role != Qt.DisplayRole:
return None
return ['Start', 'End', 'Data Offset', 'Data Length', 'Flags'][
section
]