Baloo Widgets

tagwidget.h
1 /*
2  SPDX-FileCopyrightText: 2006-2010 Sebastian Trueg <[email protected]>
3  SPDX-FileCopyrightText: 2013 Vishesh Handa <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7 
8 #ifndef _BALOO_TAG_WIDGET_H_
9 #define _BALOO_TAG_WIDGET_H_
10 
11 #include "widgets_export.h"
12 
13 #include <QWidget>
14 
15 #include <memory>
16 
17 namespace Baloo
18 {
19 class TagWidgetPrivate;
20 
21 /**
22  * \class TagWidget tagwidget.h
23  *
24  * \brief Allows to change a selection of tags.
25  *
26  * TagWidget provides a simple GUI interface to assign tags.
27  *
28  * \author Sebastian Trueg <[email protected]>
29  */
30 class BALOO_WIDGETS_EXPORT TagWidget : public QWidget
31 {
32  Q_OBJECT
33 
34 public:
35  /**
36  * Constructor
37  */
38  explicit TagWidget(QWidget *parent = nullptr);
39 
40  /**
41  * Destructor
42  */
43  ~TagWidget() override;
44 
45  /**
46  * The list of selected tags.
47  *
48  * \return The list of all tags that are currently selected. In case
49  * resources to be tagged have been selected this list matches the
50  * tags assigned to the resources.
51  *
52  * \since 4.5
53  */
54  QStringList selectedTags() const;
55 
56  /**
57  * The alignment of the tags in the widget.
58  *
59  * \since 4.5
60  */
61  Qt::Alignment alignment() const;
62 
63  /**
64  * If the widget is read only
65  */
66  bool readOnly() const;
67 
68 Q_SIGNALS:
69  /**
70  * This signal is emitted whenever a tag is clicked.
71  */
72  void tagClicked(const QString &);
73 
74  /**
75  * Emitted whenever the selection of tags changes.
76  *
77  * \since 4.5
78  */
79  void selectionChanged(const QStringList &tags);
80 
81 public Q_SLOTS:
82  /**
83  * Set the list of selected tags. In case resources have been
84  * set via setTaggedResource() or setTaggedResources() their
85  * list of tags is changed automatically.
86  *
87  * \since 4.5
88  */
89  void setSelectedTags(const QStringList &tags);
90 
91  /**
92  * Set the alignment to use. Only horizontal alignment flags make a
93  * difference.
94  *
95  * \since 4.5
96  */
97  void setAlignment(Qt::Alignment alignment);
98 
99  /**
100  * Set the TagWidget as read only
101  */
102  void setReadyOnly(bool readOnly = true);
103 
104 private Q_SLOTS:
105  void slotShowAll();
106  void slotTagUpdateDone();
107  void slotKEditTagDialogFinished(int result);
108 
109 private:
110  std::unique_ptr<TagWidgetPrivate> const d;
111 };
112 }
113 
114 #endif
typedef Alignment
Allows to change a selection of tags.
Definition: tagwidget.h:30
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Fri Aug 19 2022 04:12:56 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.