DtkWidget
DTK Widget module
载入中...
搜索中...
未找到
dtoast.h
1// SPDX-FileCopyrightText: 2016 - 2022 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#pragma once
6
7#include <QScopedPointer>
8#include <QFrame>
9#include <QIcon>
10
11#include <dtkwidget_global.h>
12#include <DObject>
13
14#if DTK_VERSION < DTK_VERSION_CHECK(6, 0, 0, 0)
15
16DWIDGET_BEGIN_NAMESPACE
17
18class DToastPrivate;
19class LIBDTKWIDGETSHARED_EXPORT D_DECL_DEPRECATED_X("Use DMessageManager") DToast : public QFrame, public DTK_CORE_NAMESPACE::DObject
20{
21 Q_OBJECT
22
23 Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity)
24 Q_PROPERTY(qreal duration READ duration WRITE setDuration)
25public:
26 explicit DToast(QWidget *parent = 0);
27 ~DToast();
28
29 QString text() const;
30 QIcon icon() const;
31 int duration() const;
32
33Q_SIGNALS:
34 void visibleChanged(bool isVisible);
35
36public Q_SLOTS:
37 void pop();
38 void pack();
39 void showEvent(QShowEvent *event) override;
40 void hideEvent(QHideEvent *event) override;
41
42 void setText(QString text);
43 void setIcon(QString icon);
44 void setIcon(QIcon icon, QSize defaultSize = QSize(20, 20));
45 void setDuration(int duration);
46
47private:
48 qreal opacity() const;
49 void setOpacity(qreal);
50
51 D_DECLARE_PRIVATE(DToast)
52};
53
54
55DWIDGET_END_NAMESPACE
56
57#endif