Add some conveniences.

svn path=/trunk/KDE/kdebase/apps/; revision=649451
This commit is contained in:
Kevin Ottens 2007-04-02 17:31:38 +00:00
parent cebf9958fd
commit c2c6f743a5
2 changed files with 13 additions and 0 deletions

View file

@ -89,6 +89,16 @@ bool KFilePlacesModel::mountNeeded(const QModelIndex &index) const
return data(index, MountNeededRole).toBool();
}
KIcon KFilePlacesModel::icon(const QModelIndex &index) const
{
return KIcon(data(index, Qt::DecorationRole).value<QIcon>());
}
QString KFilePlacesModel::text(const QModelIndex &index) const
{
return data(index, Qt::DisplayRole).toString();
}
QVariant KFilePlacesModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid())

View file

@ -23,6 +23,7 @@
#include <QAbstractItemModel>
#include <kurl.h>
#include <kicon.h>
/**
* This class is a list view model. Each entry represents a "place"
@ -44,6 +45,8 @@ public:
KUrl url(const QModelIndex &index) const;
bool mountNeeded(const QModelIndex &index) const;
KIcon icon(const QModelIndex &index) const;
QString text(const QModelIndex &index) const;
/**
* @brief Get a visible data based on Qt role for the given index.