KCalendarCore

calendarlistmodel.h
1/*
2 SPDX-FileCopyrightText: 2022 Volker Krause <vkrause@kde.org>
3 SPDX-License-Identifier: LGPL-2.0-or-later
4*/
5
6#ifndef KCALENDARCORE_CALENDARLISTMODEL_H
7#define KCALENDARCORE_CALENDARLISTMODEL_H
8
9#include "kcalendarcore_export.h"
10
11#include <QAbstractListModel>
12
13#include <memory>
14
15namespace KCalendarCore
16{
17
18class CalendarListModelPrivate;
19
20/** Model adaptor for KCalendarCore::CalendarPlugin::calendars().
21 *
22 * @since 6.4
23 */
24class KCALENDARCORE_EXPORT CalendarListModel : public QAbstractListModel
25{
26 Q_OBJECT
27public:
28 explicit CalendarListModel(QObject *parent = nullptr);
30
31 enum Role {
32 NameRole = Qt::DisplayRole, ///< display name of the calendar
33 IconRole = Qt::DecorationRole, ///< the calendar icon, when available
34 CalendarRole = Qt::UserRole, ///< the KCalendarCore::Calendar calendar
35 AccessModeRole, ///< the access mode of the calendar (see KCalendarCore::AccessMode)
36 IdRole, ///< the internal calendar id
37 };
38
39 [[nodiscard]] int rowCount(const QModelIndex &parent = {}) const override;
40 [[nodiscard]] QVariant data(const QModelIndex &index, int role) const override;
41 [[nodiscard]] QHash<int, QByteArray> roleNames() const override;
42
43private:
44 std::unique_ptr<CalendarListModelPrivate> d;
45};
46
47}
48
49#endif // KCALENDARCORE_CALENDARLISTMODEL_H
Model adaptor for KCalendarCore::CalendarPlugin::calendars().
@ IdRole
the internal calendar id
@ AccessModeRole
the access mode of the calendar (see KCalendarCore::AccessMode)
Namespace for all KCalendarCore types.
Definition alarm.h:37
DisplayRole
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:07:48 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.