MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / data

Method data

src/qt/addresstablemodel.cpp:186–231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

184}
185
186QVariant AddressTableModel::data(const QModelIndex &index, int role) const
187{
188 if(!index.isValid())
189 return QVariant();
190
191 AddressTableEntry *rec = static_cast<AddressTableEntry*>(index.internalPointer());
192
193 if(role == Qt::DisplayRole || role == Qt::EditRole)
194 {
195 switch(index.column())
196 {
197 case Label:
198 if(rec->label.isEmpty() && role == Qt::DisplayRole)
199 {
200 return tr("(no label)");
201 }
202 else
203 {
204 return rec->label;
205 }
206 case Address:
207 return rec->address;
208 }
209 }
210 else if (role == Qt::FontRole)
211 {
212 QFont font;
213 if(index.column() == Address)
214 {
215 font = GUIUtil::fixedPitchFont();
216 }
217 return font;
218 }
219 else if (role == TypeRole)
220 {
221 switch(rec->type)
222 {
223 case AddressTableEntry::Sending:
224 return Send;
225 case AddressTableEntry::Receiving:
226 return Receive;
227 default: break;
228 }
229 }
230 return QVariant();
231}
232
233bool AddressTableModel::setData(const QModelIndex &index, const QVariant &value, int role)
234{

Callers

nothing calls this directly

Calls 2

fixedPitchFontFunction · 0.85
isValidMethod · 0.45

Tested by

no test coverage detected