QtCanpool 3.3.0
载入中...
搜索中...
未找到
qxtoastmanager.h
浏览该文件的文档.
1
5#ifndef QXTOASTMANAGER_H
6#define QXTOASTMANAGER_H
7
8#include "qxapp_global.h"
9#include "qxtoast.h"
10
11#include <QtCore/QList>
12#include <QtCore/QObject>
13
14QT_BEGIN_NAMESPACE
15class QEvent;
16QT_END_NAMESPACE
17
19
20class QxToastManagerPrivate;
21
48class QX_APP_EXPORT QxToastManager : public QObject
49{
50 Q_OBJECT
51public:
59 Q_ENUM(Position)
60
61
62 static constexpr int DefaultTimeout = QxToast::DefaultTimeout;
63
64 explicit QxToastManager(QWidget *host, QObject *parent = Q_NULLPTR);
65 ~QxToastManager() override;
66
67 QWidget *host() const;
68
70 int maxVisible() const;
71 void setMaxVisible(int count);
72
73 Position position() const;
74 void setPosition(Position position);
75
77 int margin() const;
78 void setMargin(int pixels);
80 int spacing() const;
81 void setSpacing(int pixels);
83 int maxWidth() const;
84 void setMaxWidth(int pixels);
86 int fadeDuration() const;
87 void setFadeDuration(int ms);
88
89 int count() const;
91 QList<QxToast *> toasts() const;
93 QxToast *toastAt(int index) const;
94 bool contains(QxToast *toast) const;
95
101 QxToast *show(const QString &text, QxToast::Level level = QxToast::Information,
102 int timeoutMs = QxToast::DefaultTimeout);
104 void dismissAll();
105
106Q_SIGNALS:
108 void toastShown(QxToast *toast);
110 void toastDismissed(QxToast *toast);
111protected:
112 bool eventFilter(QObject *watched, QEvent *event) override;
113private:
114 Q_DISABLE_COPY(QxToastManager)
116};
117
119
120#endif // QXTOASTMANAGER_H
The stack of toasts of one window.
Position
The corner of the host the stack is anchored to.
One short message, shown over the window it belongs to and gone a few seconds later.
Definition qxtoast.h:54
#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