14 if (role != Qt::DisplayRole)
17 if (orientation == Qt::Horizontal)
43 return QString(
"%1").arg(section);
75 if (role == Qt::DisplayRole)
77 switch (
index.column())
80 return (
int)log.
count;
105 else if (role == Qt::ForegroundRole)
110 return QBrush(QColor::fromRgb(50, 50, 50));
112 return QBrush(QColor::fromRgb(0, 0, 255));
114 return QBrush(QColor::fromRgb(240, 120, 0));
116 return QBrush(QColor::fromRgb(255, 0, 0));
119 else if (role == Qt::UserRole)
121 switch (
index.column())
124 return (
int)log.
count;
127 return QVariant(usec);
153 case rosgraph_msgs::Log::DEBUG:
156 case rosgraph_msgs::Log::INFO:
159 case rosgraph_msgs::Log::WARN:
162 case rosgraph_msgs::Log::ERROR:
169 QString node_name = QString::fromStdString(log.name);
174 auto inserted_ret =
_node_list.insert(node_name);
175 node_it = inserted_ret.first;
177 item.
node = &(*node_it);
179 QString source_name(log.file.c_str());
180 source_name += (
" ");
181 source_name += QString::fromStdString(log.function);
182 source_name += (
":");
183 source_name += QString::number(log.line);
190 source_it = inserted_ret.first;
192 item.
source = &(*source_it);
194 item.
message = log.msg.c_str();
209 this->beginRemoveRows(QModelIndex(), 0, 0);
210 this->endRemoveRows();
214 this->beginInsertRows(QModelIndex(),
_logs.size() - 1,
_logs.size() - 1);
215 this->endInsertRows();
220 size_t old_size =
_logs.size();
221 size_t new_size = old_size + pushed_logs.size();
223 int to_add = pushed_logs.size();
233 const size_t last_row = new_size - 1;
234 const size_t first_row = new_size - pushed_logs.size();
236 for (
int i = 0;
i < pushed_logs.size();
i++)
242 [](
const LogItem& a,
const LogItem& b) { return a.time_usec_since_epoch < b.time_usec_since_epoch; });
246 this->beginRemoveRows(QModelIndex(), 0, 0);
247 this->endRemoveRows();
252 this->beginInsertRows(QModelIndex(), first_row, last_row);
253 this->endInsertRows();
273 std::chrono::microseconds since_epoch(
_logs[
index].time_usec_since_epoch);
279 this->beginRemoveRows(QModelIndex(), 0,
_logs.size() - 1);
280 this->endRemoveRows();