Baloo Widgets

tagwidget.h
1 /*
2  * This file is part of the Baloo KDE project.
3  * Copyright (C) 2006-2010 Sebastian Trueg <[email protected]>
4  * Copyright (C) 2013 Vishesh Handa <[email protected]>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public License
17  * along with this library; see the file COPYING.LIB. If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  */
21 
22 #ifndef _BALOO_TAG_WIDGET_H_
23 #define _BALOO_TAG_WIDGET_H_
24 
25 #include "widgets_export.h"
26 
27 #include <QWidget>
28 
29 namespace Baloo {
30  class TagWidgetPrivate;
31 
32  /**
33  * \class TagWidget tagwidget.h
34  *
35  * \brief Allows to change a selection of tags.
36  *
37  * TagWidget provides a simple GUI interface to assign tags.
38  *
39  * \author Sebastian Trueg <[email protected]>
40  */
41  class BALOO_WIDGETS_EXPORT TagWidget : public QWidget
42  {
43  Q_OBJECT
44 
45  public:
46  /**
47  * Constructor
48  */
49  explicit TagWidget(QWidget* parent = nullptr);
50 
51  /**
52  * Destructor
53  */
54  ~TagWidget() override;
55 
56  /**
57  * The list of selected tags.
58  *
59  * \return The list of all tags that are currently selected. In case
60  * resources to be tagged have been selected this list matches the
61  * tags assigned to the resources.
62  *
63  * \since 4.5
64  */
65  QStringList selectedTags() const;
66 
67  /**
68  * The alignment of the tags in the widget.
69  *
70  * \since 4.5
71  */
72  Qt::Alignment alignment() const;
73 
74  /**
75  * If the widget is read only
76  */
77  bool readOnly() const;
78 
79  Q_SIGNALS:
80  /**
81  * This signal is emitted whenever a tag is clicked.
82  */
83  void tagClicked(const QString&);
84 
85  /**
86  * Emitted whenever the selection of tags changes.
87  *
88  * \since 4.5
89  */
90  void selectionChanged(const QStringList& tags);
91 
92  public Q_SLOTS:
93  /**
94  * Set the list of selected tags. In case resources have been
95  * set via setTaggedResource() or setTaggedResources() their
96  * list of tags is changed automatically.
97  *
98  * \since 4.5
99  */
100  void setSelectedTags(const QStringList& tags);
101 
102  /**
103  * Set the alignment to use. Only horizontal alignment flags make a
104  * difference.
105  *
106  * \since 4.5
107  */
108  void setAlignment( Qt::Alignment alignment );
109 
110  /**
111  * Set the TagWidget as read only
112  */
113  void setReadyOnly(bool readOnly = true);
114 
115  private Q_SLOTS:
116  void slotShowAll();
117  void slotTagUpdateDone();
118  void slotKEditTagDialogFinished( int result );
119 
120  private:
121  TagWidgetPrivate* const d;
122  };
123 }
124 
125 #endif
typedef Alignment
Allows to change a selection of tags.
Definition: tagwidget.h:41
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Thu Oct 21 2021 23:07:11 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.