• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KDEUI

KSystemTrayIcon Class Reference

#include <ksystemtrayicon.h>

Inheritance diagram for KSystemTrayIcon:

Inheritance graph
[legend]

List of all members.


Detailed Description

KDE System Tray Window class

This class implements system tray windows.

A tray window is a small window (typically 22x22 pixel) that docks into the system tray in the desktop panel. It usually displays an icon or an animated icon there. The icon represents the application, similar to a taskbar button, but consumes less screen space.

When the user clicks with the left mouse button on the icon, the main application window is shown/raised and activated. With the right mouse button, she gets a popupmenu with application specific commands, including "Minimize/Restore" and "Quit".

Please note that QSystemTrayIcon::showMessage(..) should not be used for KDE application because the popup message has no KDE standard look & feel and cannot be controlled by KDE configurations. Use KNotify or KPassivePopup instead.

Author:
Matthias Ettrich <ettrich@kde.org>

Definition at line 53 of file ksystemtrayicon.h.


Public Slots

void toggleActive ()

Signals

void quitSelected ()

Public Member Functions

KActionCollection * actionCollection ()
QAction * contextMenuTitle () const
 KSystemTrayIcon (const QIcon &icon, QWidget *parent=0)
 KSystemTrayIcon (const QString &icon, QWidget *parent=0)
 KSystemTrayIcon (QWidget *parent=0)
QWidget * parentWidget () const
bool parentWidgetTrayClose () const
void setContextMenuTitle (QAction *action)
 ~KSystemTrayIcon ()

Static Public Member Functions

static QIcon loadIcon (const QString &icon, const KComponentData &componentData=KGlobal::mainComponent())

Constructor & Destructor Documentation

KSystemTrayIcon::KSystemTrayIcon ( QWidget *  parent = 0  )  [explicit]

Construct a system tray icon.

The parent widget parent has a special meaning: Besides owning the tray window, the parent widget will dissappear from taskbars when it is iconified while the tray window is visible. This is the desired behavior. After all, the tray window is the parent's taskbar icon.

Furthermore, the parent widget is shown or raised respectively when the user clicks on the tray window with the left mouse button.

Definition at line 96 of file ksystemtrayicon.cpp.

KSystemTrayIcon::KSystemTrayIcon ( const QString &  icon,
QWidget *  parent = 0 
) [explicit]

Same as above but allows one to define the icon by name that should be used for the system tray icon.

Definition at line 103 of file ksystemtrayicon.cpp.

KSystemTrayIcon::KSystemTrayIcon ( const QIcon &  icon,
QWidget *  parent = 0 
) [explicit]

Same as above but allows one to define the icon by name that should be used for the system tray icon.

Definition at line 110 of file ksystemtrayicon.cpp.

KSystemTrayIcon::~KSystemTrayIcon (  ) 

Destructor.

Definition at line 156 of file ksystemtrayicon.cpp.


Member Function Documentation

KActionCollection * KSystemTrayIcon::actionCollection (  ) 

Easy access to the actions in the context menu Currently includes KStandardAction::Quit and minimizeRestore.

Definition at line 329 of file ksystemtrayicon.cpp.

QAction * KSystemTrayIcon::contextMenuTitle (  )  const

Returns the context menu title action.

Since:
4.1

Definition at line 360 of file ksystemtrayicon.cpp.

QIcon KSystemTrayIcon::loadIcon ( const QString &  icon,
const KComponentData &  componentData = KGlobal::mainComponent() 
) [static]

Loads an icon icon using the icon loader class of the given componentData componentData.

The icon is applied the panel effect as it should only be used to be shown in the system tray. It's commonly used in the form : systray->setPixmap( systray->loadIcon( "mysystray" ) );

Definition at line 334 of file ksystemtrayicon.cpp.

QWidget * KSystemTrayIcon::parentWidget (  )  const

Returns the QWidget set by the constructor.

Definition at line 151 of file ksystemtrayicon.cpp.

bool KSystemTrayIcon::parentWidgetTrayClose (  )  const

Function to be used from function handling closing of the window associated with the tray icon (i.e.

QWidget::closeEvent(), KMainWindow::queryClose() or similar). When false is returned, the window closing should proceed normally, when true is returned, special systray-related handling should take place.

Definition at line 346 of file ksystemtrayicon.cpp.

void KSystemTrayIcon::quitSelected (  )  [signal]

Emitted when quit is selected in the menu.

If you want to perform any other action than to close the main application window please connect to this signal.

void KSystemTrayIcon::setContextMenuTitle ( QAction *  action  ) 

Sets the context menu title action to action.

The following code shows how to change the current title. QAction *titleAction = contextMenuTitle(); titleAction->setText("New Title"); setContextMenuTitle(titleAction);

Since:
4.1

Definition at line 353 of file ksystemtrayicon.cpp.

void KSystemTrayIcon::toggleActive (  )  [slot]

Definition at line 341 of file ksystemtrayicon.cpp.


The documentation for this class was generated from the following files:
  • ksystemtrayicon.h
  • ksystemtrayicon.cpp

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • KIO
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal