|
QtCanpool 3.3.0
|
The stack of toasts of one window. 更多...
#include <qxapp/qxtoastmanager.h>

Public 类型 | |
| enum | Position { TopLeft , TopRight , BottomLeft , BottomRight } |
| The corner of the host the stack is anchored to. 更多... | |
Public 成员函数 | |
| QxToastManager (QWidget *host, QObject *parent=0) | |
| ~QxToastManager () override | |
| QWidget * | host () const |
| int | maxVisible () const |
| How many toasts share the screen before the oldest one is evicted. | |
| void | setMaxVisible (int count) |
| Position | position () const |
| void | setPosition (Position position) |
| int | margin () const |
| Distance kept between the plate and the two edges it is anchored to. | |
| void | setMargin (int pixels) |
| int | spacing () const |
| Distance between two plates of the stack. | |
| void | setSpacing (int pixels) |
| int | maxWidth () const |
| Widest a plate may get; a narrow host shrinks it further. | |
| void | setMaxWidth (int pixels) |
| int | fadeDuration () const |
| Milliseconds the fade in and the fade out take; zero turns them off. | |
| void | setFadeDuration (int ms) |
| int | count () const |
| QList< QxToast * > | toasts () const |
| The toasts that are on screen, oldest first - the order they stack in. | |
| QxToast * | toastAt (int index) const |
| The toast at index of the stack, null when it is out of range. | |
| bool | contains (QxToast *toast) const |
| QxToast * | show (const QString &text, QxToast::Level level=QxToast::Information, int timeoutMs=QxToast::DefaultTimeout) |
| Creates a toast, puts it at the end of the stack and starts it. | |
| void | dismissAll () |
| Dismisses every toast of the stack, oldest first. | |
| void | toastShown (QxToast *toast) |
| A toast has joined the stack and is on its way in. | |
| void | toastDismissed (QxToast *toast) |
| A toast has left the stack; its widget fades out right after this. | |
静态 Public 属性 | |
| static constexpr int | DefaultTimeout = QxToast::DefaultTimeout |
| Milliseconds a toast stays on screen when the caller does not say. | |
Protected 成员函数 | |
| bool | eventFilter (QObject *watched, QEvent *event) override |
The stack of toasts of one window.
A manager belongs to a host window - the shell, or any other widget that is big enough to carry an overlay - and puts every toast it is handed into a column anchored to one of that window's corners. It is the queue that keeps the screen readable: once more than maxVisible() toasts are up, the oldest one is evicted, so a burst of messages leaves the last few on screen instead of covering the window.
The queue this class reports is what is on screen: show() adds to it, a timeout, a click, an eviction or dismissAll() takes out of it, and both happen straight away rather than when the animation is over. The toast widget fades out behind the bookkeeping, which is what lets the tests assert on the stack without waiting for a clock.
The manager owns the toasts it creates. They are children of the host, so destroying the host destroys them too.
在文件 qxtoastmanager.h 第 48 行定义.
The corner of the host the stack is anchored to.
| 枚举值 | |
|---|---|
| TopLeft | |
| TopRight | |
| BottomLeft | |
| BottomRight | |
在文件 qxtoastmanager.h 第 53 行定义.
|
explicit |
在文件 qxtoastmanager.cpp 第 114 行定义.
|
override |
在文件 qxtoastmanager.cpp 第 127 行定义.
| bool QxApp::QxToastManager::contains | ( | QxToast * | toast | ) | const |
在文件 qxtoastmanager.cpp 第 249 行定义.
| int QxApp::QxToastManager::count | ( | ) | const |
在文件 qxtoastmanager.cpp 第 228 行定义.
| void QxApp::QxToastManager::dismissAll | ( | ) |
Dismisses every toast of the stack, oldest first.
在文件 qxtoastmanager.cpp 第 281 行定义.
|
overrideprotected |
在文件 qxtoastmanager.cpp 第 291 行定义.
| int QxApp::QxToastManager::fadeDuration | ( | ) | const |
Milliseconds the fade in and the fade out take; zero turns them off.
在文件 qxtoastmanager.cpp 第 213 行定义.
| QWidget * QxApp::QxToastManager::host | ( | ) | const |
在文件 qxtoastmanager.cpp 第 132 行定义.
| int QxApp::QxToastManager::margin | ( | ) | const |
Distance kept between the plate and the two edges it is anchored to.
在文件 qxtoastmanager.cpp 第 171 行定义.
| int QxApp::QxToastManager::maxVisible | ( | ) | const |
How many toasts share the screen before the oldest one is evicted.
在文件 qxtoastmanager.cpp 第 138 行定义.
| int QxApp::QxToastManager::maxWidth | ( | ) | const |
Widest a plate may get; a narrow host shrinks it further.
在文件 qxtoastmanager.cpp 第 197 行定义.
| QxToastManager::Position QxApp::QxToastManager::position | ( | ) | const |
在文件 qxtoastmanager.cpp 第 155 行定义.
| void QxApp::QxToastManager::setFadeDuration | ( | int | ms | ) |
在文件 qxtoastmanager.cpp 第 219 行定义.
| void QxApp::QxToastManager::setMargin | ( | int | pixels | ) |
在文件 qxtoastmanager.cpp 第 177 行定义.
| void QxApp::QxToastManager::setMaxVisible | ( | int | count | ) |
在文件 qxtoastmanager.cpp 第 144 行定义.
| void QxApp::QxToastManager::setMaxWidth | ( | int | pixels | ) |
在文件 qxtoastmanager.cpp 第 203 行定义.
| void QxApp::QxToastManager::setPosition | ( | Position | position | ) |
在文件 qxtoastmanager.cpp 第 161 行定义.
| void QxApp::QxToastManager::setSpacing | ( | int | pixels | ) |
在文件 qxtoastmanager.cpp 第 190 行定义.
| QxToast * QxApp::QxToastManager::show | ( | const QString & | text, |
| QxToast::Level | level = QxToast::Information, |
||
| int | timeoutMs = QxToast::DefaultTimeout |
||
| ) |
Creates a toast, puts it at the end of the stack and starts it.
Adding one past maxVisible() evicts the oldest, so the returned toast is always on screen. A negative timeoutMs is the "stays until dismissed" case.
在文件 qxtoastmanager.cpp 第 255 行定义.
| int QxApp::QxToastManager::spacing | ( | ) | const |
Distance between two plates of the stack.
在文件 qxtoastmanager.cpp 第 184 行定义.
| QxToast * QxApp::QxToastManager::toastAt | ( | int | index | ) | const |
The toast at index of the stack, null when it is out of range.
在文件 qxtoastmanager.cpp 第 240 行定义.
| void QxApp::QxToastManager::toastDismissed | ( | QxToast * | toast | ) |
A toast has left the stack; its widget fades out right after this.
| QList< QxToast * > QxApp::QxToastManager::toasts | ( | ) | const |
The toasts that are on screen, oldest first - the order they stack in.
在文件 qxtoastmanager.cpp 第 234 行定义.
| void QxApp::QxToastManager::toastShown | ( | QxToast * | toast | ) |
A toast has joined the stack and is on its way in.
|
staticconstexpr |
Milliseconds a toast stays on screen when the caller does not say.
在文件 qxtoastmanager.h 第 62 行定义.