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


Python Qt.DisplayRole方法代码示例

本文整理汇总了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 
开发者ID:Vector35,项目名称:debugger,代码行数:25,代码来源:ModulesWidget.py

示例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 
开发者ID:Vector35,项目名称:debugger,代码行数:27,代码来源:ThreadsWidget.py

示例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 
开发者ID:Vector35,项目名称:debugger,代码行数:20,代码来源:BreakpointsWidget.py

示例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 
开发者ID:Vector35,项目名称:debugger,代码行数:23,代码来源:RegistersWidget.py

示例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]) 
开发者ID:joshwatson,项目名称:f-ing-around-with-binaryninja,代码行数:20,代码来源:registers.py

示例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 
开发者ID:angr,项目名称:angr-management,代码行数:20,代码来源:qxref_viewer.py

示例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 
开发者ID:angr,项目名称:angr-management,代码行数:18,代码来源:qstring_table.py

示例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] 
开发者ID:Vector35,项目名称:debugger,代码行数:8,代码来源:ModulesWidget.py

示例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 
开发者ID:Vector35,项目名称:debugger,代码行数:16,代码来源:ThreadsWidget.py

示例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 
开发者ID:Vector35,项目名称:debugger,代码行数:40,代码来源:StackWidget.py

示例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) 
开发者ID:bminixhofer,项目名称:permon,代码行数:11,代码来源:utils.py

示例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()]) 
开发者ID:joshwatson,项目名称:f-ing-around-with-binaryninja,代码行数:15,代码来源:stack.py

示例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
        ] 
开发者ID:joshwatson,项目名称:f-ing-around-with-binaryninja,代码行数:12,代码来源:stack.py

示例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 "-"}'
            ) 
开发者ID:joshwatson,项目名称:f-ing-around-with-binaryninja,代码行数:33,代码来源:memory.py

示例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
        ] 
开发者ID:joshwatson,项目名称:f-ing-around-with-binaryninja,代码行数:12,代码来源:memory.py


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