X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fuisupport%2Fnickview.cpp;h=11b40c72b3bde2267a15fc9e73019b017c4f9843;hp=bbb36a75081bf9e2ffea3e93dbe68f56c609f854;hb=f0502bc0352f04ba9146601f802ddeed8a9b907b;hpb=c14a00f37179e49f034dc64b4da0c86b51caed5d diff --git a/src/uisupport/nickview.cpp b/src/uisupport/nickview.cpp index bbb36a75..11b40c72 100644 --- a/src/uisupport/nickview.cpp +++ b/src/uisupport/nickview.cpp @@ -34,7 +34,6 @@ #include "nickviewfilter.h" #include "networkmodel.h" #include "types.h" -#include "uisettings.h" class ExpandAllEvent : public QEvent { public: @@ -44,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(); @@ -67,10 +61,6 @@ NickView::NickView(QWidget *parent) // afaik this is better on Mac and Windows connect(this, SIGNAL(activated(QModelIndex)), SLOT(startQuery(QModelIndex))); #endif - - UiStyleSettings s("QtUiStyle/Fonts"); // li'l dirty here, but fonts are stored in QtUiStyle :/ - s.notify("BufferView", this, SLOT(setCustomFont(QVariant))); // yes, we share the BufferView settings - setCustomFont(s.value("BufferView", QFont())); } void NickView::init() { @@ -92,13 +82,6 @@ void NickView::setModel(QAbstractItemModel *model_) { init(); } -void NickView::setCustomFont(const QVariant &v) { - QFont font = v.value(); - if(font.family().isEmpty()) - font = QApplication::font(); - setFont(font); -} - void NickView::rowsInserted(const QModelIndex &parent, int start, int end) { QTreeView::rowsInserted(parent, start, end); if(model()->data(parent, NetworkModel::ItemTypeRole) == NetworkModel::UserCategoryItemType && !isExpanded(parent)) { @@ -161,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()); @@ -175,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); -}