QtCanpool 3.3.0
载入中...
搜索中...
未找到
QxApp::QxToastManager类 参考

The stack of toasts of one window. 更多...

#include <qxapp/qxtoastmanager.h>

类 QxApp::QxToastManager 继承关系图:

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.

toasts->show(tr("Connected"), QxToast::Success);
toasts->show(tr("The device did not answer"), QxToast::Error, 10000);
The stack of toasts of one window.
QList< QxToast * > toasts() const
The toasts that are on screen, oldest first - the order they stack in.

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 行定义.

成员枚举类型说明

◆ Position

The corner of the host the stack is anchored to.

枚举值
TopLeft 
TopRight 
BottomLeft 
BottomRight 

在文件 qxtoastmanager.h 第 53 行定义.

构造及析构函数说明

◆ QxToastManager()

QxApp::QxToastManager::QxToastManager ( QWidget *  host,
QObject *  parent = 0 
)
explicit

在文件 qxtoastmanager.cpp 第 114 行定义.

◆ ~QxToastManager()

QxApp::QxToastManager::~QxToastManager ( )
override

在文件 qxtoastmanager.cpp 第 127 行定义.

成员函数说明

◆ contains()

bool QxApp::QxToastManager::contains ( QxToast *  toast) const

在文件 qxtoastmanager.cpp 第 249 行定义.

◆ count()

int QxApp::QxToastManager::count ( ) const

在文件 qxtoastmanager.cpp 第 228 行定义.

◆ dismissAll()

void QxApp::QxToastManager::dismissAll ( )

Dismisses every toast of the stack, oldest first.

在文件 qxtoastmanager.cpp 第 281 行定义.

◆ eventFilter()

bool QxApp::QxToastManager::eventFilter ( QObject *  watched,
QEvent *  event 
)
overrideprotected

在文件 qxtoastmanager.cpp 第 291 行定义.

◆ fadeDuration()

int QxApp::QxToastManager::fadeDuration ( ) const

Milliseconds the fade in and the fade out take; zero turns them off.

在文件 qxtoastmanager.cpp 第 213 行定义.

◆ host()

QWidget * QxApp::QxToastManager::host ( ) const

在文件 qxtoastmanager.cpp 第 132 行定义.

◆ margin()

int QxApp::QxToastManager::margin ( ) const

Distance kept between the plate and the two edges it is anchored to.

在文件 qxtoastmanager.cpp 第 171 行定义.

◆ maxVisible()

int QxApp::QxToastManager::maxVisible ( ) const

How many toasts share the screen before the oldest one is evicted.

在文件 qxtoastmanager.cpp 第 138 行定义.

◆ maxWidth()

int QxApp::QxToastManager::maxWidth ( ) const

Widest a plate may get; a narrow host shrinks it further.

在文件 qxtoastmanager.cpp 第 197 行定义.

◆ position()

QxToastManager::Position QxApp::QxToastManager::position ( ) const

在文件 qxtoastmanager.cpp 第 155 行定义.

◆ setFadeDuration()

void QxApp::QxToastManager::setFadeDuration ( int  ms)

在文件 qxtoastmanager.cpp 第 219 行定义.

◆ setMargin()

void QxApp::QxToastManager::setMargin ( int  pixels)

在文件 qxtoastmanager.cpp 第 177 行定义.

◆ setMaxVisible()

void QxApp::QxToastManager::setMaxVisible ( int  count)

在文件 qxtoastmanager.cpp 第 144 行定义.

◆ setMaxWidth()

void QxApp::QxToastManager::setMaxWidth ( int  pixels)

在文件 qxtoastmanager.cpp 第 203 行定义.

◆ setPosition()

void QxApp::QxToastManager::setPosition ( Position  position)

在文件 qxtoastmanager.cpp 第 161 行定义.

◆ setSpacing()

void QxApp::QxToastManager::setSpacing ( int  pixels)

在文件 qxtoastmanager.cpp 第 190 行定义.

◆ show()

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 行定义.

◆ spacing()

int QxApp::QxToastManager::spacing ( ) const

Distance between two plates of the stack.

在文件 qxtoastmanager.cpp 第 184 行定义.

◆ toastAt()

QxToast * QxApp::QxToastManager::toastAt ( int  index) const

The toast at index of the stack, null when it is out of range.

在文件 qxtoastmanager.cpp 第 240 行定义.

◆ toastDismissed()

void QxApp::QxToastManager::toastDismissed ( QxToast *  toast)

A toast has left the stack; its widget fades out right after this.

◆ toasts()

QList< QxToast * > QxApp::QxToastManager::toasts ( ) const

The toasts that are on screen, oldest first - the order they stack in.

在文件 qxtoastmanager.cpp 第 234 行定义.

◆ toastShown()

void QxApp::QxToastManager::toastShown ( QxToast *  toast)

A toast has joined the stack and is on its way in.

类成员变量说明

◆ DefaultTimeout

constexpr int QxApp::QxToastManager::DefaultTimeout = QxToast::DefaultTimeout
staticconstexpr

Milliseconds a toast stays on screen when the caller does not say.

在文件 qxtoastmanager.h 第 62 行定义.


该类的文档由以下文件生成: