X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fuisupport%2Fnickview.cpp;h=11b40c72b3bde2267a15fc9e73019b017c4f9843;hp=e27640e3891272893e0efacc3660b13cf564bd6f;hb=f7d920731ede8ab4d597a783502875b23d96c6e7;hpb=982359db5545edf340a246cd13dfcdc9bf2ccf33 diff --git a/src/uisupport/nickview.cpp b/src/uisupport/nickview.cpp index e27640e3..11b40c72 100644 --- a/src/uisupport/nickview.cpp +++ b/src/uisupport/nickview.cpp @@ -20,6 +20,7 @@ #include "nickview.h" +#include #include #include #include @@ -33,7 +34,6 @@ #include "nickviewfilter.h" #include "networkmodel.h" #include "types.h" -#include "uisettings.h" class ExpandAllEvent : public QEvent { public: @@ -43,11 +43,6 @@ public: NickView::NickView(QWidget *parent) : QTreeView(parent) { - QAbstractItemDelegate *oldDelegate = itemDelegate(); - NickViewDelegate *newDelegate = new NickViewDelegate(this); - setItemDelegate(newDelegate); - delete oldDelegate; - setIndentation(10); setAnimated(true); header()->hide(); @@ -149,6 +144,9 @@ void NickView::customEvent(QEvent *event) { if(event->type() != QEvent::User) return; + if(!model()) + return; + QModelIndex topLevelIdx; for(int i = 0; i < model()->rowCount(rootIndex()); i++) { topLevelIdx = model()->index(i, 0, rootIndex()); @@ -163,28 +161,3 @@ void NickView::customEvent(QEvent *event) { } event->accept(); } - - -// **************************************** -// NickViewDelgate -// **************************************** -NickViewDelegate::NickViewDelegate(QObject *parent) - : QStyledItemDelegate(parent) -{ - UiSettings s("QtUiStyle/Colors"); - _FgOnlineStatus = s.value("onlineStatusFG", QVariant(QColor(Qt::black))).value(); - _FgAwayStatus = s.value("awayStatusFG", QVariant(QColor(Qt::gray))).value(); -} - -void NickViewDelegate::initStyleOption(QStyleOptionViewItem *option, const QModelIndex &index) const { - QStyledItemDelegate::initStyleOption(option, index); - - if(!index.isValid()) - return; - - QColor fgColor = _FgOnlineStatus; - if(!index.data(NetworkModel::ItemActiveRole).toBool()) - fgColor = _FgAwayStatus; - - option->palette.setColor(QPalette::Text, fgColor); -}