當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。