DtkWidget
DTK Widget module
载入中...
搜索中...
未找到
dwatermarkwidget.h
浏览该文件的文档.
1// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#ifndef WATERMARKWIDGET_H
6#define WATERMARKWIDGET_H
7
8#include <QWidget>
9
10#include <dtkwidget_global.h>
11#include <DObject>
12
13DWIDGET_BEGIN_NAMESPACE
14
15class WaterMarkDataPrivate;
16class WaterMarkData : public DTK_CORE_NAMESPACE::DObject
17{
18public:
22 Image
23 };
26 Tiled
27 };
28
29 explicit WaterMarkData();
30
32 WaterMarkData& operator=(const WaterMarkData& p);
33
34 WaterMarkType type() const;
35 void setType(WaterMarkType type);
36
37 WaterMarkLayout layout() const;
38 void setLayout(WaterMarkLayout layout);
39
40 qreal scaleFactor() const;
41 void setScaleFactor(qreal scaleFactor);
42
43 int spacing() const;
44 void setSpacing(int spacing);
45
46 int lineSpacing() const;
47 void setLineSpacing(int lineSpacing);
48
49 QString text() const;
50 void setText(const QString &text);
51
52 QFont font() const;
53 void setFont(const QFont &font);
54
55 QColor color() const;
56 void setColor(const QColor &color);
57
58 qreal rotation() const;
59 void setRotation(qreal rotation);
60
61 qreal opacity() const;
62 void setOpacity(qreal opacity);
63
64 QImage image() const;
65 void setImage(const QImage &image);
66
67 bool grayScale() const;
68 void setGrayScale(bool grayScale);
69
70private:
71 D_DECLARE_PRIVATE(WaterMarkData)
72};
73
75class DWaterMarkWidget : public QWidget, public DTK_CORE_NAMESPACE::DObject
76{
77 Q_OBJECT
78public:
79 explicit DWaterMarkWidget(QWidget *parent = nullptr);
80
81 const WaterMarkData &data();
82 void setData(const WaterMarkData &data);
83
84protected:
85 void paintEvent(QPaintEvent *) override;
86 bool eventFilter(QObject *watched, QEvent *event) override;
87
88private:
89 D_DECLARE_PRIVATE(DWaterMarkWidget)
90};
91
92DWIDGET_END_NAMESPACE
93
94#endif // WATERMARKWIDGET_H
Definition dwatermarkwidget.cpp:423
The watermark class will cover the set parent interface and dynamically adjust the size following the...
Definition dwatermarkwidget.h:76
Watermark information structure parent
Definition dwatermarkwidget.h:17
WaterMarkLayout
Definition dwatermarkwidget.h:24
@ Center
Definition dwatermarkwidget.h:25
WaterMarkType
Definition dwatermarkwidget.h:19
@ Text
Definition dwatermarkwidget.h:21
@ None
Definition dwatermarkwidget.h:20