Nepomuk
resourcemodel.h
Go to the documentation of this file.
00001 /* 00002 This file is part of the Nepomuk KDE project. 00003 Copyright (C) 2007-2010 Sebastian Trueg <trueg@kde.org> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation; either 00008 version 2.1 of the License, or (at your option) version 3, or any 00009 later version accepted by the membership of KDE e.V. (or its 00010 successor approved by the membership of KDE e.V.), which shall 00011 act as a proxy defined in Section 6 of version 3 of the license. 00012 00013 This library is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 Lesser General Public License for more details. 00017 00018 You should have received a copy of the GNU Lesser General Public 00019 License along with this library. If not, see <http://www.gnu.org/licenses/>. 00020 */ 00021 00022 #ifndef _NEPOMUK_RESOUCE_MODEL_H_ 00023 #define _NEPOMUK_RESOUCE_MODEL_H_ 00024 00025 #include <QtCore/QAbstractItemModel> 00026 00027 #include "nepomukutils_export.h" 00028 00029 namespace Nepomuk { 00030 00031 class Resource; 00032 00033 namespace Utils { 00057 class NEPOMUKUTILS_EXPORT ResourceModel : public QAbstractItemModel 00058 { 00059 Q_OBJECT 00060 00061 public: 00065 ResourceModel( QObject* parent = 0 ); 00066 00070 virtual ~ResourceModel(); 00071 00076 enum ResourceModelColumns { 00078 ResourceColumn = 0, 00079 00081 ResourceTypeColumn = 1, 00082 00084 ResourceModelColumnCount = 2 00085 }; 00086 00090 enum ResourceRoles { 00094 ResourceRole = 7766897, 00095 00100 ResourceTypeRole = 687585, 00101 00105 ResourceCreationDateRole = 7766898 00106 }; 00107 00114 virtual Resource resourceForIndex( const QModelIndex& index ) const = 0; 00115 00122 virtual QModelIndex indexForResource( const Resource& res ) const = 0; 00123 00128 virtual QModelIndex parent( const QModelIndex& child ) const; 00129 00134 virtual int columnCount( const QModelIndex& parent ) const; 00135 00141 virtual QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const; 00142 00146 virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; 00147 00151 virtual Qt::ItemFlags flags( const QModelIndex& index ) const; 00152 00158 virtual QMimeData* mimeData( const QModelIndexList& indexes ) const; 00159 00163 virtual QStringList mimeTypes() const; 00164 00168 virtual bool setData( const QModelIndex& index, const QVariant& value, int role ); 00169 00170 private: 00171 class Private; 00172 Private* const d; 00173 }; 00174 } 00175 } 00176 00177 #endif
KDE 4.6 API Reference