31 QSortFilterProxyModel(pp) {
34 LogViewProxyModel::~LogViewProxyModel() {
38 QRegExp logLevel(
"\\((\\w+)\\).*");
41 if (logLevel.exactMatch(
42 QSortFilterProxyModel::data(idx,Qt::DisplayRole).toString())) {
43 QString level = logLevel.cap(1);
45 return QString(
"debug");
47 else if (level ==
"II") {
48 return QString(
"info");
50 else if (level ==
"WW") {
51 return QString(
"warning");
53 else if (level ==
"EE") {
54 return QString(
"error");
57 return QString(
"normal");
61 case Qt::ForegroundRole:
62 if (logLevel.exactMatch(
63 QSortFilterProxyModel::data(idx,Qt::DisplayRole).toString())) {
64 QString level = logLevel.cap(1);
66 return QBrush(QColor(
"#AAA"));
68 else if (level ==
"II") {
69 return QBrush(QColor(
"#777"));
71 else if (level ==
"WW") {
72 return QBrush(QColor(
"#F70"));
76 case Qt::BackgroundRole:
77 if (logLevel.exactMatch(
78 QSortFilterProxyModel::data(idx,Qt::DisplayRole).toString())) {
79 QString level = logLevel.cap(1);
81 return QBrush(QColor(
"#F87"));
89 return QSortFilterProxyModel::data(idx,rr);
93 return QRegExp(
"^\\((?!DD)|^(?!\\()");
Declaration of class LogViewProxyModel.
static QRegExp debugFilterRegex()
regexp for filtering out debug lines
LogViewProxyModel(QObject *parent=0)
constructor
virtual QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
handle highlighting