DtkWidget
DTK Widget module
载入中...
搜索中...
未找到
darrowrectangle.h
浏览该文件的文档.
1// SPDX-FileCopyrightText: 2015 - 2022 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#ifndef DARROWRECTANGLE_H
6#define DARROWRECTANGLE_H
7
8#include <QWidget>
9#include <QLabel>
10#include <QTextLine>
11#include <QHBoxLayout>
12#include <QVBoxLayout>
13#include <QPainter>
14
15#include <DObject>
16#include <dtkwidget_global.h>
17#include <DBlurEffectWidget>
18
19DWIDGET_BEGIN_NAMESPACE
20
21class DPlatformWindowHandle;
22class DArrowRectanglePrivate;
23class LIBDTKWIDGETSHARED_EXPORT DArrowRectangle : public QWidget, public DTK_CORE_NAMESPACE::DObject
24{
25 Q_OBJECT
26 Q_DISABLE_COPY(DArrowRectangle)
27 D_DECLARE_PRIVATE(DArrowRectangle)
28
29public:
30
37
42
43 explicit DArrowRectangle(ArrowDirection direction, QWidget *parent = nullptr);
44 explicit DArrowRectangle(ArrowDirection direction, FloatMode floatMode, QWidget *parent = nullptr);
45 ~DArrowRectangle() override;
46
47 Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor)
48 Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor)
49 Q_PROPERTY(int borderWidth READ borderWidth WRITE setBorderWidth)
50 Q_PROPERTY(int radius READ radius WRITE setRadius)
51 Q_PROPERTY(int arrowWidth READ arrowWidth WRITE setArrowWidth)
52 Q_PROPERTY(int arrowHeight READ arrowHeight WRITE setArrowHeight)
53 Q_PROPERTY(int arrowX READ arrowX WRITE setArrowX)
54 Q_PROPERTY(int arrowY READ arrowY WRITE setArrowY)
55 Q_PROPERTY(int margin READ margin WRITE setMargin)
56 Q_PROPERTY(ArrowDirection arrowDirection READ arrowDirection WRITE setArrowDirection)
57 Q_PROPERTY(qreal shadowXOffset READ shadowXOffset WRITE setShadowXOffset)
58 Q_PROPERTY(qreal shadowYOffset READ shadowYOffset WRITE setShadowYOffset)
59 Q_PROPERTY(qreal shadowBlurRadius READ shadowBlurRadius WRITE setShadowBlurRadius)
60
61 int radius() const;
62 bool radiusForceEnabled() const;
63 int arrowHeight() const;
64 int arrowWidth() const;
65 int arrowX() const;
66 int arrowY() const;
67 int margin() const;
68 int borderWidth() const;
69 QColor borderColor() const;
70 QColor backgroundColor() const;
71 ArrowDirection arrowDirection() const;
72
73 void setRadius(int value);
74 void setRadiusForceEnable(bool enable);
75 void setArrowHeight(int value);
76 void setArrowWidth(int value);
77 void setArrowX(int value);
78 void setArrowY(int value);
79 void setMargin(int value);
80 void setBorderWidth(int borderWidth);
81 void setBorderColor(const QColor &borderColor);
82 void setBackgroundColor(const QColor &backgroundColor);
83 void setBackgroundColor(DBlurEffectWidget::MaskColorType type);
84 void setArrowDirection(ArrowDirection value);
85 void setWidth(int value);
86 void setHeight(int value);
87
88 virtual void show(int x, int y);
89
90 void setContent(QWidget *content);
91 QWidget *getContent() const;
92 void resizeWithContent();
93 void move(int x, int y);
94 QSize getFixedSize();
95
96 qreal shadowXOffset() const;
97 qreal shadowYOffset() const;
98 qreal shadowBlurRadius() const;
99
100 void setShadowBlurRadius(const qreal &shadowBlurRadius);
101 void setShadowXOffset(const qreal &shadowXOffset);
102 void setShadowYOffset(const qreal &shadowYOffset);
103
104 void setLeftRightRadius(bool enable);
105 void setRadiusArrowStyleEnable(bool enable);
106
107Q_SIGNALS:
108 void windowDeactivate() const;
109
110protected:
111 void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
112 void resizeEvent(QResizeEvent *e) Q_DECL_OVERRIDE;
113 bool event(QEvent *e) Q_DECL_OVERRIDE;
114};
115
116DWIDGET_END_NAMESPACE
117
118#endif // DARROWRECTANGLE_H
119
DArrowRectangle 提供了可以在四个边中的任意一个边显示箭头的矩形控件.
Definition darrowrectangle.h:24
FloatMode
FloatMode 表示不同的控件的浮动模式
Definition darrowrectangle.h:38
@ FloatWindow
控件将会以一个单独的窗口显示
Definition darrowrectangle.h:39
@ FloatWidget
控件只能显示在其父控件的布局中,不能超出父控件大小
Definition darrowrectangle.h:40
ArrowDirection
箭头方向枚举包含 DArrowRectangle 的箭头可能指向的可能方向.
Definition darrowrectangle.h:31
@ ArrowTop
指示此矩形的箭头将指向上方
Definition darrowrectangle.h:34
@ ArrowLeft
指示此矩形的箭头将指向左侧
Definition darrowrectangle.h:32
@ ArrowRight
指示此矩形的箭头将指向右侧
Definition darrowrectangle.h:33
用于实现主窗口或控件背景的实时模糊效果.
Definition dblureffectwidget.h:17