DtkWidget 5.6.0.2
DTK Widget module
dfloatingmessage.h
1// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#ifndef DFLOATINGMESSAGE_H
6#define DFLOATINGMESSAGE_H
7
8#include <dtkwidget_global.h>
9#include <dfloatingwidget.h>
10#include <DObject>
11#include <DDciIcon>
12#include <DIconButton>
13
14DWIDGET_BEGIN_NAMESPACE
15
16class DFloatingMessagePrivate;
18{
19 Q_OBJECT
20 D_DECLARE_PRIVATE(DFloatingMessage)
21
22public:
23 enum MessageType {
24 TransientType, //临时的消息,
25 ResidentType //常驻的消息
26 };
27
28 explicit DFloatingMessage(MessageType notifyType = MessageType::TransientType, QWidget *parent = nullptr);
29 MessageType messageType() const;
30
31 void setIcon(const QIcon &ico);
32 void setIcon(const DDciIcon &icon);
33 void setMessage(const QString &str);
34 void setWidget(QWidget *w);
35 void setDuration(int msec);
36
37 virtual QSize sizeHint() const override;
38
39Q_SIGNALS:
40 void closeButtonClicked();
41
42protected:
43 using DFloatingWidget::setWidget;
44
45private:
46 void showEvent(QShowEvent *event) override;
47};
48
49DWIDGET_END_NAMESPACE
50
51#endif // DFLOATINGMESSAGE_H
一个浮动消息的类.
Definition: dfloatingmessage.h:18
Definition: dfloatingwidget.h:19