DtkWidget
DTK Widget module
载入中...
搜索中...
未找到
dmainwindow.h
浏览该文件的文档.
1// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#ifndef DMAINWINDOW_H
6#define DMAINWINDOW_H
7
8#include <dtkwidget_global.h>
9#include <DFloatingMessage>
10#include <DObject>
11
12#include <QMainWindow>
13#include <QPainterPath>
14
15DWIDGET_BEGIN_NAMESPACE
16
17class DMainWindowPrivate;
18class DTitlebar;
19class LIBDTKWIDGETSHARED_EXPORT DMainWindow : public QMainWindow, public DTK_CORE_NAMESPACE::DObject
20{
21 Q_OBJECT
22
23 Q_PROPERTY(int windowRadius READ windowRadius WRITE setWindowRadius NOTIFY windowRadiusChanged)
24 Q_PROPERTY(int borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged)
25 Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged)
26 Q_PROPERTY(int shadowRadius READ shadowRadius WRITE setShadowRadius NOTIFY shadowRadiusChanged)
27 Q_PROPERTY(QPoint shadowOffset READ shadowOffset WRITE setShadowOffset NOTIFY shadowOffsetChanged)
28 Q_PROPERTY(QColor shadowColor READ shadowColor WRITE setShadowColor NOTIFY shadowColorChanged)
29 Q_PROPERTY(QPainterPath clipPath READ clipPath WRITE setClipPath NOTIFY clipPathChanged)
30 Q_PROPERTY(QRegion frameMask READ frameMask WRITE setFrameMask NOTIFY frameMaskChanged)
31 Q_PROPERTY(QMargins frameMargins READ frameMargins NOTIFY frameMarginsChanged)
32 Q_PROPERTY(bool translucentBackground READ translucentBackground WRITE setTranslucentBackground NOTIFY translucentBackgroundChanged)
33 Q_PROPERTY(bool enableSystemResize READ enableSystemResize WRITE setEnableSystemResize NOTIFY enableSystemResizeChanged)
34 Q_PROPERTY(bool enableSystemMove READ enableSystemMove WRITE setEnableSystemMove NOTIFY enableSystemMoveChanged)
35 Q_PROPERTY(bool enableBlurWindow READ enableBlurWindow WRITE setEnableBlurWindow NOTIFY enableBlurWindowChanged)
36 Q_PROPERTY(bool autoInputMaskByClipPath READ autoInputMaskByClipPath WRITE setAutoInputMaskByClipPath NOTIFY autoInputMaskByClipPathChanged)
37 Q_PROPERTY(bool titlebarShadowEnabled READ titlebarShadowIsEnabled WRITE setTitlebarShadowEnabled)
38
39public:
40 explicit DMainWindow(QWidget *parent = 0);
41
42 DTitlebar *titlebar() const;
43
44 void setSidebarWidget(QWidget *widget);
45 QWidget * sidebarWidget();
46
47 int sidebarWidth() const;
48 void setSidebarWidth(int width);
49#if DTK_VERSION < DTK_VERSION_CHECK(6, 0, 0, 0)
50 D_DECL_DEPRECATED_X("Please use sidebarVisible") bool sidebarVisble() const;
51#endif
52 bool sidebarVisible() const ;
53 void setSidebarVisible(bool visible);
54
55 bool sidebarExpanded() const;
56 void setSidebarExpanded(bool expended);
57
58 bool isDXcbWindow() const;
59
60 int windowRadius() const;
61
62 int borderWidth() const;
63 QColor borderColor() const;
64
65 int shadowRadius() const;
66 QPoint shadowOffset() const;
67 QColor shadowColor() const;
68
69 QPainterPath clipPath() const;
70 QRegion frameMask() const;
71 QMargins frameMargins() const;
72
73 bool translucentBackground() const;
74 bool enableSystemResize() const;
75 bool enableSystemMove() const;
76 bool enableBlurWindow() const;
77 bool autoInputMaskByClipPath() const;
78
79 bool titlebarShadowIsEnabled() const;
80
81public Q_SLOTS:
82 void setWindowRadius(int windowRadius);
83
84 void setBorderWidth(int borderWidth);
85 void setBorderColor(const QColor &borderColor);
86
87 void setShadowRadius(int shadowRadius);
88 void setShadowOffset(const QPoint &shadowOffset);
89 void setShadowColor(const QColor &shadowColor);
90
91 void setClipPath(const QPainterPath &clipPath);
92 void setFrameMask(const QRegion &frameMask);
93
94 void setTranslucentBackground(bool translucentBackground);
95 void setEnableSystemResize(bool enableSystemResize);
96 void setEnableSystemMove(bool enableSystemMove);
97 void setEnableBlurWindow(bool enableBlurWindow);
98 void setAutoInputMaskByClipPath(bool autoInputMaskByClipPath);
99
100 // TODO: remove it if there is an batter sulotion
101#ifdef Q_OS_MAC
102 void setWindowFlags(Qt::WindowFlags type);
103#endif
104
105 void sendMessage(const QIcon &icon, const QString &message);
106 void sendMessage(DFloatingMessage *message);
107
108 void setTitlebarShadowEnabled(bool titlebarShadowEnabled);
109
110Q_SIGNALS:
111 void windowRadiusChanged();
112 void borderWidthChanged();
113 void borderColorChanged();
114 void shadowRadiusChanged();
115 void shadowOffsetChanged();
116 void shadowColorChanged();
117 void clipPathChanged();
118 void frameMaskChanged();
119 void frameMarginsChanged();
120 void translucentBackgroundChanged();
121 void enableSystemResizeChanged();
122 void enableSystemMoveChanged();
123 void enableBlurWindowChanged();
124 void autoInputMaskByClipPathChanged();
125 void sidebarVisbleChanged(bool visible);
126 void sidebarExpanedChanged(bool expaned);
127
128protected:
129 DMainWindow(DMainWindowPrivate &dd, QWidget *parent = 0);
130 void mouseMoveEvent(QMouseEvent *event) override;
131 void resizeEvent(QResizeEvent *event) override;
132 void changeEvent(QEvent *event) override;
133
134private:
135 D_DECLARE_PRIVATE(DMainWindow)
136 D_PRIVATE_SLOT(void _q_autoShowFeatureDialog())
137};
138
139DWIDGET_END_NAMESPACE
140
141#endif // DMAINWINDOW_H
一个浮动消息的类.
Definition dfloatingmessage.h:18
Definition dmainwindow_p.h:108
The DMainWindow class provides a main application window.
Definition dmainwindow.h:20
Dtitlebar是Dtk程序通用的标题栏组件,用于实现标题栏的高度定制化
Definition dtitlebar.h:24