Nepomuk
tagwidget.h
Go to the documentation of this file.
00001 /* 00002 * This file is part of the Nepomuk KDE project. 00003 * Copyright (C) 2006-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 Library General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Library General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Library General Public License 00016 * along with this library; see the file COPYING.LIB. If not, write to 00017 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 * Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #ifndef _NEPOMUK_TAG_WIDGET_H_ 00022 #define _NEPOMUK_TAG_WIDGET_H_ 00023 00024 #include "nepomuk_export.h" 00025 00026 #include <QtGui/QWidget> 00027 00028 namespace Nepomuk { 00029 class Resource; 00030 class Tag; 00031 class TagWidgetPrivate; 00032 00048 class NEPOMUK_EXPORT TagWidget : public QWidget 00049 { 00050 Q_OBJECT 00051 00052 public: 00057 explicit TagWidget( const Resource& resource, QWidget* parent = 0 ); 00058 00062 TagWidget( QWidget* parent = 0 ); 00063 00067 ~TagWidget(); 00068 00073 QList<Resource> taggedResources() const; 00074 00078 #ifndef KDE_NO_DEPRECATED 00079 KDE_DEPRECATED QList<Tag> assignedTags() const; 00080 #endif 00081 00093 QList<Nepomuk::Tag> selectedTags() const; 00094 00105 int maxTagsShown() const; 00106 00112 Qt::Alignment alignment() const; 00113 00119 enum ModeFlag { 00125 MiniMode = 0x1, 00126 00132 StandardMode = 0x2, 00133 00138 ReadOnly = 0x4, 00139 00145 DisableTagClicking = 0x8 00146 }; 00147 Q_DECLARE_FLAGS( ModeFlags, ModeFlag ) 00148 00149 00156 ModeFlags modeFlags() const; 00157 00158 Q_SIGNALS: 00162 void tagClicked( Nepomuk::Tag ); 00163 00169 void selectionChanged( const QList<Nepomuk::Tag>& tags ); 00170 00171 public Q_SLOTS: 00176 void setTaggedResource( const Resource& resource ); 00177 00182 void setTaggedResources( const QList<Resource>& resources ); 00183 00187 #ifndef KDE_NO_DEPRECATED 00188 KDE_DEPRECATED void setAssignedTags( const QList<Nepomuk::Tag>& tags ); 00189 #endif 00190 00198 void setSelectedTags( const QList<Nepomuk::Tag>& tags ); 00199 00212 void setMaxTagsShown( int max ); 00213 00220 void setAlignment( Qt::Alignment alignment ); 00221 00227 void setModeFlags( ModeFlags flags ); 00228 00229 private Q_SLOTS: 00230 void slotShowAll(); 00231 void slotTagUpdateDone(); 00232 void slotTagStateChanged( const Nepomuk::Tag&, int ); 00233 00234 private: 00235 TagWidgetPrivate* const d; 00236 }; 00237 } 00238 00239 Q_DECLARE_OPERATORS_FOR_FLAGS( Nepomuk::TagWidget::ModeFlags ) 00240 00241 #endif
KDE 4.6 API Reference