# class KSystemTrayIcon

###

Module | kdeui
Namespace |
Class | KSystemTrayIcon
Inherits | QSystemTrayIcon

%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>

### methods

- KSystemTrayIcon (parent)

  returns ctor
  KDE 4.1.0 and later only

  Argument | Type | Default
  --- | --- | ---
  parent | QWidget | 0

  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.

- KSystemTrayIcon (icon, parent)

  returns ctor
  KDE 4.1.0 and later only

  Argument | Type | Default
  --- | --- | ---
  icon | QString |
  parent | QWidget | 0

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

- KSystemTrayIcon (icon, parent)

  returns ctor
  KDE 4.1.0 and later only

  Argument | Type | Default
  --- | --- | ---
  icon | QIcon |
  parent | QWidget | 0

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

- KSystemTrayIcon (a0)

  returns ctor
  before KDE 4.1.0 only

  Argument | Type | Default
  --- | --- | ---
  a0 | QWidget | 0

- KSystemTrayIcon (a0, a1)

  returns ctor
  before KDE 4.1.0 only

  Argument | Type | Default
  --- | --- | ---
  a0 | QString |
  a1 | QWidget | 0

- KSystemTrayIcon (a0, a1)

  returns ctor
  before KDE 4.1.0 only

  Argument | Type | Default
  --- | --- | ---
  a0 | QIcon |
  a1 | QWidget | 0

- actionCollection ( )

  returns KActionCollection

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

- contextMenuTitle ( )

  returns QAction
  KDE 4.1.0 and later only

  Returns the context menu title action. @since 4.1

- loadIcon (icon, componentData)

  returns QIcon
  static

  Argument | Type | Default
  --- | --- | ---
  icon | QString |
  componentData | KComponentData | KGlobal.mainComponent()

  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" ) );

- parentWidget ( )

  returns QWidget

  Returns the QWidget set by the constructor

- parentWidgetTrayClose ( )

  returns bool

  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.

- quitSelected ( )

  returns Nothing
  SIGNAL ("quitSelected ()")

  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.

- setContextMenuTitle (action)

  returns Nothing
  KDE 4.1.0 and later only

  Argument | Type | Default
  --- | --- | ---
  action | QAction |

  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

- toggleActive ( )

  returns Nothing