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

Method data

ui/breakpointswidget.cpp:88–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86
87
88QVariant DebugBreakpointsListModel::data(const QModelIndex& index, int role) const
89{
90 if (index.column() >= columnCount() || (size_t)index.row() >= m_items.size())
91 return QVariant();
92
93 BreakpointItem* item = static_cast<BreakpointItem*>(index.internalPointer());
94 if (!item)
95 return QVariant();
96
97 if ((role != Qt::DisplayRole) && (role != Qt::SizeHintRole))
98 return QVariant();
99
100 switch (index.column())
101 {
102// case DebugBreakpointsListModel::EnabledColumn:
103// {
104// QString text = item->enabled() ? "true" : "false";
105// return QVariant(text);
106// }
107 case DebugBreakpointsListModel::LocationColumn:
108 {
109 QString text;
110 if (item->location().module == "")
111 {
112 text = QString::fromStdString(fmt::format("0x{:x}", item->location().offset));
113 }
114 else
115 {
116 // TODO: This should probably be done at the API level, e.g., also returning a short name of the module
117 QFileInfo fileInfo(QString::fromStdString(item->location().module));
118 auto fileName = fileInfo.fileName();
119 text = QString::fromStdString(fmt::format("{} + 0x{:x}", fileName.toStdString(), item->location().offset));
120 }
121
122 if (role == Qt::SizeHintRole)
123 return QVariant((qulonglong)text.size());
124
125 return QVariant(text);
126 }
127 case DebugBreakpointsListModel::AddressColumn:
128 {
129 QString text = QString::fromStdString(fmt::format("0x{:x}", item->address()));
130 if (role == Qt::SizeHintRole)
131 return QVariant((qulonglong)text.size());
132
133 return QVariant(text);
134 }
135 }
136 return QVariant();
137}
138
139
140QVariant DebugBreakpointsListModel::headerData(int column, Qt::Orientation orientation, int role) const

Callers 2

paintMethod · 0.45
sizeHintMethod · 0.45

Calls 4

rowMethod · 0.80
sizeMethod · 0.80
locationMethod · 0.80
addressMethod · 0.45

Tested by

no test coverage detected