Open-Typer
Open source typewriting tutor program
Loading...
Searching...
No Matches
AppMenuModel.h
1/*
2 * AppMenuModel.h
3 * This file is part of Open-Typer
4 *
5 * Copyright (C) 2023 - adazem009
6 *
7 * Open-Typer is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * Open-Typer is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with Open-Typer. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef APPMENUMODEL_H
22#define APPMENUMODEL_H
23
24#include <QObject>
25#include <QQmlListProperty>
26#include "AppMenuItem.h"
27
29class Q_DECL_EXPORT AppMenuModel : public QObject
30{
31 Q_OBJECT
32 Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged)
33 Q_PROPERTY(QQmlListProperty<AppMenuItem> items READ items NOTIFY itemsChanged)
34
35 public:
36 explicit AppMenuModel(QObject *parent = nullptr);
37
38 QString title(void);
39 void setTitle(QString newTitle);
40
41 QQmlListProperty<AppMenuItem> items(void);
42 QList<AppMenuItem *> getItems(void);
43 void setItems(QList<AppMenuItem *> newItems);
44 void addItem(AppMenuItem *item);
45 void removeItem(AppMenuItem *item);
46
47 private:
48 QString m_title;
49 QList<AppMenuItem *> m_items;
50
51 signals:
52 void titleChanged(QString title);
53 void itemsChanged(QList<AppMenuItem *> items);
54};
55
56#endif // APPMENUMODEL_H
The AppMenuItem class provides a model for a menu item.
Definition AppMenuItem.h:33
The AppMenuModel class provides a menu model for the application menu bar.
Definition AppMenuModel.h:30