X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fuisupport%2Fnickview.cpp;h=6d3f39818aa88e2b10194dd696384d388c1181c0;hp=1a1c4bbaf9b966ee6732fb8dd11f487b109478cd;hb=df38e82953be7b676871f7215053a005decb90d1;hpb=32a1f050b3292478f3b130c16ad66f22e6eb25c8 diff --git a/src/uisupport/nickview.cpp b/src/uisupport/nickview.cpp index 1a1c4bba..6d3f3981 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(); @@ -104,9 +99,10 @@ QModelIndexList NickView::selectedIndexes() const { QModelIndexList indexList = QTreeView::selectedIndexes(); // make sure the item we clicked on is first - Q_ASSERT(indexList.contains(currentIndex())); - indexList.removeAll(currentIndex()); - indexList.prepend(currentIndex()); + if(indexList.contains(currentIndex())) { + indexList.removeAll(currentIndex()); + indexList.prepend(currentIndex()); + } return indexList; } @@ -162,28 +158,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); -}