CalendarSupport

categoryhierarchyreader.h
1/*
2 SPDX-FileCopyrightText: 2005 Rafal Rzepecki <divide@users.sourceforge.net>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "calendarsupport_export.h"
10
11#include <QVariant>
12
13class QComboBox;
14
15namespace CalendarSupport
16{
17class CALENDARSUPPORT_EXPORT CategoryHierarchyReader
18{
19public:
20 void read(const QStringList &categories);
21 virtual ~CategoryHierarchyReader() = default;
22
23 [[nodiscard]] static QStringList path(QString string);
24
25protected:
26 CategoryHierarchyReader() = default;
27
28 virtual void clear() = 0;
29 virtual void goUp() = 0;
30 virtual void addChild(const QString &label, const QVariant &userData = QVariant()) = 0;
31 virtual int depth() const = 0;
32};
33
34class CALENDARSUPPORT_EXPORT CategoryHierarchyReaderQComboBox : public CategoryHierarchyReader
35{
36public:
37 explicit CategoryHierarchyReaderQComboBox(QComboBox *box)
38 : mBox(box)
39 {
40 }
41
42 ~CategoryHierarchyReaderQComboBox() override = default;
43
44protected:
45 void clear() override;
46 void goUp() override;
47 void addChild(const QString &label, const QVariant &userData = QVariant()) override;
48 int depth() const override;
49
50private:
51 QComboBox *const mBox;
52 int mCurrentDepth = 0;
53};
54
55}
QVariant read(const QByteArray &data, int versionOverride=0)
QString path(const QString &relativePath)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:05:28 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.