MCPcopy Create free account
hub / github.com/ElementsProject/elements / data

Method data

src/qt/bantablemodel.cpp:113–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111}
112
113QVariant BanTableModel::data(const QModelIndex &index, int role) const
114{
115 if(!index.isValid())
116 return QVariant();
117
118 CCombinedBan *rec = static_cast<CCombinedBan*>(index.internalPointer());
119
120 const auto column = static_cast<ColumnIndex>(index.column());
121 if (role == Qt::DisplayRole) {
122 switch (column) {
123 case Address:
124 return QString::fromStdString(rec->subnet.ToString());
125 case Bantime:
126 QDateTime date = QDateTime::fromMSecsSinceEpoch(0);
127 date = date.addSecs(rec->banEntry.nBanUntil);
128 return QLocale::system().toString(date, QLocale::LongFormat);
129 } // no default case, so the compiler can warn about missing cases
130 assert(false);
131 }
132
133 return QVariant();
134}
135
136QVariant BanTableModel::headerData(int section, Qt::Orientation orientation, int role) const
137{

Callers

nothing calls this directly

Calls 2

isValidMethod · 0.45
ToStringMethod · 0.45

Tested by

no test coverage detected