Nepomuk
facetmodel.h
Go to the documentation of this file.
00001 /* 00002 This file is part of the Nepomuk KDE project. 00003 Copyright (C) 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_QUERY_FACET_MODEL_H_ 00023 #define _NEPOMUK_QUERY_FACET_MODEL_H_ 00024 00025 #include "query.h" 00026 #include "term.h" 00027 #include "nepomukutils_export.h" 00028 00029 #include <QtCore/QAbstractItemModel> 00030 #include <QtCore/QList> 00031 00032 namespace Nepomuk { 00033 namespace Utils { 00034 class Facet; 00035 00067 class NEPOMUKUTILS_EXPORT FacetModel : public QAbstractItemModel 00068 { 00069 Q_OBJECT 00070 00071 public: 00075 FacetModel( QObject* parent = 0 ); 00076 00080 ~FacetModel(); 00081 00088 enum CustomRoles { 00093 FacetRole = 235265643 00094 }; 00095 00099 int columnCount( const QModelIndex& parent = QModelIndex() ) const; 00100 00104 QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const; 00105 00109 bool setData( const QModelIndex& index, const QVariant& value, int role ); 00110 00114 bool hasChildren(const QModelIndex &parent) const; 00115 00119 QModelIndex parent( const QModelIndex& index ) const; 00120 00124 int rowCount( const QModelIndex& parent = QModelIndex() ) const; 00125 00129 QModelIndex index( int row, int column, const QModelIndex& parent = QModelIndex() ) const; 00130 00134 Qt::ItemFlags flags( const QModelIndex& index ) const; 00135 00139 QList<Facet*> facets() const; 00140 00146 Query::Term queryTerm() const; 00147 00148 public Q_SLOTS: 00170 Nepomuk::Query::Query extractFacetsFromQuery( const Nepomuk::Query::Query& query ); 00171 00186 void setClientQuery( const Nepomuk::Query::Query& query ); 00187 00192 void addFacet( Nepomuk::Utils::Facet* facet ); 00193 00198 void setFacets( const QList<Nepomuk::Utils::Facet*>& facets ); 00199 00204 void clearSelection(); 00205 00209 void clear(); 00210 00211 Q_SIGNALS: 00216 void queryTermChanged( const Nepomuk::Query::Term& term ); 00217 00218 private: 00219 class Private; 00220 Private* const d; 00221 00222 Q_PRIVATE_SLOT( d, void _k_queryTermChanged() ) 00223 Q_PRIVATE_SLOT( d, void _k_facetSelectionChanged( Nepomuk::Utils::Facet* ) ) 00224 Q_PRIVATE_SLOT( d, void _k_facetLayoutChanged( Nepomuk::Utils::Facet* ) ) 00225 }; 00226 } 00227 } 00228 00229 Q_DECLARE_METATYPE( Nepomuk::Utils::Facet* ) 00230 00231 #endif
KDE 4.6 API Reference