mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-17 15:31:20 +00:00
Add some conveniences.
svn path=/trunk/KDE/kdebase/apps/; revision=649451
This commit is contained in:
parent
cebf9958fd
commit
c2c6f743a5
|
@ -89,6 +89,16 @@ bool KFilePlacesModel::mountNeeded(const QModelIndex &index) const
|
||||||
return data(index, MountNeededRole).toBool();
|
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
|
QVariant KFilePlacesModel::data(const QModelIndex &index, int role) const
|
||||||
{
|
{
|
||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
#include <QAbstractItemModel>
|
#include <QAbstractItemModel>
|
||||||
#include <kurl.h>
|
#include <kurl.h>
|
||||||
|
#include <kicon.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is a list view model. Each entry represents a "place"
|
* This class is a list view model. Each entry represents a "place"
|
||||||
|
@ -44,6 +45,8 @@ public:
|
||||||
|
|
||||||
KUrl url(const QModelIndex &index) const;
|
KUrl url(const QModelIndex &index) const;
|
||||||
bool mountNeeded(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.
|
* @brief Get a visible data based on Qt role for the given index.
|
||||||
|
|
Loading…
Reference in a new issue