MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / createEditor

Method createEditor

pcsx2-qt/Debugger/SymbolTree/SymbolTreeDelegates.cpp:23–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21}
22
23QWidget* SymbolTreeValueDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const
24{
25 if (!index.isValid())
26 return nullptr;
27
28 const SymbolTreeModel* tree_model = qobject_cast<const SymbolTreeModel*>(index.model());
29 if (!tree_model)
30 return nullptr;
31
32 const SymbolTreeDisplayOptions& display_options = tree_model->displayOptions();
33
34 SymbolTreeNode* node = tree_model->nodeFromIndex(index);
35 if (!node || !node->type.valid())
36 return nullptr;
37
38 QWidget* result = nullptr;
39 m_cpu.GetSymbolGuardian().Read([&](const ccc::SymbolDatabase& database) {
40 const ccc::ast::Node* logical_type = node->type.lookup_node(database);
41 if (!logical_type)
42 return;
43
44 const ccc::ast::Node& physical_type = *logical_type->physical_type(database).first;
45 QVariant value = node->readValueAsVariant(physical_type, m_cpu, database);
46
47 const ccc::ast::Node& type = *logical_type->physical_type(database).first;
48 switch (type.descriptor)
49 {
50 case ccc::ast::BUILTIN:
51 {
52 const ccc::ast::BuiltIn& builtin = type.as<ccc::ast::BuiltIn>();
53
54 switch (builtin.bclass)
55 {
56 case ccc::ast::BuiltInClass::UNSIGNED_8:
57 case ccc::ast::BuiltInClass::UNQUALIFIED_8:
58 case ccc::ast::BuiltInClass::UNSIGNED_16:
59 case ccc::ast::BuiltInClass::UNSIGNED_32:
60 case ccc::ast::BuiltInClass::UNSIGNED_64:
61 {
62 SymbolTreeIntegerLineEdit* editor = new SymbolTreeIntegerLineEdit(
63 display_options, ccc::ast::builtin_class_size(builtin.bclass) * 8, parent);
64 editor->setUnsignedValue(value.toULongLong());
65 result = editor;
66
67 break;
68 }
69 case ccc::ast::BuiltInClass::SIGNED_8:
70 case ccc::ast::BuiltInClass::SIGNED_16:
71 case ccc::ast::BuiltInClass::SIGNED_32:
72 case ccc::ast::BuiltInClass::SIGNED_64:
73 {
74 SymbolTreeIntegerLineEdit* editor = new SymbolTreeIntegerLineEdit(
75 display_options, ccc::ast::builtin_class_size(builtin.bclass) * 8, parent);
76 editor->setSignedValue(value.toLongLong());
77 result = editor;
78
79 break;
80 }

Callers

nothing calls this directly

Calls 13

builtin_class_sizeFunction · 0.85
isValidMethod · 0.80
nodeFromIndexMethod · 0.80
lookup_nodeMethod · 0.80
physical_typeMethod · 0.80
readValueAsVariantMethod · 0.80
setUnsignedValueMethod · 0.80
setSignedValueMethod · 0.80
signedIntegerToStringMethod · 0.80
is_flag_setMethod · 0.80
validMethod · 0.45
ReadMethod · 0.45

Tested by

no test coverage detected