X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fclient%2Ftreemodel.cpp;h=892ad5c8fcd0b84109ff7cf8e84036f897c8eb00;hb=91e27ef1628b352e1f905b5811cb036442e68242;hp=220c843f8bb234506c7bfa6ee44034eb22e9f900;hpb=52f0d47d0cb1932c9e86ebb75cdd4dd0d625dd6f;p=quassel.git diff --git a/src/client/treemodel.cpp b/src/client/treemodel.cpp index 220c843f..892ad5c8 100644 --- a/src/client/treemodel.cpp +++ b/src/client/treemodel.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2015 by the Quassel Project * + * Copyright (C) 2005-2018 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -275,21 +275,8 @@ int SimpleTreeItem::columnCount() const /***************************************** * PropertyMapItem *****************************************/ -PropertyMapItem::PropertyMapItem(const QStringList &propertyOrder, AbstractTreeItem *parent) - : AbstractTreeItem(parent), - _propertyOrder(propertyOrder) -{ -} - - PropertyMapItem::PropertyMapItem(AbstractTreeItem *parent) - : AbstractTreeItem(parent), - _propertyOrder(QStringList()) -{ -} - - -PropertyMapItem::~PropertyMapItem() + : AbstractTreeItem(parent) { } @@ -304,7 +291,7 @@ QVariant PropertyMapItem::data(int column, int role) const return toolTip(column); case Qt::DisplayRole: case TreeModel::SortRole: // fallthrough, since SortRole should default to DisplayRole - return property(_propertyOrder[column].toLatin1()); + return property(propertyOrder()[column].toLatin1()); default: return QVariant(); } @@ -316,20 +303,15 @@ bool PropertyMapItem::setData(int column, const QVariant &value, int role) if (column >= columnCount() || role != Qt::DisplayRole) return false; + setProperty(propertyOrder()[column].toLatin1(), value); emit dataChanged(column); - return setProperty(_propertyOrder[column].toLatin1(), value); + return true; } int PropertyMapItem::columnCount() const { - return _propertyOrder.count(); -} - - -void PropertyMapItem::appendProperty(const QString &property) -{ - _propertyOrder << property; + return propertyOrder().count(); } @@ -365,6 +347,12 @@ TreeModel::~TreeModel() } +AbstractTreeItem *TreeModel::root() const +{ + return rootItem; +} + + QModelIndex TreeModel::index(int row, int column, const QModelIndex &parent) const { if (row < 0 || row >= rowCount(parent) || column < 0 || column >= columnCount(parent))