DtkWidget
DTK Widget module
载入中...
搜索中...
未找到
dfloatingmessage.h
1// SPDX-FileCopyrightText: 2019 - 2024 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 void messageClosed();
42
43protected:
44 using DFloatingWidget::setWidget;
45
46 virtual void changeEvent(QEvent *event) override;
47private:
48 void showEvent(QShowEvent *event) override;
49};
50
51DWIDGET_END_NAMESPACE
52
53#endif // DFLOATINGMESSAGE_H
一个浮动消息的类.
Definition dfloatingmessage.h:18
Definition dfloatingwidget.h:19