X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fuisupport%2Fnickview.cpp;h=b3efda427d226895b36b832c0300f71ab4f028f1;hb=d5b27b7809e49a426adac9e5d9a8f8ad4f85eb74;hp=26a345dfdfe3aa8b0a90113fb16f79f2f888cb5d;hpb=e671e9da1edaab37ec403f575979f9a92a766e9a;p=quassel.git diff --git a/src/uisupport/nickview.cpp b/src/uisupport/nickview.cpp index 26a345df..b3efda42 100644 --- a/src/uisupport/nickview.cpp +++ b/src/uisupport/nickview.cpp @@ -1,11 +1,11 @@ /*************************************************************************** - * Copyright (C) 2005-07 by the Quassel IRC Team * + * Copyright (C) 2005-08 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * + * (at your option) version 3. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * @@ -21,19 +21,39 @@ #include "nickview.h" #include "nickmodel.h" - -NickView::NickView(QWidget *parent) : QTreeView(parent) { - setGeometry(0, 0, 30, 30); - //setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); - - +#include +#include + +NickView::NickView(QWidget *parent) + : QTreeView(parent) +{ + setIndentation(10); + setAnimated(true); + header()->hide(); + setSortingEnabled(true); + sortByColumn(0, Qt::AscendingOrder); } NickView::~NickView() { +} +void NickView::init() { + if(!model()) + return; + for(int i = 1; i < model()->columnCount(); i++) + setColumnHidden(i, true); + + expandAll(); } -void NickView::setModel(NickModel *model) { +void NickView::setModel(QAbstractItemModel *model) { QTreeView::setModel(model); + init(); +} + +void NickView::rowsInserted(const QModelIndex &index, int start, int end) { + QTreeView::rowsInserted(index, start, end); + expandAll(); // FIXME We need to do this more intelligently. Maybe a pimped TreeView? } +