foldermodel.cpp Example File
messagenavigator/foldermodel.cpp
#include "foldermodel.h"
#include <QIcon>
#include <QMailStore>
#include <QMailAccountMessageSet>
FolderModel::FolderModel(QObject *parent)
: QMailMessageSetModel(parent)
{
foreach (const QMailAccountId &id, QMailStore::instance()->queryAccounts())
append(new QMailAccountMessageSet(this, id, true));
}
FolderModel::~FolderModel()
{
}
QVariant FolderModel::data(QMailMessageSet* item, int role, int column) const
{
if (role == Qt::DecorationRole) {
if (qobject_cast<QMailAccountMessageSet*>(item)) {
return QIcon(":icon/qtmail/account");
} else {
return QIcon(":icon/folder");
}
} else {
return QMailMessageSetModel::data(item, role, column);
}
}
Copyright © 2009 Trolltech |
Trademarks |
Qt Extended 4.4.3 |