Baloo Widgets

widgetfactory.h
1/*
2 SPDX-FileCopyrightText: 2012 Vishesh Handa <me@vhanda.in>
3
4 SPDX-License-Identifier: LGPL-2.1-or-later
5*/
6
7#ifndef WIDGETFACTORY_H
8#define WIDGETFACTORY_H
9
10#include "filemetadatawidget.h"
11
12#include <QObject>
13#include <QStringList>
14
15class QLabel;
16class QUrl;
17class KCommentWidget;
18class KRatingWidget;
19
20namespace Baloo
21{
22class TagWidget;
23
24class WidgetFactory : public QObject
25{
27public:
28 explicit WidgetFactory(QObject *parent = nullptr);
29 ~WidgetFactory() override;
30
31 void setItems(const KFileItemList &items);
32
33 void setReadOnly(bool value);
34
35 void setDateFormat(const DateFormats format);
36 DateFormats dateFormat() const;
37
38 QWidget *createWidget(const QString &prop, const QVariant &value, QWidget *parent);
39
41 void urlActivated(const QUrl &url);
42
43private Q_SLOTS:
44 void slotTagsChanged(const QStringList &tags);
45 void slotCommentChanged(const QString &comment);
46 void slotRatingChanged(int rating);
47
48private:
49 QWidget *createRatingWidget(int rating, QWidget *parent);
50 QWidget *createTagWidget(const QStringList &tags, QWidget *parent);
51 QWidget *createCommentWidget(const QString &comment, QWidget *parent);
52 QLabel *createValueWidget(QWidget *parent);
53 QLabel *createLinkWidget(QWidget *parent);
54
55 TagWidget *m_tagWidget = nullptr;
56 KRatingWidget *m_ratingWidget = nullptr;
57 KCommentWidget *m_commentWidget = nullptr;
58
59 KFileItemList m_items;
60 QStringList m_prevTags;
61 bool m_readOnly = false;
62 QLocale::FormatType m_dateFormat;
63};
64}
65
66#endif // WIDGETFACTORY_H
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:57:15 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.