QtCanpool 3.3.0
载入中...
搜索中...
未找到
qxtoast.h
浏览该文件的文档.
1
5#ifndef QXTOAST_H
6#define QXTOAST_H
7
8#include "qxapp_global.h"
9
10#include <QtCore/QString>
11#include <QtGui/QColor>
12#include <QtWidgets/QWidget>
13
14QT_BEGIN_NAMESPACE
15class QLabel;
16QT_END_NAMESPACE
17
19
20class QxToastPrivate;
21
53class QX_APP_EXPORT QxToast : public QWidget
54{
55 Q_OBJECT
56public:
64 Q_ENUM(Level)
65
66
67 static constexpr int DefaultTimeout = 4000;
69 static constexpr int DefaultFadeDuration = 160;
75 static constexpr int ShadowMargin = 4;
81 static constexpr int MinPlateWidth = 160;
82 static constexpr int MaxPlateWidth = 420;
83
84 explicit QxToast(const QString &text, Level level = Information, QWidget *parent = Q_NULLPTR);
85 ~QxToast() override;
86
87 QString text() const;
89 void setText(const QString &text);
90
91 Level level() const;
92 void setLevel(Level level);
93
98 int timeout() const;
99 void setTimeout(int timeoutMs);
100
101 int fadeDuration() const;
103 void setFadeDuration(int ms);
104
106 bool isPaused() const;
108 bool isDismissing() const;
109
120 QColor accentColor() const;
121
122 QSize sizeHint() const override;
124 int heightForWidth(int width) const override;
125
126public Q_SLOTS:
131 void start();
133 void stop();
139 void dismiss();
140
141Q_SIGNALS:
143 void dismissRequested();
145 void dismissed();
147 void clicked();
149 void sizeHintChanged();
150protected:
151 void paintEvent(QPaintEvent *event) override;
152 void resizeEvent(QResizeEvent *event) override;
153 bool event(QEvent *event) override;
154 void mouseReleaseEvent(QMouseEvent *event) override;
155private:
156 Q_DISABLE_COPY(QxToast)
158};
159
161
162#endif // QXTOAST_H
One short message, shown over the window it belongs to and gone a few seconds later.
Definition qxtoast.h:54
Level
What the message is about; it selects the icon and the accent colour.
Definition qxtoast.h:58
#define QX_APP_END_NAMESPACE
#define QX_APP_EXPORT
#define QX_DECLARE_PRIVATE(Class)
#define Q_NULLPTR
Copyleft (C) 2025 maminjie canpool@163.com SPDX-License-Identifier: MulanPSL-2.0
#define QX_APP_BEGIN_NAMESPACE
QColor text