Open-Typer
Open source typewriting tutor program
Loading...
Searching...
No Matches
AbstractMenuBar.h
1/*
2 * AbstractMenuBar.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 ABSTRACTMENUBAR_H
22#define ABSTRACTMENUBAR_H
23
24#include <QObject>
25#include <QQmlListProperty>
26#include "AppMenuModel.h"
27#include "translations/ILanguageManager.h"
28
30class Q_DECL_EXPORT AbstractMenuBar : public QObject
31{
32 Q_OBJECT
33 INJECT(ILanguageManager, languageManager)
34 Q_PROPERTY(QQmlListProperty<AppMenuModel> menus READ menus NOTIFY menusChanged)
35
36 public:
37 AbstractMenuBar(QObject *parent = nullptr);
38
39 void init();
40 QQmlListProperty<AppMenuModel> menus(void);
41 QList<AppMenuModel *> getMenus(void);
42 void setMenus(QList<AppMenuModel *> newMenus);
43 Q_INVOKABLE void addMenu(AppMenuModel *menu);
44 Q_INVOKABLE void removeMenu(AppMenuModel *menu);
45 Q_INVOKABLE virtual void updateMenus(void);
46
47 protected:
48 Q_INVOKABLE virtual void createMenus(void);
49 QList<AppMenuModel *> m_menus;
50
51 signals:
52 void menusChanged();
53};
54
55#endif // ABSTRACTMENUBAR_H
The AbstractMenuBar class provides a model for a menu bar.
Definition AbstractMenuBar.h:31
The AppMenuModel class provides a menu model for the application menu bar.
Definition AppMenuModel.h:30
Definition ILanguageManager.h:28