DtkWidget
DTK Widget module
载入中...
搜索中...
未找到
dmainwindow_p.h
1// SPDX-FileCopyrightText: 2017 - 2023 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#ifndef DMAINWINDOW_P_H
6#define DMAINWINDOW_P_H
7
8#include <dtkwidget_global.h>
9#include <DMainWindow>
10#include <DShadowLine>
11
12#include <DFrame>
13#include <DObjectPrivate>
14
15class QShortcut;
16
17DWIDGET_BEGIN_NAMESPACE
18
19class DSidebarHelper : public QObject
20{
21 Q_OBJECT
22 Q_PROPERTY(bool visible READ visible WRITE setVisible NOTIFY visibleChanged)
23 Q_PROPERTY(bool expanded READ expanded WRITE setExpanded NOTIFY expandChanged)
24 Q_PROPERTY(int width READ width WRITE setWidth NOTIFY widthChanged)
25 Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor NOTIFY backgroundColorChanged)
26
27public:
28 DSidebarHelper(QObject *parent = nullptr) : QObject (parent){ }
29 virtual~DSidebarHelper(){}
30
31 QColor backgroundColor() const
32 {
33 return m_backgroundColor;
34 }
35 void setBackgroundColor(QColor backgroundColor)
36 {
37 if (m_backgroundColor == backgroundColor)
38 return;
39
40 m_backgroundColor = backgroundColor;
41 Q_EMIT backgroundColorChanged(m_backgroundColor);
42 }
43
44 bool visible() const
45 {
46 return m_visible;
47 }
48
49 void setVisible(bool visible)
50 {
51 if (m_visible == visible)
52 return;
53
54 m_visible = visible;
55 Q_EMIT visibleChanged(m_visible);
56 }
57
58 bool expanded() const
59 {
60 return m_expanded;
61 }
62
63 void setExpanded(bool expanded)
64 {
65 if (m_expanded == expanded)
66 return;
67
68 m_expanded = expanded;
69 Q_EMIT expandChanged(m_expanded);
70 }
71
72 inline bool sectionVisible() const
73 {
74 return m_visible ? m_expanded : false;
75 }
76
77 int width() const
78 {
79 return m_width;
80 }
81
82 void setWidth(int width)
83 {
84 if (m_width == width)
85 return;
86
87 m_width = width;
88 Q_EMIT widthChanged(m_width);
89 }
90
91Q_SIGNALS:
92 void backgroundColorChanged(QColor backgroundColor);
93 void visibleChanged(bool visible);
94 void expandChanged(bool expanded);
95 void widthChanged(int width);
96
97private:
98 bool m_visible = false;
99 bool m_expanded = true;
100 int m_width = -1;
101 QColor m_backgroundColor;
102
103};
104
106class DTitlebar;
107class DMainWindowPrivate : public DTK_CORE_NAMESPACE::DObjectPrivate
108{
109public:
111
112 void init();
113 void updateTitleShadowGeometry();
114
115 DPlatformWindowHandle *handle = Q_NULLPTR;
116 DTitlebar *titlebar = Q_NULLPTR;
117 DShadowLine *titleShadow = nullptr;
118 QShortcut *help = Q_NULLPTR;
119 DSidebarHelper *sidebarHelper = nullptr;
120 QWidget *sidebarWidget = nullptr;
121 QToolBar *tb = nullptr;
122 DVerticalLine *sidebarSep = nullptr;
123
124private:
125 D_DECLARE_PUBLIC(DMainWindow)
126 void _q_autoShowFeatureDialog();
127};
128
129DWIDGET_END_NAMESPACE
130
131#endif // DMAINWINDOW_P_H
Definition dmainwindow_p.h:108
The DMainWindow class provides a main application window.
Definition dmainwindow.h:20
Definition dplatformwindowhandle.h:19
Definition dshadowline.h:17
Definition dmainwindow_p.h:20
Dtitlebar是Dtk程序通用的标题栏组件,用于实现标题栏的高度定制化
Definition dtitlebar.h:24
Definition dframe.h:47