Baloo Widgets

tagwidget.h
1/*
2 SPDX-FileCopyrightText: 2006-2010 Sebastian Trueg <trueg@kde.org>
3 SPDX-FileCopyrightText: 2013 Vishesh Handa <me@vhanda.in>
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
17namespace Baloo
18{
19class 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 <trueg@kde.org>
29 */
30class BALOO_WIDGETS_EXPORT TagWidget : public QWidget
31{
32 Q_OBJECT
33
34public:
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
68Q_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
81public 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
104private:
105 std::unique_ptr<TagWidgetPrivate> const d;
106};
107}
108
109#endif
Allows to change a selection of tags.
Definition tagwidget.h:31
void selectionChanged(const QStringList &tags)
Emitted whenever the selection of tags changes.
void tagClicked(const QString &)
This signal is emitted whenever a tag is clicked.
~TagWidget() override
Destructor.
typedef Alignment
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 6 2024 12:11:41 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.