Skip to content
Snippets Groups Projects
Select Git revision
  • 49f1b578d72039540f6d18c24611b89d98ff5344
  • master default protected
  • release/201811
  • release/201812
  • release/201901
  • release/201902
  • release/201903
  • release/201904
  • release/201905
  • release/201906
  • release/201908
  • release/201912
  • release/202001
  • release/202005
  • release/windows-test/201910
  • release/201808
  • wip/smartlist_refacto
  • wip/patches_poly_2017/JimmyHamel/MathieuGirouxHuppe
18 results

RingD.cpp

Blame
  • 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());
    }