KSystemTrayIcon

#include <ksystemtrayicon.h>

Inheritance diagram for KSystemTrayIcon:

Signals

void quitSelected ()
 

Public Slots

void toggleActive ()
 

Public Member Functions

 KSystemTrayIcon (QWidget *parent=nullptr)
 
 KSystemTrayIcon (const QString &icon, QWidget *parent=nullptr)
 
 KSystemTrayIcon (const QIcon &icon, QWidget *parent=nullptr)
 
 KSystemTrayIcon (QMovie *movie, QWidget *parent)
 
 ~KSystemTrayIcon ()
 
KActionCollectionactionCollection ()
 
QActioncontextMenuTitle () const
 
const QMoviemovie () const
 
QWidgetparentWidget () const
 
bool parentWidgetTrayClose () const
 
void setContextMenuTitle (QAction *action)
 
void setMovie (QMovie *movie)
 
- Public Member Functions inherited from QSystemTrayIcon
 QSystemTrayIcon (QObject *parent)
 
 QSystemTrayIcon (const QIcon &icon, QObject *parent)
 
void activated (QSystemTrayIcon::ActivationReason reason)
 
QMenucontextMenu () const const
 
QRect geometry () const const
 
void hide ()
 
QIcon icon () const const
 
bool isVisible () const const
 
void messageClicked ()
 
void setContextMenu (QMenu *menu)
 
void setIcon (const QIcon &icon)
 
void setToolTip (const QString &tip)
 
void setVisible (bool visible)
 
void show ()
 
void showMessage (const QString &title, const QString &message, const QIcon &icon, int millisecondsTimeoutHint)
 
void showMessage (const QString &title, const QString &message, QSystemTrayIcon::MessageIcon icon, int millisecondsTimeoutHint)
 
QString toolTip () const const
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo ()
 
void dumpObjectInfo () const const
 
void dumpObjectTree ()
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
qobject_cast (QObject *object)
 
qobject_cast (const QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
QThreadthread () const const
 

Static Public Member Functions

static QIcon loadIcon (const QString &icon, const KComponentData &componentData=KComponentData::mainComponent())
 
- Static Public Member Functions inherited from QSystemTrayIcon
bool isSystemTrayAvailable ()
 
bool supportsMessages ()
 
- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 

Additional Inherited Members

- Public Types inherited from QSystemTrayIcon
enum  ActivationReason
 
enum  MessageIcon
 
- Properties inherited from QSystemTrayIcon
 icon
 
 toolTip
 
 visible
 
- Properties inherited from QObject
 objectName
 
- Public Attributes inherited from QSystemTrayIcon
 Context
 
 Critical
 
 DoubleClick
 
 Information
 
 MiddleClick
 
 NoIcon
 
 Trigger
 
 Unknown
 
 Warning
 
- Public Attributes inherited from QObject
typedef QObjectList
 
- Protected Member Functions inherited from QSystemTrayIcon
virtual bool event (QEvent *e) override
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 

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 this class is being phased out in favor of the KStatusNotifierItem class, you should consider to use it instead if you are writing a new application or consider porting the code that uses this class to the KStatusNotifierItem API.

Also, 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 KNotification instead.

Author
Matthias Ettrich ettri[email protected][email protected][email protected]de.or[email protected]g

Definition at line 60 of file ksystemtrayicon.h.

Constructor & Destructor Documentation

KSystemTrayIcon::KSystemTrayIcon ( QWidget parent = nullptr)
explicit

Construct a system tray icon.

The parent widget parent has a special meaning: Besides owning the tray window, the parent widget will disappear 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 109 of file ksystemtrayicon.cpp.

KSystemTrayIcon::KSystemTrayIcon ( const QString icon,
QWidget parent = nullptr 
)
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 116 of file ksystemtrayicon.cpp.

KSystemTrayIcon::KSystemTrayIcon ( const QIcon icon,
QWidget parent = nullptr 
)
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 123 of file ksystemtrayicon.cpp.

KSystemTrayIcon::KSystemTrayIcon ( QMovie movie,
QWidget parent 
)
explicit

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

Memory management for the movie will be handled by KSystemTrayIcon.

Definition at line 130 of file ksystemtrayicon.cpp.

KSystemTrayIcon::~KSystemTrayIcon ( )

Destructor.

Definition at line 175 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 340 of file ksystemtrayicon.cpp.

QAction * KSystemTrayIcon::contextMenuTitle ( ) const

Returns the context menu title action.

Since
4.1

Definition at line 372 of file ksystemtrayicon.cpp.

QIcon KSystemTrayIcon::loadIcon ( const QString icon,
const KComponentData componentData = KComponentData::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 345 of file ksystemtrayicon.cpp.

const QMovie * KSystemTrayIcon::movie ( ) const

Get a pointer to the movie.

Use this pointer to manipulate the movie (start, stop, pause). Will return null if no movie has been set

Since
4.2

Definition at line 390 of file ksystemtrayicon.cpp.

QWidget * KSystemTrayIcon::parentWidget ( ) const

Returns the QWidget set by the constructor.

Definition at line 170 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 357 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 365 of file ksystemtrayicon.cpp.

void KSystemTrayIcon::setMovie ( QMovie movie)

Set the movie to use.

To manipulate the movie (start, stop, pause), call

See also
movie() and make calls on the QMovie* that it returns. Memory management for the movie will be handled by KSystemTrayIcon.
Since
4.2

Definition at line 378 of file ksystemtrayicon.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Aug 10 2020 23:02:33 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.