BuildmLearn Toolkit  2.0.4
BuildmLearn Toolkit is an easy-to-use program that helps users make mobile apps without any knowledge of application development.
 All Classes Functions Enumerations Groups Pages
SystemTrayIcon Class Reference

Application-wide tray icon. More...

#include <systemtrayicon.h>

Collaboration diagram for SystemTrayIcon:
Collaboration graph

Public Slots

void show ()
 Displays tray icon.
 

Signals

void leftMouseClicked ()
 Emitted if user clicks tray icon with left mouse button.
 

Public Member Functions

 SystemTrayIcon (const QString &icon, QObject *parent=0)
 Constructor. More...
 
void showMessage (const QString &title, const QString &message, MessageIcon icon=Information, int milliseconds_timeout_hint=TRAY_ICON_BUBBLE_TIMEOUT, QObject *click_target=NULL, const char *click_slot=NULL)
 Displays new balloon tip with message. More...
 

Static Public Member Functions

static bool isSystemTrayAvailable ()
 Indicates whether tray icon is supported. More...
 

Detailed Description

Application-wide tray icon.

Definition at line 66 of file systemtrayicon.h.

Constructor & Destructor Documentation

SystemTrayIcon::SystemTrayIcon ( const QString &  icon,
QObject *  parent = 0 
)
explicit

Constructor.

Parameters
iconIcon for tray icon.
parentParent of tray icon.

Definition at line 61 of file systemtrayicon.cpp.

62  : QSystemTrayIcon(parent),
63  m_bubbleClickTarget(NULL),
64  m_bubbleClickSlot(NULL) {
65  qDebug("Creating SystemTrayIcon instance.");
66 
67  setIcon(QIcon(icon));
68 
69  // Create necessary connections.
70  connect(this, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
71  this, SLOT(onActivated(QSystemTrayIcon::ActivationReason)));
72 }

Member Function Documentation

bool SystemTrayIcon::isSystemTrayAvailable ( )
static

Indicates whether tray icon is supported.

Returns
Returns true if tray icon is supported.
See also
isSystemTrayActivated()

Definition at line 102 of file systemtrayicon.cpp.

102  {
103  return QSystemTrayIcon::isSystemTrayAvailable() && QSystemTrayIcon::supportsMessages();
104 }

Here is the caller graph for this function:

void SystemTrayIcon::showMessage ( const QString &  title,
const QString &  message,
MessageIcon  icon = Information,
int  milliseconds_timeout_hint = TRAY_ICON_BUBBLE_TIMEOUT,
QObject *  click_target = NULL,
const char *  click_slot = NULL 
)

Displays new balloon tip with message.

Parameters
titleTitle of message.
messageContent of message.
iconIcon of message.
milliseconds_timeout_hintNumber of miliseconds for message to being visible.
click_targetTarget object for balloon tip click.
click_slotTarget object method for balloon tip click.
Warning
Use this in cooperation with isSystemTrayActivated() method.

Definition at line 78 of file systemtrayicon.cpp.

83  {
84  if (m_bubbleClickTarget != NULL && m_bubbleClickSlot != NULL) {
85  // Disconnect previous bubble click signalling.
86  disconnect(this, SIGNAL(messageClicked()), m_bubbleClickTarget, m_bubbleClickSlot);
87  }
88 
89  m_bubbleClickSlot = (char*) click_slot;
90  m_bubbleClickTarget = click_target;
91 
92  if (click_target != NULL && click_slot != NULL) {
93  // Establish new connection for bubble click.
94  connect(this, SIGNAL(messageClicked()), click_target, click_slot);
95  }
96 
97  // NOTE: If connections do not work, then use QMetaObject::invokeMethod(...).
98 
99  QSystemTrayIcon::showMessage(title, message, icon, milliseconds_timeout_hint);
100 }

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