File tree Expand file tree Collapse file tree 5 files changed +86
-0
lines changed
Expand file tree Collapse file tree 5 files changed +86
-0
lines changed Original file line number Diff line number Diff line change 55find_package (Qt${QT_VERSION_MAJOR} ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS Core Gui Quick)
66
77add_subdirectory (applet-example)
8+ add_subdirectory (applet-widget-example)
89add_subdirectory (applet-example-data)
910add_subdirectory (containment-example)
1011add_subdirectory (panel-example)
Original file line number Diff line number Diff line change 1+ # SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
2+ #
3+ # SPDX-License-Identifier: GPL-3.0-or-later
4+
5+ find_package (Qt${QT_VERSION_MAJOR} ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS Widgets)
6+ find_package (Dtk${DTK_VERSION_MAJOR} REQUIRED COMPONENTS Widget)
7+
8+ add_library (ds-example-applet-widget SHARED
9+ exampleapplet.h
10+ exampleapplet.cpp
11+ )
12+
13+ target_link_libraries (ds-example-applet-widget PRIVATE
14+ dde-shell-frame
15+ Qt${QT_VERSION_MAJOR} ::Widgets
16+ Dtk${DTK_VERSION_MAJOR} ::Widget
17+ )
18+
19+ ds_install_package(PACKAGE org.deepin.ds.example.applet-widget TARGET ds-example-applet-widget)
Original file line number Diff line number Diff line change 1+ // SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
2+ //
3+ // SPDX-License-Identifier: GPL-3.0-or-later
4+
5+ #include " exampleapplet.h"
6+
7+ #include " pluginfactory.h"
8+
9+ #include < DIconButton>
10+ #include < DIconTheme>
11+ #include < dplatformwindowhandle.h>
12+
13+ #include < QVBoxLayout>
14+ #include < QWidget>
15+
16+ DGUI_USE_NAMESPACE
17+ DWIDGET_USE_NAMESPACE
18+
19+ WidgetExampleApplet::WidgetExampleApplet (QObject *parent)
20+ : DApplet(parent)
21+ {
22+ }
23+
24+ bool WidgetExampleApplet::init ()
25+ {
26+ auto widget = new QWidget ();
27+ DPlatformWindowHandle handle (widget);
28+ widget->setFixedSize (QSize (200 , 200 ));
29+ auto layout = new QVBoxLayout (widget);
30+ auto btn = new DIconButton ();
31+ btn->setIcon (DIconTheme::findQIcon (" deepin-home" ));
32+ btn->setIconSize (QSize (36 , 36 ));
33+ layout->addWidget (btn);
34+ widget->show ();
35+
36+ return DApplet::init ();
37+ }
38+
39+ D_APPLET_CLASS (WidgetExampleApplet)
40+
41+ #include " exampleapplet.moc"
Original file line number Diff line number Diff line change 1+ // SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
2+ //
3+ // SPDX-License-Identifier: GPL-3.0-or-later
4+
5+ #pragma once
6+
7+ #include " applet.h"
8+
9+ DS_USE_NAMESPACE
10+
11+ class WidgetExampleApplet : public DApplet
12+ {
13+ Q_OBJECT
14+ public:
15+ explicit WidgetExampleApplet (QObject *parent = nullptr );
16+
17+ virtual bool init () override ;
18+ };
Original file line number Diff line number Diff line change 1+ {
2+ "Plugin" : {
3+ "Version" : " 1.0" ,
4+ "Id" : " org.deepin.ds.example.applet-widget" ,
5+ "Parent" : " org.deepin.ds.example.containment"
6+ }
7+ }
You can’t perform that action at this time.
0 commit comments