MCPcopy Create free account
hub / github.com/Vector35/debugger / data

Method data

ui/moduleswidget.cpp:95–151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93
94
95QVariant DebugModulesListModel::data(const QModelIndex& index, int role) const
96{
97 if (index.column() >= columnCount() || (size_t)index.row() >= m_items.size())
98 return QVariant();
99
100 ModuleItem* item = static_cast<ModuleItem*>(index.internalPointer());
101 if (!item)
102 return QVariant();
103
104 if ((role != Qt::DisplayRole) && (role != Qt::SizeHintRole) && (role != SortFilterRole))
105 return QVariant();
106
107 switch (index.column())
108 {
109 case DebugModulesListModel::AddressColumn:
110 {
111 QString text = QString::asprintf("0x%" PRIx64, item->address());
112 if (role == Qt::SizeHintRole)
113 return QVariant((qulonglong)text.size());
114
115 return QVariant(text);
116 }
117 case DebugModulesListModel::EndAddressColumn:
118 {
119 QString text = QString::asprintf("0x%" PRIx64, item->endAddress());
120 if (role == Qt::SizeHintRole)
121 return QVariant((qulonglong)text.size());
122
123 return QVariant(text);
124 }
125 case DebugModulesListModel::SizeColumn:
126 {
127 QString text = QString::asprintf("0x%" PRIx64, (uint64_t)item->size());
128 if (role == Qt::SizeHintRole)
129 return QVariant((qulonglong)text.size());
130
131 return QVariant(text);
132 }
133 case DebugModulesListModel::NameColumn:
134 {
135 QString text = QString::fromStdString(item->name());
136 if (role == Qt::SizeHintRole)
137 return QVariant((qulonglong)text.size());
138
139 return QVariant(text);
140 }
141 case DebugModulesListModel::PathColumn:
142 {
143 QString text = QString::fromStdString(item->path());
144 if (role == Qt::SizeHintRole)
145 return QVariant((qulonglong)text.size());
146
147 return QVariant(text);
148 }
149 }
150 return QVariant();
151}
152

Callers 3

paintMethod · 0.45
sizeHintMethod · 0.45
filterAcceptsRowMethod · 0.45

Calls 6

rowMethod · 0.80
sizeMethod · 0.80
endAddressMethod · 0.80
pathMethod · 0.80
addressMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected