109 if (!
index.isValid())
114 if (role != Qt::DisplayRole)
119 nlohmann::json* ref = refFrom(
index);
121 if (
index.column() == 0)
123 if (!names.count(ref))
126 << (ref ? ref->dump(2) :
"(null)");
129 std::string
const& name = names.at(ref);
130 return QVariant(name.c_str());
135 case nlohmann::json::value_t::null:
136 return QVariant(
"null");
137 case nlohmann::json::value_t::object:
138 return QVariant(
"object");
139 case nlohmann::json::value_t::array:
140 return QVariant(
"array");
141 case nlohmann::json::value_t::string:
142 return QVariant(ref->get<std::string>().c_str());
143 case nlohmann::json::value_t::boolean:
144 return QVariant(ref->get<
bool>());
145 case nlohmann::json::value_t::number_integer:
146 return QVariant(ref->get<
int>());
147 case nlohmann::json::value_t::number_unsigned:
148 return QVariant(ref->get<
unsigned int>());
149 case nlohmann::json::value_t::number_float:
150 return QVariant(ref->get<
float>());
153 return QVariant(
"n/a");