File tree Expand file tree Collapse file tree 3 files changed +60
-0
lines changed Expand file tree Collapse file tree 3 files changed +60
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ qt_add_executable(${APP_TARGET}
44 main.cpp
55 app.cpp
66 app.h
7+ appmenubar.cpp
8+ appmenubar.h
79)
810
911qt_add_qml_module(${APP_TARGET}
Original file line number Diff line number Diff line change 1+ // SPDX-License-Identifier: GPL-3.0-or-later
2+
3+ #include " appmenubar.h"
4+ #include " uicomponents/menubarmodel.h"
5+ #include " uicomponents/menumodel.h"
6+ #include " uicomponents/menuitemmodel.h"
7+
8+ using namespace scratchcpp ;
9+ using namespace scratchcpp ::uicomponents;
10+
11+ AppMenuBar::AppMenuBar (QObject *parent) :
12+ QObject(parent),
13+ m_model(new MenuBarModel(this ))
14+ {
15+ }
16+
17+ MenuBarModel *AppMenuBar::model () const
18+ {
19+ return m_model;
20+ }
Original file line number Diff line number Diff line change 1+ // SPDX-License-Identifier: GPL-3.0-or-later
2+
3+ #pragma once
4+
5+ #include < QQmlEngine>
6+
7+ Q_MOC_INCLUDE (" uicomponents/menubarmodel.h" )
8+
9+ namespace scratchcpp
10+ {
11+
12+ namespace uicomponents
13+ {
14+
15+ class MenuBarModel ;
16+
17+ }
18+
19+ class AppMenuBar : public QObject
20+ {
21+ Q_OBJECT
22+ QML_ELEMENT
23+ QML_SINGLETON
24+ Q_PROPERTY (uicomponents::MenuBarModel *model READ model NOTIFY modelChanged)
25+
26+ public:
27+ explicit AppMenuBar (QObject *parent = nullptr );
28+
29+ uicomponents::MenuBarModel *model () const ;
30+
31+ signals:
32+ void modelChanged ();
33+
34+ private:
35+ uicomponents::MenuBarModel *m_model = nullptr ;
36+ };
37+
38+ } // namespace scratchcpp
You can’t perform that action at this time.
0 commit comments