Select Git revision
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
CallTreeModel.cpp 7.48 KiB
/***************************************************************************
* Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). *
* All rights reserved. *
* Contact: Nokia Corporation (qt-info@nokia.com) *
* *
* 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 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <QtGui>
#include <klocale.h>
#include "CallTreeModel.h"
#include "CallTreeItem.h"
CallTreeModel::CallTreeModel(QObject *parent)
: QAbstractItemModel(parent),
rootItem(0)
{
QStringList data = QString("Calls").split("\n");
QVector<QVariant> rootData;
rootData << i18n("Calls");
rootItem = new CallTreeItem(rootData, 0);
setupModelData(data, rootItem);
}
CallTreeModel::~CallTreeModel()
{
if(rootItem)
{
delete rootItem;
}
}
int CallTreeModel::columnCount(const QModelIndex & /* parent */) const
{
return rootItem->columnCount();
}
QVariant CallTreeModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid())
{
return QVariant();
}
if (role != Qt::DisplayRole && role != Qt::EditRole)
{
return QVariant();
}
CallTreeItem *item = getItem(index);
return item->data(index.column());
}