Version: 9.12.0
QtxNotify Class Reference

#include <QtxNotify.h>

Inheritance diagram for QtxNotify:
Inheritance graph

Classes

class  NotifyWidget
 QtxNotify::NotifyWidget Class represented notification widget. More...
 

Public Types

enum  PlacementPolicy { TopToBottom , BottomToTop }
 

Public Member Functions

Q_ENUM(PlacementPolicy) public QtxNotify (QWidget *, QObject *=0)
 QtxNotify Class that manages all notification instances. Performs show, hide, placing, etc. More...
 
virtual ~QtxNotify ()
 Destructor. More...
 
int showNotification (const QString &, const QString &, int timeout=-1)
 Shows the notifications with spectified text, title and automatic close timeout. Notification will be automatically closed after specified timeout in msec. If timeout is zero then automatic closing doesn't performed. More...
 
void hideNotification (const QString &=QString())
 Closes the notifications with spectified text. More...
 
void hideNotification (const int)
 Closes the notifications with spectified identifier. More...
 
QWidgetwindow () const
 Gets the reference widget for all notifications. More...
 
void setWindow (QWidget *window)
 Sets the reference widget for all notifications. More...
 
double notificationSize () const
 Gets the notification width size of each notification. If size value more than 1 then it will be interpreted as absolute width in pixels. If size value in range between 0 and 1 then notification width will be calculated as relative part of reference window width. More...
 
void setNotificationSize (const double)
 Sets the notification width size of each notification. More...
 
int animationTime () const
 Gets the animation time in msec for notification modifications. More...
 
void setAnimationTime (const int)
 Sets the animation time in msec for notification modifications. If animation time is zero then animation is disabled. More...
 
PlacementPolicy placementPolicy () const
 Gets the notification placement policy. More...
 
void setPlacementPolicy (const PlacementPolicy &)
 Sets the notification placement policy. More...
 
int alignment () const
 Gets the notification placement base point alignment. More...
 
void setAlignment (const int)
 Sets the notification placement base point alignment. More...
 
virtual bool eventFilter (QObject *, QEvent *)
 Reimplemented for tracking reference widget size changing and update notification geometries. More...
 

Private Types

typedef QList< QtxNotify::NotifyWidget * > NotifyList
 
typedef QList< QAbstractAnimation * > AnimationList
 

Private Slots

void onArrangeTimeout ()
 Performs the scheduled delayed notification arrangment. More...
 
void onAnimationDestroyed (QObject *)
 Invoked when animation is destroyed. Removes the destroyed animation reference from list. More...
 

Private Member Functions

void triggerArrange ()
 Schedule delayed notification arrangement. More...
 
void updateArrangement ()
 Performs the notification arrangment with disabled animation. More...
 
void arrangeNotifications (bool=true)
 Performs the update of all notification geometries. If parameter anim is true then arrangment will be animated otherwise not. More...
 
NotifyWidgetnotification (const int)
 Gets the notification with specified identifier. More...
 
NotifyWidgetnotification (const QString &)
 Gets the notification with specified text. More...
 
void removeNotification (NotifyWidget *)
 Removes the specified notification. More...
 
int generateId () const
 Generates the new free notification identifier. More...
 
bool isAnimated () const
 Gets the animation using state. If it's true then animation will be used during notification modifcations. More...
 
bool hasAcitveAnimation () const
 Gets the active animation state. If there is exist active animation then return true otherwise false. More...
 
void startAnimation (QAbstractAnimation *)
 Starts the given animation. More...
 
void stopAnimation (QAbstractAnimation *)
 Stops the given animation. More...
 
QPoint referencePoint () const
 
int notificationWidth () const
 Gets the notification window with. More...
 

Private Attributes

double mySize
 
QWidgetmyWindow
 
PlacementPolicy myPlacement
 
int myAlignment
 
QTimer * myArrangeTimer
 
int myAnimTime
 
bool myAnimBlock
 
AnimationList myAnimations
 
NotifyList myNotifications
 

Friends

class QtxNotify::NotifyWidget
 

Member Typedef Documentation

◆ AnimationList

typedef QList<QAbstractAnimation*> QtxNotify::AnimationList
private

◆ NotifyList

Member Enumeration Documentation

◆ PlacementPolicy

Enumerator
TopToBottom 
BottomToTop 

Constructor & Destructor Documentation

◆ QtxNotify()

QtxNotify::QtxNotify ( QWidget win,
QObject parent = 0 
)

QtxNotify Class that manages all notification instances. Performs show, hide, placing, etc.

Constructor.

References myArrangeTimer, onArrangeTimeout(), setWindow(), window(), and Window.

◆ ~QtxNotify()

QtxNotify::~QtxNotify ( )
virtual

Destructor.

Member Function Documentation

◆ alignment()

int QtxNotify::alignment ( ) const

Gets the notification placement base point alignment.

Returns
alignment flags

References myAlignment.

◆ animationTime()

int QtxNotify::animationTime ( ) const

Gets the animation time in msec for notification modifications.

Returns
animation time

References myAnimTime.

◆ arrangeNotifications()

void QtxNotify::arrangeNotifications ( bool  anim = true)
private

Performs the update of all notification geometries. If parameter anim is true then arrangment will be animated otherwise not.

Parameters
anim- use animation

References alignment(), animationTime(), BottomToTop, isAnimated(), myNotifications, placementPolicy(), referencePoint(), QtxNotify::NotifyWidget::sizeHint(), startAnimation(), and window().

◆ eventFilter()

bool QtxNotify::eventFilter ( QObject o,
QEvent e 
)
virtual

Reimplemented for tracking reference widget size changing and update notification geometries.

Parameters
o- handled object
e- handled event

References updateArrangement(), and window().

◆ generateId()

int QtxNotify::generateId ( ) const
private

Generates the new free notification identifier.

Returns
generated identifier

References myNotifications.

◆ hasAcitveAnimation()

bool QtxNotify::hasAcitveAnimation ( ) const
private

Gets the active animation state. If there is exist active animation then return true otherwise false.

Returns
active animation state

References myAnimations.

◆ hideNotification() [1/2]

void QtxNotify::hideNotification ( const int  id)

Closes the notifications with spectified identifier.

Parameters
text- Notification identifier

References notification(), and removeNotification().

◆ hideNotification() [2/2]

void QtxNotify::hideNotification ( const QString &  text = QString())

Closes the notifications with spectified text.

Parameters
text- Notification text

References notification(), and removeNotification().

◆ isAnimated()

bool QtxNotify::isAnimated ( ) const
private

Gets the animation using state. If it's true then animation will be used during notification modifcations.

Returns
animation using state

References myAnimTime.

◆ notification() [1/2]

QtxNotify::NotifyWidget * QtxNotify::notification ( const int  id)
private

Gets the notification with specified identifier.

Parameters
id- notification identifier
Returns
notification instance

References myNotifications.

◆ notification() [2/2]

QtxNotify::NotifyWidget * QtxNotify::notification ( const QString &  text)
private

Gets the notification with specified text.

Parameters
text- notification text
Returns
notification instance

References myNotifications.

◆ notificationSize()

double QtxNotify::notificationSize ( ) const

Gets the notification width size of each notification. If size value more than 1 then it will be interpreted as absolute width in pixels. If size value in range between 0 and 1 then notification width will be calculated as relative part of reference window width.

Returns
notification size

References mySize.

◆ notificationWidth()

int QtxNotify::notificationWidth ( ) const
private

Gets the notification window with.

Returns
width in pixels

References notificationSize(), and window().

◆ onAnimationDestroyed

void QtxNotify::onAnimationDestroyed ( QObject obj)
privateslot

Invoked when animation is destroyed. Removes the destroyed animation reference from list.

Parameters
obj- destroyed animation reference

References myAnimations.

◆ onArrangeTimeout

void QtxNotify::onArrangeTimeout ( )
privateslot

Performs the scheduled delayed notification arrangment.

References arrangeNotifications(), hasAcitveAnimation(), myAnimBlock, and triggerArrange().

◆ placementPolicy()

QtxNotify::PlacementPolicy QtxNotify::placementPolicy ( ) const

Gets the notification placement policy.

Returns
notification placement policy

References myPlacement.

◆ referencePoint()

QPoint QtxNotify::referencePoint ( ) const
private

◆ removeNotification()

void QtxNotify::removeNotification ( QtxNotify::NotifyWidget notify)
private

Removes the specified notification.

Parameters
notify- notification instance

References animationTime(), arrangeNotifications(), isAnimated(), myNotifications, onArrangeTimeout(), QtxNotify::NotifyWidget::setTimeout(), and startAnimation().

◆ setAlignment()

void QtxNotify::setAlignment ( const int  flags)

Sets the notification placement base point alignment.

Parameters
falgs- alignment flags

References myAlignment, and updateArrangement().

◆ setAnimationTime()

void QtxNotify::setAnimationTime ( const int  time)

Sets the animation time in msec for notification modifications. If animation time is zero then animation is disabled.

Parameters
time- animation time

References myAnimTime.

◆ setNotificationSize()

void QtxNotify::setNotificationSize ( const double  size)

Sets the notification width size of each notification.

Parameters
size- notification size

References mySize, and updateArrangement().

◆ setPlacementPolicy()

void QtxNotify::setPlacementPolicy ( const PlacementPolicy placement)

Sets the notification placement policy.

Parameters
placement- notification placement policy

References myPlacement, and updateArrangement().

◆ setWindow()

void QtxNotify::setWindow ( QWidget window)

Sets the reference widget for all notifications.

Parameters
win- reference widget

References myWindow, updateArrangement(), and window().

◆ showNotification()

int QtxNotify::showNotification ( const QString &  text,
const QString &  title,
int  timeout = -1 
)

Shows the notifications with spectified text, title and automatic close timeout. Notification will be automatically closed after specified timeout in msec. If timeout is zero then automatic closing doesn't performed.

Parameters
text- Notification text
title- Notification title
timeout- Notification close timeout in msec
Returns
notification identifier

References generateId(), QtxNotify::NotifyWidget::id(), myNotifications, notification(), QtxNotify::NotifyWidget::setId(), QtxNotify::NotifyWidget::setTimeout(), QtxNotify::NotifyWidget::setTitle(), triggerArrange(), and window().

◆ startAnimation()

void QtxNotify::startAnimation ( QAbstractAnimation *  animation)
private

Starts the given animation.

Parameters
animation- animation instance

References myAnimations, and onAnimationDestroyed().

◆ stopAnimation()

void QtxNotify::stopAnimation ( QAbstractAnimation *  animation)
private

Stops the given animation.

Parameters
animation- animation instance

◆ triggerArrange()

void QtxNotify::triggerArrange ( )
private

Schedule delayed notification arrangement.

References myArrangeTimer.

◆ updateArrangement()

void QtxNotify::updateArrangement ( )
private

Performs the notification arrangment with disabled animation.

References myAnimBlock, and triggerArrange().

◆ window()

QWidget * QtxNotify::window ( ) const

Gets the reference widget for all notifications.

Returns
reference widget

References myWindow.

Friends And Related Function Documentation

◆ QtxNotify::NotifyWidget

friend class QtxNotify::NotifyWidget
friend

Member Data Documentation

◆ myAlignment

int QtxNotify::myAlignment
private

◆ myAnimations

AnimationList QtxNotify::myAnimations
private

◆ myAnimBlock

bool QtxNotify::myAnimBlock
private

◆ myAnimTime

int QtxNotify::myAnimTime
private

◆ myArrangeTimer

QTimer* QtxNotify::myArrangeTimer
private

◆ myNotifications

NotifyList QtxNotify::myNotifications
private

◆ myPlacement

PlacementPolicy QtxNotify::myPlacement
private

◆ mySize

double QtxNotify::mySize
private

◆ myWindow

QWidget* QtxNotify::myWindow
private

The documentation for this class was generated from the following files: