Qt 4.8
Public Types | Public Functions | Static Public Functions | Public Variables | Static Public Variables | Protected Functions | Properties | Friends | List of all members
QSystemTrayIconSys Class Reference

#include <qsystemtrayicon_p.h>

Inheritance diagram for QSystemTrayIconSys:
QWidget QWidget QWidget QObject QPaintDevice

Public Types

enum  { SYSTEM_TRAY_REQUEST_DOCK = 0, SYSTEM_TRAY_BEGIN_MESSAGE = 1, SYSTEM_TRAY_CANCEL_MESSAGE =2 }
 

Public Functions

void addToTray ()
 
void createIcon ()
 
void createIcon ()
 
bool deliverToolTipEvent (QEvent *e)
 
QRect findIconGeometry (const int a_iButtonID)
 
QRect findTrayGeometry ()
 
XVisualInfo * getSysTrayVisualInfo ()
 
 QSystemTrayIconSys (QSystemTrayIcon *object)
 
 QSystemTrayIconSys (QSystemTrayIcon *object)
 
 QSystemTrayIconSys (QSystemTrayIcon *q)
 
 QSystemTrayIconSys (QSystemTrayIcon *icon, QSystemTrayIconPrivate *d)
 
void setIconContents (NOTIFYICONDATA &data)
 
void setIconContents (NOTIFYICONDATA &data)
 
bool showMessage (const QString &title, const QString &message, QSystemTrayIcon::MessageIcon type, uint uSecs)
 
bool trayMessage (DWORD msg)
 
bool trayMessage (DWORD msg)
 
void updateIcon ()
 
bool winEvent (MSG *m, long *result)
 This special event handler can be reimplemented in a subclass to receive native Windows events which are passed in the message parameter. More...
 
bool winEvent (MSG *m, long *result)
 This special event handler can be reimplemented in a subclass to receive native Windows events which are passed in the message parameter. More...
 
 ~QSystemTrayIconSys ()
 
 ~QSystemTrayIconSys ()
 
 ~QSystemTrayIconSys ()
 
 ~QSystemTrayIconSys ()
 

Static Public Functions

static Window locateSystemTray ()
 
static bool sysTrayTracker (void *message, long *result)
 

Public Variables

QPoint globalPos
 
HICON hIcon
 
QNSStatusItemitem
 

Static Public Variables

static QCoreApplication::EventFilter oldEventFilter = 0
 
static Atom sysTraySelection = XNone
 
static XVisualInfo sysTrayVisual = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
 
static Window sysTrayWindow = XNone
 
static QList< QSystemTrayIconSys * > trayIcons
 

Protected Functions

bool event (QEvent *e)
 This is the main event handler; it handles event event. More...
 
void mouseDoubleClickEvent (QMouseEvent *event)
 This event handler, for event event, can be reimplemented in a subclass to receive mouse double click events for the widget. More...
 
void mousePressEvent (QMouseEvent *event)
 This event handler, for event event, can be reimplemented in a subclass to receive mouse press events for the widget. More...
 
void paintEvent (QPaintEvent *pe)
 This event handler can be reimplemented in a subclass to receive paint events passed in event. More...
 
void resizeEvent (QResizeEvent *re)
 This event handler can be reimplemented in a subclass to receive widget resize events which are passed in the event parameter. More...
 
void wheelEvent (QWheelEvent *event)
 This event handler, for event event, can be reimplemented in a subclass to receive wheel events for the widget. More...
 
bool x11Event (XEvent *event)
 This special event handler can be reimplemented in a subclass to receive native X11 events passed in the event parameter. More...
 

Properties

QPixmap background
 
Colormap colormap
 
bool ignoreNextMouseRelease
 
int maxTipLength
 
uint notifyIconSize
 
QSystemTrayIconq
 
int version
 
- Properties inherited from QObject
QScopedPointer< QObjectDatad_ptr
 
- Properties inherited from QPaintDevice
ushort painters
 

Friends

class QSystemTrayIconPrivate
 

Additional Inherited Members

- Signals inherited from QWidget
void customContextMenuRequested (const QPoint &pos)
 This signal is emitted when the widget's contextMenuPolicy is Qt::CustomContextMenu, and the user has requested a context menu on the widget. More...
 
- Signals inherited from QObject
void destroyed (QObject *=0)
 This signal is emitted immediately before the object obj is destroyed, and can not be blocked. More...
 
- Private Types inherited from QWidget
enum  RenderFlag { DrawWindowBackground = 0x1, DrawChildren = 0x2, IgnoreMask = 0x4 }
 This enum describes how to render the widget when calling QWidget::render(). More...
 
- Private Types inherited from QPaintDevice
enum  PaintDeviceMetric {
  PdmWidth = 1, PdmHeight, PdmWidthMM, PdmHeightMM,
  PdmNumColors, PdmDepth, PdmDpiX, PdmDpiY,
  PdmPhysicalDpiX, PdmPhysicalDpiY
}
 
- Private Slots inherited from QWidget
bool close ()
 Closes this widget. More...
 
void hide ()
 Hides the widget. More...
 
void lower ()
 Lowers the widget to the bottom of the parent widget's stack. More...
 
void raise ()
 Raises this widget to the top of the parent widget's stack. More...
 
void repaint ()
 Repaints the widget directly by calling paintEvent() immediately, unless updates are disabled or the widget is hidden. More...
 
void setDisabled (bool)
 Disables widget input events if disable is true; otherwise enables input events. More...
 
void setEnabled (bool)
 
void setFocus ()
 Gives the keyboard input focus to this widget (or its focus proxy) if this widget or one of its parents is the active window. More...
 
void setHidden (bool hidden)
 Convenience function, equivalent to setVisible(!hidden). More...
 
QT_MOC_COMPAT void setShown (bool shown)
 Use setVisible(shown) instead. More...
 
void setStyleSheet (const QString &styleSheet)
 
virtual void setVisible (bool visible)
 
void setWindowModified (bool)
 
void setWindowTitle (const QString &)
 
void show ()
 Shows the widget and its child widgets. More...
 
void showFullScreen ()
 Shows the widget in full-screen mode. More...
 
void showMaximized ()
 Shows the widget maximized. More...
 
void showMinimized ()
 Shows the widget minimized, as an icon. More...
 
void showNormal ()
 Restores the widget after it has been maximized or minimized. More...
 
void update ()
 Updates the widget unless updates are disabled or the widget is hidden. More...
 
void updateMicroFocus ()
 Updates the widget's micro focus. More...
 
- Private Slots inherited from QObject
void deleteLater ()
 Schedules this object for deletion. More...
 
- Private Functions inherited from QWidget
bool acceptDrops () const
 
QString accessibleDescription () const
 
QString accessibleName () const
 
QList< QAction * > actions () const
 Returns the (possibly empty) list of this widget's actions. More...
 
void activateWindow ()
 Sets the top-level widget containing this widget to be the active window. More...
 
void addAction (QAction *action)
 Appends the action action to this widget's list of actions. More...
 
void addActions (QList< QAction *> actions)
 Appends the actions actions to this widget's list of actions. More...
 
void adjustSize ()
 Adjusts the size of the widget to fit its contents. More...
 
bool autoFillBackground () const
 
QPalette::ColorRole backgroundRole () const
 Returns the background role of the widget. More...
 
QSize baseSize () const
 
QWidgetchildAt (int x, int y) const
 Returns the visible child widget at the position ({x}, {y}) in the widget's coordinate system. More...
 
QWidgetchildAt (const QPoint &p) const
 Returns the visible child widget at point p in the widget's own coordinate system. More...
 
QRect childrenRect () const
 
QRegion childrenRegion () const
 
void clearFocus ()
 Takes keyboard input focus from the widget. More...
 
void clearMask ()
 Removes any mask set by setMask(). More...
 
QMargins contentsMargins () const
 The contentsMargins function returns the widget's contents margins. More...
 
QRect contentsRect () const
 Returns the area inside the widget's margins. More...
 
Qt::ContextMenuPolicy contextMenuPolicy () const
 
void createWinId ()
 
QCursor cursor () const
 
int devType () const
 
WId effectiveWinId () const
 Returns the effective window system identifier of the widget, i. More...
 
void ensurePolished () const
 Ensures that the widget has been polished by QStyle (i.e., has a proper font and palette). More...
 
Qt::FocusPolicy focusPolicy () const
 
QWidgetfocusProxy () const
 Returns the focus proxy, or 0 if there is no focus proxy. More...
 
QWidgetfocusWidget () const
 Returns the last child of this widget that setFocus had been called on. More...
 
const QFontfont () const
 
QFontInfo fontInfo () const
 Returns the font info for the widget's current font. More...
 
QFontMetrics fontMetrics () const
 Returns the font metrics for the widget's current font. More...
 
QPalette::ColorRole foregroundRole () const
 Returns the foreground role. More...
 
QRect frameGeometry () const
 
QSize frameSize () const
 
const QRectgeometry () const
 
void getContentsMargins (int *left, int *top, int *right, int *bottom) const
 Returns the widget's contents margins for left, top, right, and bottom. More...
 
HDC getDC () const
 Returns the window system handle of the widget, for low-level access. More...
 
void grabGesture (Qt::GestureType type, Qt::GestureFlags flags=Qt::GestureFlags())
 Subscribes the widget to a given gesture with specific flags. More...
 
void grabKeyboard ()
 Grabs the keyboard input. More...
 
void grabMouse ()
 Grabs the mouse input. More...
 
void grabMouse (const QCursor &)
 
int grabShortcut (const QKeySequence &key, Qt::ShortcutContext context=Qt::WindowShortcut)
 Adds a shortcut to Qt's shortcut system that watches for the given key sequence in the given context. More...
 
QGraphicsEffectgraphicsEffect () const
 The graphicsEffect function returns a pointer to the widget's graphics effect. More...
 
QGraphicsProxyWidgetgraphicsProxyWidget () const
 Returns the proxy widget for the corresponding embedded widget in a graphics view; otherwise returns 0. More...
 
bool hasFocus () const
 
bool hasMouseTracking () const
 
int height () const
 
virtual int heightForWidth (int) const
 Returns the preferred height for this widget, given the width w. More...
 
QInputContextinputContext ()
 This function returns the QInputContext for this widget. More...
 
Qt::InputMethodHints inputMethodHints () const
 
virtual QVariant inputMethodQuery (Qt::InputMethodQuery) const
 This method is only relevant for input widgets. More...
 
void insertAction (QAction *before, QAction *action)
 Inserts the action action to this widget's list of actions, before the action before. More...
 
void insertActions (QAction *before, QList< QAction *> actions)
 Inserts the actions actions to this widget's list of actions, before the action before. More...
 
WId internalWinId () const
 Returns the window system identifier of the widget, or 0 if the widget is not created yet. More...
 
bool isActiveWindow () const
 
bool isAncestorOf (const QWidget *child) const
 Returns true if this widget is a parent, (or grandparent and so on to any level), of the given child, and both widgets are within the same window; otherwise returns false. More...
 
bool isEnabled () const
 
bool isEnabledTo (QWidget *) const
 Returns true if this widget would become enabled if ancestor is enabled; otherwise returns false. More...
 
bool isEnabledToTLW () const
 This function is deprecated. More...
 
bool isFullScreen () const
 
bool isHidden () const
 Returns true if the widget is hidden, otherwise returns false. More...
 
bool isLeftToRight () const
 
bool isMaximized () const
 
bool isMinimized () const
 
bool isModal () const
 
bool isRightToLeft () const
 
bool isTopLevel () const
 Use isWindow() instead. More...
 
bool isVisible () const
 
bool isVisibleTo (QWidget *) const
 Returns true if this widget would become visible if ancestor is shown; otherwise returns false. More...
 
bool isWindow () const
 Returns true if the widget is an independent window, otherwise returns false. More...
 
bool isWindowModified () const
 
QLayoutlayout () const
 Returns the layout manager that is installed on this widget, or 0 if no layout manager is installed. More...
 
Qt::LayoutDirection layoutDirection () const
 
QLocale locale () const
 
Qt::HANDLE macCGHandle () const
 Returns the CoreGraphics handle of the widget. More...
 
Qt::HANDLE macQDHandle () const
 Returns the QuickDraw handle of the widget. More...
 
QPoint mapFrom (QWidget *, const QPoint &) const
 Translates the widget coordinate pos from the coordinate system of parent to this widget's coordinate system. More...
 
QPoint mapFromGlobal (const QPoint &) const
 Translates the global screen coordinate pos to widget coordinates. More...
 
QPoint mapFromParent (const QPoint &) const
 Translates the parent widget coordinate pos to widget coordinates. More...
 
QPoint mapTo (QWidget *, const QPoint &) const
 Translates the widget coordinate pos to the coordinate system of parent. More...
 
QPoint mapToGlobal (const QPoint &) const
 Translates the widget coordinate pos to global screen coordinates. More...
 
QPoint mapToParent (const QPoint &) const
 Translates the widget coordinate pos to a coordinate in the parent widget. More...
 
QRegion mask () const
 Returns the mask currently set on a widget. More...
 
int maximumHeight () const
 
QSize maximumSize () const
 
int maximumWidth () const
 
int minimumHeight () const
 
QSize minimumSize () const
 
virtual QSize minimumSizeHint () const
 
int minimumWidth () const
 
void move (int x, int y)
 This corresponds to move(QPoint(x, y)). More...
 
void move (const QPoint &)
 
QWidgetnativeParentWidget () const
 Returns the native parent for this widget, i. More...
 
QWidgetnextInFocusChain () const
 Returns the next widget in this widget's focus chain. More...
 
QRect normalGeometry () const
 
void overrideWindowFlags (Qt::WindowFlags type)
 Sets the window flags for the widget to flags, without telling the window system. More...
 
void overrideWindowState (Qt::WindowStates state)
 
QPaintEnginepaintEngine () const
 Returns the widget's paint engine. More...
 
const QPalettepalette () const
 
QWidgetparentWidget () const
 Returns the parent of this widget, or 0 if it does not have any parent widget. More...
 
QPoint pos () const
 
QWidgetpreviousInFocusChain () const
 The previousInFocusChain function returns the previous widget in this widget's focus chain. More...
 
 QWidget (QWidget *parent=0, Qt::WindowFlags f=0)
 Constructs a widget which is a child of parent, with widget flags set to f. More...
 
QRect rect () const
 
void releaseDC (HDC) const
 Releases the HDC hdc acquired by a previous call to getDC(). More...
 
void releaseKeyboard ()
 Releases the keyboard grab. More...
 
void releaseMouse ()
 Releases the mouse grab. More...
 
void releaseShortcut (int id)
 Removes the shortcut with the given id from Qt's shortcut system. More...
 
void removeAction (QAction *action)
 Removes the action action from this widget's list of actions. More...
 
void render (QPaintDevice *target, const QPoint &targetOffset=QPoint(), const QRegion &sourceRegion=QRegion(), RenderFlags renderFlags=RenderFlags(DrawWindowBackground|DrawChildren))
 Renders the sourceRegion of this widget into the target using renderFlags to determine how to render. More...
 
void render (QPainter *painter, const QPoint &targetOffset=QPoint(), const QRegion &sourceRegion=QRegion(), RenderFlags renderFlags=RenderFlags(DrawWindowBackground|DrawChildren))
 Renders the widget into the painter's QPainter::device(). More...
 
void repaint (int x, int y, int w, int h)
 This version repaints a rectangle (x, y, w, h) inside the widget. More...
 
void repaint (const QRect &)
 This version repaints a rectangle rect inside the widget. More...
 
void repaint (const QRegion &)
 This version repaints a region rgn inside the widget. More...
 
void resize (int w, int h)
 This corresponds to resize(QSize(w, h)). More...
 
void resize (const QSize &)
 
bool restoreGeometry (const QByteArray &geometry)
 Restores the geometry and state top-level widgets stored in the byte array geometry. More...
 
QByteArray saveGeometry () const
 Saves the current geometry and state for top-level widgets. More...
 
void scroll (int dx, int dy)
 Scrolls the widget including its children dx pixels to the right and dy downward. More...
 
void scroll (int dx, int dy, const QRect &)
 This version only scrolls r and does not move the children of the widget. More...
 
void setAcceptDrops (bool on)
 
void setAccessibleDescription (const QString &description)
 
void setAccessibleName (const QString &name)
 
void setAttribute (Qt::WidgetAttribute, bool on=true)
 Sets the attribute attribute on this widget if on is true; otherwise clears the attribute. More...
 
void setAutoFillBackground (bool enabled)
 
void setBackgroundRole (QPalette::ColorRole)
 Sets the background role of the widget to role. More...
 
void setBaseSize (const QSize &)
 
void setBaseSize (int basew, int baseh)
 This corresponds to setBaseSize(QSize(basew, baseh)). More...
 
void setContentsMargins (int left, int top, int right, int bottom)
 Sets the margins around the contents of the widget to have the sizes left, top, right, and bottom. More...
 
void setContentsMargins (const QMargins &margins)
 The setContentsMargins function sets the margins around the widget's contents. More...
 
void setContextMenuPolicy (Qt::ContextMenuPolicy policy)
 
void setCursor (const QCursor &)
 
void setFixedHeight (int h)
 Sets both the minimum and maximum heights of the widget to h without changing the widths. More...
 
void setFixedSize (const QSize &)
 Sets both the minimum and maximum sizes of the widget to s, thereby preventing it from ever growing or shrinking. More...
 
void setFixedSize (int w, int h)
 Sets the width of the widget to w and the height to h. More...
 
void setFixedWidth (int w)
 Sets both the minimum and maximum width of the widget to w without changing the heights. More...
 
void setFocus (Qt::FocusReason reason)
 Gives the keyboard input focus to this widget (or its focus proxy) if this widget or one of its parents is the active window. More...
 
void setFocusPolicy (Qt::FocusPolicy policy)
 
void setFocusProxy (QWidget *)
 Sets the widget's focus proxy to widget w. More...
 
void setFont (const QFont &)
 Use the single-argument overload instead. More...
 
void setForegroundRole (QPalette::ColorRole)
 Sets the foreground role of the widget to role. More...
 
void setGeometry (int x, int y, int w, int h)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This corresponds to setGeometry(QRect(x, y, w, h)). More...
 
void setGeometry (const QRect &)
 
void setGraphicsEffect (QGraphicsEffect *effect)
 The setGraphicsEffect function is for setting the widget's graphics effect. More...
 
void setInputContext (QInputContext *)
 This function sets the input context context on this widget. More...
 
void setInputMethodHints (Qt::InputMethodHints hints)
 
void setLayout (QLayout *)
 Sets the layout manager for this widget to layout. More...
 
void setLayoutDirection (Qt::LayoutDirection direction)
 
void setLocale (const QLocale &locale)
 
void setMask (const QBitmap &)
 Causes only the pixels of the widget for which bitmap has a corresponding 1 bit to be visible. More...
 
void setMask (const QRegion &)
 Causes only the parts of the widget which overlap region to be visible. More...
 
void setMaximumHeight (int maxh)
 
void setMaximumSize (const QSize &)
 
void setMaximumSize (int maxw, int maxh)
 This function corresponds to setMaximumSize(QSize(maxw, maxh)). More...
 
void setMaximumWidth (int maxw)
 
void setMinimumHeight (int minh)
 
void setMinimumSize (const QSize &)
 
void setMinimumSize (int minw, int minh)
 This function corresponds to setMinimumSize(QSize(minw, minh)). More...
 
void setMinimumWidth (int minw)
 
void setMouseTracking (bool enable)
 
void setPalette (const QPalette &)
 Use the single-argument overload instead. More...
 
void setParent (QWidget *parent)
 Sets the parent of the widget to parent, and resets the window flags. More...
 
void setParent (QWidget *parent, Qt::WindowFlags f)
 This function also takes widget flags, f as an argument. More...
 
void setShortcutAutoRepeat (int id, bool enable=true)
 If enable is true, auto repeat of the shortcut with the given id is enabled; otherwise it is disabled. More...
 
void setShortcutEnabled (int id, bool enable=true)
 If enable is true, the shortcut with the given id is enabled; otherwise the shortcut is disabled. More...
 
void setSizeIncrement (const QSize &)
 
void setSizeIncrement (int w, int h)
 Sets the x (width) size increment to w and the y (height) size increment to h. More...
 
void setSizePolicy (QSizePolicy)
 
void setSizePolicy (QSizePolicy::Policy horizontal, QSizePolicy::Policy vertical)
 Sets the size policy of the widget to horizontal and vertical, with standard stretch and no height-for-width. More...
 
void setStatusTip (const QString &)
 
void setStyle (QStyle *)
 Sets the widget's GUI style to style. More...
 
void setToolTip (const QString &)
 
void setUpdatesEnabled (bool enable)
 
void setupUi (QWidget *widget)
 Sets up the user interface for the specified widget. More...
 
void setWhatsThis (const QString &)
 
void setWindowFilePath (const QString &filePath)
 
void setWindowFlags (Qt::WindowFlags type)
 
void setWindowIcon (const QIcon &icon)
 
void setWindowIconText (const QString &)
 
void setWindowModality (Qt::WindowModality windowModality)
 
void setWindowOpacity (qreal level)
 
void setWindowRole (const QString &)
 Sets the window's role to role. More...
 
void setWindowState (Qt::WindowStates state)
 Sets the window state to windowState. More...
 
void setWindowSurface (QWindowSurface *surface)
 Sets the window surface to be the surface specified. More...
 
QSize size () const
 
virtual QSize sizeHint () const
 
QSize sizeIncrement () const
 
QSizePolicy sizePolicy () const
 
void stackUnder (QWidget *)
 Places the widget under w in the parent widget's stack. More...
 
QString statusTip () const
 
QStylestyle () const
 
QString styleSheet () const
 
bool testAttribute (Qt::WidgetAttribute) const
 Returns true if attribute attribute is set on this widget; otherwise returns false. More...
 
QString toolTip () const
 
QWidgettopLevelWidget () const
 
bool underMouse () const
 Returns true if the widget is under the mouse cursor; otherwise returns false. More...
 
void ungrabGesture (Qt::GestureType type)
 Unsubscribes the widget from a given gesture type. More...
 
void unsetCursor ()
 
void unsetLayoutDirection ()
 
void unsetLocale ()
 
void update (int x, int y, int w, int h)
 This version updates a rectangle (x, y, w, h) inside the widget. More...
 
void update (const QRect &)
 This version updates a rectangle rect inside the widget. More...
 
void update (const QRegion &)
 This version repaints a region rgn inside the widget. More...
 
void updateGeometry ()
 Notifies the layout system that this widget has changed and may need to change geometry. More...
 
bool updatesEnabled () const
 
QRegion visibleRegion () const
 Returns the unobscured region where paint events can occur. More...
 
QString whatsThis () const
 
int width () const
 
QWidgetwindow () const
 Returns the window for this widget, i.e. More...
 
QString windowFilePath () const
 
Qt::WindowFlags windowFlags () const
 Window flags are a combination of a type (e. More...
 
QIcon windowIcon () const
 
QString windowIconText () const
 
Qt::WindowModality windowModality () const
 
qreal windowOpacity () const
 
QString windowRole () const
 Returns the window's role, or an empty string. More...
 
Qt::WindowStates windowState () const
 Returns the current window state. More...
 
QWindowSurfacewindowSurface () const
 Returns the QWindowSurface this widget will be drawn into. More...
 
QString windowTitle () const
 
Qt::WindowType windowType () const
 Returns the window type of this widget. More...
 
WId winId () const
 Returns the window system identifier of the widget. More...
 
int x () const
 
const QX11Infox11Info () const
 Returns information about the configuration of the X display used to display the widget. More...
 
Qt::HANDLE x11PictureHandle () const
 Returns the X11 Picture handle of the widget for XRender support. More...
 
int y () const
 
 ~QWidget ()
 Destroys the widget. More...
 
virtual void actionEvent (QActionEvent *)
 This event handler is called with the given event whenever the widget's actions are changed. More...
 
virtual void changeEvent (QEvent *)
 This event handler can be reimplemented to handle state changes. More...
 
virtual void closeEvent (QCloseEvent *)
 This event handler is called with the given event when Qt receives a window close request for a top-level widget from the window system. More...
 
virtual void contextMenuEvent (QContextMenuEvent *)
 This event handler, for event event, can be reimplemented in a subclass to receive widget context menu events. More...
 
void create (WId=0, bool initializeWindow=true, bool destroyOldWindow=true)
 Creates a new widget window if window is 0, otherwise sets the widget's window to window. More...
 
void destroy (bool destroyWindow=true, bool destroySubWindows=true)
 Frees up window system resources. More...
 
virtual void dragEnterEvent (QDragEnterEvent *)
 This event handler is called when a drag is in progress and the mouse enters this widget. More...
 
virtual void dragLeaveEvent (QDragLeaveEvent *)
 This event handler is called when a drag is in progress and the mouse leaves this widget. More...
 
virtual void dragMoveEvent (QDragMoveEvent *)
 This event handler is called if a drag is in progress, and when any of the following conditions occur: the cursor enters this widget, the cursor moves within this widget, or a modifier key is pressed on the keyboard while this widget has the focus. More...
 
virtual void dropEvent (QDropEvent *)
 This event handler is called when the drag is dropped on this widget. More...
 
virtual void enabledChange (bool)
 
virtual void enterEvent (QEvent *)
 This event handler can be reimplemented in a subclass to receive widget enter events which are passed in the event parameter. More...
 
virtual void focusInEvent (QFocusEvent *)
 This event handler can be reimplemented in a subclass to receive keyboard focus events (focus received) for the widget. More...
 
bool focusNextChild ()
 Finds a new widget to give the keyboard focus to, as appropriate for Tab, and returns true if it can find a new widget, or false if it can't. More...
 
virtual bool focusNextPrevChild (bool next)
 Finds a new widget to give the keyboard focus to, as appropriate for Tab and Shift+Tab, and returns true if it can find a new widget, or false if it can't. More...
 
virtual void focusOutEvent (QFocusEvent *)
 This event handler can be reimplemented in a subclass to receive keyboard focus events (focus lost) for the widget. More...
 
bool focusPreviousChild ()
 Finds a new widget to give the keyboard focus to, as appropriate for Shift+Tab, and returns true if it can find a new widget, or false if it can't. More...
 
virtual void fontChange (const QFont &)
 
virtual void hideEvent (QHideEvent *)
 This event handler can be reimplemented in a subclass to receive widget hide events. More...
 
virtual void inputMethodEvent (QInputMethodEvent *)
 This event handler, for event event, can be reimplemented in a subclass to receive Input Method composition events. More...
 
virtual void keyPressEvent (QKeyEvent *)
 This event handler, for event event, can be reimplemented in a subclass to receive key press events for the widget. More...
 
virtual void keyReleaseEvent (QKeyEvent *)
 This event handler, for event event, can be reimplemented in a subclass to receive key release events for the widget. More...
 
virtual void languageChange ()
 
virtual void leaveEvent (QEvent *)
 This event handler can be reimplemented in a subclass to receive widget leave events which are passed in the event parameter. More...
 
virtual bool macEvent (EventHandlerCallRef, EventRef)
 This special event handler can be reimplemented in a subclass to receive native Macintosh events. More...
 
int metric (PaintDeviceMetric) const
 Internal implementation of the virtual QPaintDevice::metric() function. More...
 
virtual void mouseMoveEvent (QMouseEvent *)
 This event handler, for event event, can be reimplemented in a subclass to receive mouse move events for the widget. More...
 
virtual void mouseReleaseEvent (QMouseEvent *)
 This event handler, for event event, can be reimplemented in a subclass to receive mouse release events for the widget. More...
 
virtual void moveEvent (QMoveEvent *)
 This event handler can be reimplemented in a subclass to receive widget move events which are passed in the event parameter. More...
 
virtual void paletteChange (const QPalette &)
 
 QWidget (QWidgetPrivate &d, QWidget *parent, Qt::WindowFlags f)
 
virtual bool qwsEvent (QWSEvent *)
 This special event handler can be reimplemented in a subclass to receive native Qt for Embedded Linux events which are passed in the event parameter. More...
 
void resetInputContext ()
 This function can be called on the widget that currently has focus to reset the input method operating on it. More...
 
virtual void showEvent (QShowEvent *)
 This event handler can be reimplemented in a subclass to receive widget show events which are passed in the event parameter. More...
 
virtual void styleChange (QStyle &)
 
virtual void tabletEvent (QTabletEvent *)
 This event handler, for event event, can be reimplemented in a subclass to receive tablet events for the widget. More...
 
virtual void windowActivationChange (bool)
 
- Private Functions inherited from QObject
bool blockSignals (bool b)
 If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). More...
 
const QObjectListchildren () const
 Returns a list of child objects. More...
 
bool connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0)
 
bool disconnect (const QObject *receiver, const char *member=0)
 
void dumpObjectInfo ()
 Dumps information about signal connections, etc. More...
 
void dumpObjectTree ()
 Dumps a tree of children to the debug output. More...
 
QList< QByteArraydynamicPropertyNames () const
 Returns the names of all properties that were dynamically added to the object using setProperty(). More...
 
virtual bool eventFilter (QObject *, QEvent *)
 Filters events if this object has been installed as an event filter for the watched object. More...
 
template<typename T >
findChild (const QString &aName=QString()) const
 Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object. More...
 
template<typename T >
QList< T > findChildren (const QString &aName=QString()) const
 Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. More...
 
template<typename T >
QList< T > findChildren (const QRegExp &re) const
 
bool inherits (const char *classname) const
 Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false. More...
 
void installEventFilter (QObject *)
 Installs an event filter filterObj on this object. More...
 
bool isWidgetType () const
 Returns true if the object is a widget; otherwise returns false. More...
 
void killTimer (int id)
 Kills the timer with timer identifier, id. More...
 
virtual const QMetaObjectmetaObject () const
 Returns a pointer to the meta-object of this object. More...
 
void moveToThread (QThread *thread)
 Changes the thread affinity for this object and its children. More...
 
QString objectName () const
 
QObjectparent () const
 Returns a pointer to the parent object. More...
 
QVariant property (const char *name) const
 Returns the value of the object's name property. More...
 
Q_INVOKABLE QObject (QObject *parent=0)
 Constructs an object with parent object parent. More...
 
void removeEventFilter (QObject *)
 Removes an event filter object obj from this object. More...
 
void setObjectName (const QString &name)
 
void setParent (QObject *)
 Makes the object a child of parent. More...
 
bool setProperty (const char *name, const QVariant &value)
 Sets the value of the object's name property to value. More...
 
void setUserData (uint id, QObjectUserData *data)
 
bool signalsBlocked () const
 Returns true if signals are blocked; otherwise returns false. More...
 
int startTimer (int interval)
 Starts a timer and returns a timer identifier, or returns zero if it could not start a timer. More...
 
QThreadthread () const
 Returns the thread in which the object lives. More...
 
QObjectUserDatauserData (uint id) const
 
virtual ~QObject ()
 Destroys the object, deleting all its child objects. More...
 
virtual void childEvent (QChildEvent *)
 This event handler can be reimplemented in a subclass to receive child events. More...
 
virtual void connectNotify (const char *signal)
 This virtual function is called when something has been connected to signal in this object. More...
 
virtual void customEvent (QEvent *)
 This event handler can be reimplemented in a subclass to receive custom events. More...
 
virtual void disconnectNotify (const char *signal)
 This virtual function is called when something has been disconnected from signal in this object. More...
 
 QObject (QObjectPrivate &dd, QObject *parent=0)
 
int receivers (const char *signal) const
 Returns the number of receivers connected to the signal. More...
 
QObjectsender () const
 Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns 0. More...
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *)
 This event handler can be reimplemented in a subclass to receive timer events for the object. More...
 
- Private Functions inherited from QPaintDevice
int colorCount () const
 
int depth () const
 
int height () const
 
int heightMM () const
 
int logicalDpiX () const
 
int logicalDpiY () const
 
QT_DEPRECATED int numColors () const
 
bool paintingActive () const
 
int physicalDpiX () const
 
int physicalDpiY () const
 
int width () const
 
int widthMM () const
 
virtual ~QPaintDevice ()
 
 QPaintDevice ()
 
- Static Private Functions inherited from QWidget
static QWidgetfind (WId)
 Returns a pointer to the widget with window identifer/handle id. More...
 
static QWidgetkeyboardGrabber ()
 Returns the widget that is currently grabbing the keyboard input. More...
 
static QWidgetmouseGrabber ()
 Returns the widget that is currently grabbing the mouse input. More...
 
static void setTabOrder (QWidget *, QWidget *)
 Puts the second widget after the first widget in the focus order. More...
 
- Static Private Functions inherited from QObject
static bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 Creates a connection of the given type from the signal in the sender object to the method in the receiver object. More...
 
static bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 Disconnects signal in object sender from method in object receiver. More...
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static uint registerUserData ()
 
static QString tr (const char *sourceText, const char *comment=0, int n=-1)
 
static QString trUtf8 (const char *sourceText, const char *comment=0, int n=-1)
 
- Static Private Functions inherited from QPaintDevice
static QWSDisplayqwsDisplay ()
 
- Static Private Attributes inherited from QObject
static const QMetaObject staticMetaObject
 This variable stores the meta-object for the class. More...
 
static const QMetaObject staticQtMetaObject
 

Detailed Description

Definition at line 145 of file qsystemtrayicon_mac.mm.

Enumerations

◆ anonymous enum

anonymous enum
Enumerator
SYSTEM_TRAY_REQUEST_DOCK 
SYSTEM_TRAY_BEGIN_MESSAGE 
SYSTEM_TRAY_CANCEL_MESSAGE 

Definition at line 140 of file qsystemtrayicon_p.h.

Constructors and Destructors

◆ QSystemTrayIconSys() [1/4]

QSystemTrayIconSys::QSystemTrayIconSys ( QSystemTrayIcon icon,
QSystemTrayIconPrivate d 
)
inline

Definition at line 148 of file qsystemtrayicon_mac.mm.

Referenced by QSystemTrayIconPrivate::install_sys(), sysTrayTracker(), winEvent(), and x11Event().

148  {
150  item = [[QT_MANGLE_NAMESPACE(QNSStatusItem) alloc] initWithIcon:icon iconPrivate:d];
151  }

◆ ~QSystemTrayIconSys() [1/4]

QSystemTrayIconSys::~QSystemTrayIconSys ( )
inline

Definition at line 152 of file qsystemtrayicon_mac.mm.

Referenced by QSystemTrayIconSys().

152  {
154  [[[item item] view] setHidden: YES];
155  [item release];
156  }

◆ QSystemTrayIconSys() [2/4]

QSystemTrayIconSys::QSystemTrayIconSys ( QSystemTrayIcon q)

Definition at line 137 of file qsystemtrayicon_win.cpp.

138  : hIcon(0), q(object), ignoreNextMouseRelease(false)
139 
140 {
142  notifyIconSize = sizeof(NOTIFYICONDATA);
144  } else {
145  notifyIconSize = NOTIFYICONDATA_V2_SIZE;
146  version = NOTIFYICON_VERSION;
147  }
148 
149  maxTipLength = 128;
150 
151  // For restoring the tray icon after explorer crashes
152  if (!MYWM_TASKBARCREATED) {
153  MYWM_TASKBARCREATED = RegisterWindowMessage(L"TaskbarCreated");
154  }
155 
156  // Allow the WM_TASKBARCREATED message through the UIPI filter on Windows Vista and higher
157  static PtrChangeWindowMessageFilterEx pChangeWindowMessageFilterEx =
158  (PtrChangeWindowMessageFilterEx)QSystemLibrary::resolve(QLatin1String("user32"), "ChangeWindowMessageFilterEx");
159 
160  if (pChangeWindowMessageFilterEx) {
161  // Call the safer ChangeWindowMessageFilterEx API if available
162  pChangeWindowMessageFilterEx(winId(), MYWM_TASKBARCREATED, Q_MSGFLT_ALLOW, 0);
163  } else {
164  static PtrChangeWindowMessageFilter pChangeWindowMessageFilter =
165  (PtrChangeWindowMessageFilter)QSystemLibrary::resolve(QLatin1String("user32"), "ChangeWindowMessageFilter");
166 
167  if (pChangeWindowMessageFilter) {
168  // Call the deprecated ChangeWindowMessageFilter API otherwise
169  pChangeWindowMessageFilter(MYWM_TASKBARCREATED, Q_MSGFLT_ALLOW);
170  }
171  }
172 }
BOOL(WINAPI * PtrChangeWindowMessageFilter)(UINT message, DWORD dwFlag)
static WinVersion windowsVersion()
Returns the version of the Windows operating system on which the application is run (Windows only)...
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
QSystemTrayIcon * q
static uint MYWM_TASKBARCREATED
void * resolve(const char *symbol)
#define Q_MSGFLT_ALLOW
#define NOTIFYICON_VERSION_4
WId winId() const
Returns the window system identifier of the widget.
Definition: qwidget.cpp:2557
BOOL(WINAPI * PtrChangeWindowMessageFilterEx)(HWND hWnd, UINT message, DWORD action, void *pChangeFilterStruct)

◆ ~QSystemTrayIconSys() [2/4]

QSystemTrayIconSys::~QSystemTrayIconSys ( )

◆ QSystemTrayIconSys() [3/4]

QSystemTrayIconSys::QSystemTrayIconSys ( QSystemTrayIcon object)

◆ ~QSystemTrayIconSys() [3/4]

QSystemTrayIconSys::~QSystemTrayIconSys ( )

◆ QSystemTrayIconSys() [4/4]

QSystemTrayIconSys::QSystemTrayIconSys ( QSystemTrayIcon object)

◆ ~QSystemTrayIconSys() [4/4]

QSystemTrayIconSys::~QSystemTrayIconSys ( )

Functions

◆ addToTray()

void QSystemTrayIconSys::addToTray ( )

Definition at line 216 of file qsystemtrayicon_x11.cpp.

217 {
220 
221  XVisualInfo *vi = getSysTrayVisualInfo();
222  if (vi && vi->visual) {
223  Window root = RootWindow(display, vi->screen);
224  Window p = root;
225  if (QWidget *pw = parentWidget())
226  p = pw->effectiveWinId();
227  colormap = XCreateColormap(display, root, vi->visual, AllocNone);
228  XSetWindowAttributes wsa;
229  wsa.background_pixmap = 0;
230  wsa.colormap = colormap;
231  wsa.background_pixel = 0;
232  wsa.border_pixel = 0;
233  Window wid = XCreateWindow(display, p, -1, -1, 1, 1,
234  0, vi->depth, InputOutput, vi->visual,
235  CWBackPixmap|CWBackPixel|CWBorderPixel|CWColormap, &wsa);
236  create(wid);
237  } else {
238  XSetWindowBackgroundPixmap(display, winId(), ParentRelative);
239  }
240 
241  // GNOME, NET WM Specification
242  static Atom netwm_tray_atom = XInternAtom(display, "_NET_SYSTEM_TRAY_OPCODE", False);
243  long l[5] = { CurrentTime, SYSTEM_TRAY_REQUEST_DOCK, static_cast<long>(winId()), 0, 0 };
244  XEvent ev;
245  memset(&ev, 0, sizeof(ev));
246  ev.xclient.type = ClientMessage;
247  ev.xclient.window = sysTrayWindow;
248  ev.xclient.message_type = netwm_tray_atom;
249  ev.xclient.format = 32;
250  memcpy((char *)&ev.xclient.data, (const char *) l, sizeof(l));
251  XSendEvent(display, sysTrayWindow, False, 0, &ev);
252  setMinimumSize(22, 22); // required at least on GNOME
253 }
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
void setMinimumSize(const QSize &)
Definition: qwidget.h:969
static Window sysTrayWindow
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
union _XEvent XEvent
Definition: qwindowdefs.h:116
Q_GUI_EXPORT EGLDisplay display()
Definition: qegl.cpp:589
void create(WId=0, bool initializeWindow=true, bool destroyOldWindow=true)
Creates a new widget window if window is 0, otherwise sets the widget&#39;s window to window...
Definition: qwidget.cpp:1454
struct _XDisplay Display
Definition: qwindowdefs.h:115
QFactoryLoader * l
XVisualInfo * getSysTrayVisualInfo()
WId winId() const
Returns the window system identifier of the widget.
Definition: qwidget.cpp:2557
static Display * display()
Returns the default display for the application.

◆ createIcon() [1/2]

void QSystemTrayIconSys::createIcon ( )

◆ createIcon() [2/2]

void QSystemTrayIconSys::createIcon ( )

Definition at line 255 of file qsystemtrayicon_win.cpp.

Referenced by findTrayGeometry().

256 {
257  hIcon = 0;
258  QIcon icon = q->icon();
259  if (icon.isNull())
260  return;
261 
262  const int iconSizeX = GetSystemMetrics(SM_CXSMICON);
263  const int iconSizeY = GetSystemMetrics(SM_CYSMICON);
264  QSize size = icon.actualSize(QSize(iconSizeX, iconSizeY));
265  QPixmap pm = icon.pixmap(size);
266  if (pm.isNull())
267  return;
268 
269  hIcon = pm.toWinHICON();
270 }
QSize size() const
QSystemTrayIcon * q
bool isNull() const
Returns true if the icon is empty; otherwise returns false.
Definition: qicon.cpp:769
QIcon icon
the system tray icon
HICON toWinHICON() const
Returns the HICON handle.
QSize actualSize(const QSize &size, Mode mode=Normal, State state=Off) const
Returns the actual size of the icon for the requested size, mode, and state.
Definition: qicon.cpp:730
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
QPixmap pixmap(const QSize &size, Mode mode=Normal, State state=Off) const
Returns a pixmap with the requested size, mode, and state, generating one if necessary.
Definition: qicon.cpp:693
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
bool isNull() const
Returns true if this is a null pixmap; otherwise returns false.
Definition: qpixmap.cpp:615
The QIcon class provides scalable icons in different modes and states.
Definition: qicon.h:60

◆ deliverToolTipEvent()

bool QSystemTrayIconSys::deliverToolTipEvent ( QEvent e)
inline

Definition at line 152 of file qsystemtrayicon_p.h.

153  { return QWidget::event(e); }
bool event(QEvent *)
This is the main event handler; it handles event event.
Definition: qwidget.cpp:8636

◆ event()

bool QSystemTrayIconSys::event ( QEvent event)
protectedvirtual

This is the main event handler; it handles event event.

You can reimplement this function in a subclass, but we recommend using one of the specialized event handlers instead.

Key press and release events are treated differently from other events. event() checks for Tab and Shift+Tab and tries to move the focus appropriately. If there is no widget to move the focus to (or the key press is not Tab or Shift+Tab), event() calls keyPressEvent().

Mouse and tablet event handling is also slightly special: only when the widget is enabled , event() will call the specialized handlers such as mousePressEvent(); otherwise it will discard the event.

This function returns true if the event was recognized, otherwise it returns false. If the recognized event was accepted (see QEvent::accepted ), any further processing such as event propagation to the parent widget stops.

See also
closeEvent(), focusInEvent(), focusOutEvent(), enterEvent(), keyPressEvent(), keyReleaseEvent(), leaveEvent(), mouseDoubleClickEvent(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), moveEvent(), paintEvent(), resizeEvent(), QObject::event(), QObject::timerEvent()

Reimplemented from QWidget.

Definition at line 318 of file qsystemtrayicon_x11.cpp.

319 {
320  if (e->type() == QEvent::ToolTip) {
321  return QApplication::sendEvent(q, e);
322  }
323  return QWidget::event(e);
324 }
QSystemTrayIcon * q
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
bool event(QEvent *)
This is the main event handler; it handles event event.
Definition: qwidget.cpp:8636

◆ findIconGeometry()

QRect QSystemTrayIconSys::findIconGeometry ( const int  a_iButtonID)

Definition at line 351 of file qsystemtrayicon_win.cpp.

352 {
353  static PtrShell_NotifyIconGetRect Shell_NotifyIconGetRect =
354  (PtrShell_NotifyIconGetRect)QSystemLibrary::resolve(QLatin1String("shell32"), "Shell_NotifyIconGetRect");
355 
356  if (Shell_NotifyIconGetRect) {
358  memset(&nid, 0, sizeof(nid));
359  nid.cbSize = sizeof(nid);
360  nid.hWnd = winId();
361  nid.uID = iconId;
362 
363  RECT rect;
364  HRESULT hr = Shell_NotifyIconGetRect(&nid, &rect);
365  if (SUCCEEDED(hr)) {
366  return QRect(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top);
367  }
368  }
369 
370  QRect ret;
371 
372  TBBUTTON buttonData;
373  DWORD processID = 0;
374  HWND trayHandle = FindWindow(L"Shell_TrayWnd", NULL);
375 
376  //find the toolbar used in the notification area
377  if (trayHandle) {
378  trayHandle = FindWindowEx(trayHandle, NULL, L"TrayNotifyWnd", NULL);
379  if (trayHandle) {
380  HWND hwnd = FindWindowEx(trayHandle, NULL, L"SysPager", NULL);
381  if (hwnd) {
382  hwnd = FindWindowEx(hwnd, NULL, L"ToolbarWindow32", NULL);
383  if (hwnd)
384  trayHandle = hwnd;
385  }
386  }
387  }
388 
389  if (!trayHandle)
390  return ret;
391 
392  GetWindowThreadProcessId(trayHandle, &processID);
393  if (processID <= 0)
394  return ret;
395 
396  HANDLE trayProcess = OpenProcess(PROCESS_VM_OPERATION | PROCESS_VM_READ, 0, processID);
397  if (!trayProcess)
398  return ret;
399 
400  int buttonCount = SendMessage(trayHandle, TB_BUTTONCOUNT, 0, 0);
401  LPVOID data = VirtualAllocEx(trayProcess, NULL, sizeof(TBBUTTON), MEM_COMMIT, PAGE_READWRITE);
402 
403  if ( buttonCount < 1 || !data ) {
404  CloseHandle(trayProcess);
405  return ret;
406  }
407 
408  //search for our icon among all toolbar buttons
409  for (int toolbarButton = 0; toolbarButton < buttonCount; ++toolbarButton ) {
410  SIZE_T numBytes = 0;
411  DWORD appData[2] = { 0, 0 };
412  SendMessage(trayHandle, TB_GETBUTTON, toolbarButton , (LPARAM)data);
413 
414  if (!ReadProcessMemory(trayProcess, data, &buttonData, sizeof(TBBUTTON), &numBytes))
415  continue;
416 
417  if (!ReadProcessMemory(trayProcess, (LPVOID) buttonData.dwData, appData, sizeof(appData), &numBytes))
418  continue;
419 
420  int currentIconId = appData[1];
421  HWND currentIconHandle = (HWND) appData[0];
422  bool isHidden = buttonData.fsState & TBSTATE_HIDDEN;
423 
424  if (currentIconHandle == winId() &&
425  currentIconId == iconId && !isHidden) {
426  SendMessage(trayHandle, TB_GETITEMRECT, toolbarButton , (LPARAM)data);
427  RECT iconRect = {0, 0, 0, 0};
428  if(ReadProcessMemory(trayProcess, data, &iconRect, sizeof(RECT), &numBytes)) {
429  MapWindowPoints(trayHandle, NULL, (LPPOINT)&iconRect, 2);
430  QRect geometry(iconRect.left + 1, iconRect.top + 1,
431  iconRect.right - iconRect.left - 2,
432  iconRect.bottom - iconRect.top - 2);
433  if (geometry.isValid())
434  ret = geometry;
435  break;
436  }
437  }
438  }
439  VirtualFreeEx(trayProcess, data, 0, MEM_RELEASE);
440  CloseHandle(trayProcess);
441  return ret;
442 }
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
bool isHidden() const
Returns true if the widget is hidden, otherwise returns false.
Definition: qwidget.h:1008
QWidgetData * data
Definition: qwidget.h:815
void * HANDLE
Definition: qnamespace.h:1671
QRect rect() const
long HRESULT
void * resolve(const char *symbol)
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
WId winId() const
Returns the window system identifier of the widget.
Definition: qwidget.cpp:2557
HRESULT(WINAPI * PtrShell_NotifyIconGetRect)(const Q_NOTIFYICONIDENTIFIER *identifier, RECT *iconLocation)
bool isValid() const
Returns true if the rectangle is valid, otherwise returns false.
Definition: qrect.h:237
const QRect & geometry() const

◆ findTrayGeometry()

QRect QSystemTrayIconSys::findTrayGeometry ( )

Definition at line 95 of file qsystemtrayicon_wince.cpp.

96 {
97  // Use lower right corner as fallback
98  QPoint brCorner = qApp->desktop()->screenGeometry().bottomRight();
99  QRect ret(brCorner.x() - 10, brCorner.y() - 10, 10, 10);
100  return ret;
101 }
#define qApp
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128

◆ getSysTrayVisualInfo()

XVisualInfo * QSystemTrayIconSys::getSysTrayVisualInfo ( )

Definition at line 78 of file qsystemtrayicon_x11.cpp.

Referenced by addToTray(), and paintEvent().

79 {
81 
82  if (!sysTrayVisual.visual) {
83  Window win = locateSystemTray();
84  if (win != XNone) {
85  Atom actual_type;
86  int actual_format;
87  ulong nitems, bytes_remaining;
88  uchar *data = 0;
89  int result = XGetWindowProperty(display, win, ATOM(_NET_SYSTEM_TRAY_VISUAL), 0, 1,
90  False, XA_VISUALID, &actual_type,
91  &actual_format, &nitems, &bytes_remaining, &data);
92  VisualID vid = 0;
93  if (result == Success && data && actual_type == XA_VISUALID && actual_format == 32 &&
94  nitems == 1 && bytes_remaining == 0)
95  vid = *(VisualID*)data;
96  if (data)
97  XFree(data);
98  if (vid == 0)
99  return 0;
100 
101  uint mask = VisualIDMask;
102  XVisualInfo *vi, rvi;
103  int count;
104  rvi.visualid = vid;
105  vi = XGetVisualInfo(display, mask, &rvi, &count);
106  if (vi) {
107  sysTrayVisual = vi[0];
108  XFree((char*)vi);
109  }
110  if (sysTrayVisual.depth != 32)
111  memset(&sysTrayVisual, 0, sizeof(sysTrayVisual));
112  }
113  }
114 
115  return sysTrayVisual.visual ? &sysTrayVisual : 0;
116 }
#define ATOM(x)
Definition: qt_x11_p.h:723
unsigned char uchar
Definition: qglobal.h:994
Q_GUI_EXPORT EGLDisplay display()
Definition: qegl.cpp:589
static Window locateSystemTray()
QWidgetData * data
Definition: qwidget.h:815
unsigned int uint
Definition: qglobal.h:996
unsigned long ulong
Definition: qglobal.h:997
QRegion mask() const
Returns the mask currently set on a widget.
Definition: qwidget.cpp:10058
struct _XDisplay Display
Definition: qwindowdefs.h:115
static Display * display()
Returns the default display for the application.
static XVisualInfo sysTrayVisual

◆ locateSystemTray()

Window QSystemTrayIconSys::locateSystemTray ( )
static

Definition at line 66 of file qsystemtrayicon_x11.cpp.

Referenced by getSysTrayVisualInfo(), sysTrayTracker(), and x11Event().

67 {
69  if (sysTraySelection == XNone) {
70  int screen = QX11Info::appScreen();
71  QString net_sys_tray = QString::fromLatin1("_NET_SYSTEM_TRAY_S%1").arg(screen);
72  sysTraySelection = XInternAtom(display, net_sys_tray.toLatin1(), False);
73  }
74 
75  return XGetSelectionOwner(QX11Info::display(), sysTraySelection);
76 }
static int appScreen()
Returns the number of the screen where the application is being displayed.
The QString class provides a Unicode character string.
Definition: qstring.h:83
Q_GUI_EXPORT EGLDisplay display()
Definition: qegl.cpp:589
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
Definition: qstring.cpp:3993
struct _XDisplay Display
Definition: qwindowdefs.h:115
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
Definition: qstring.cpp:7186
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
Definition: qstring.cpp:4188
static Atom sysTraySelection
static Display * display()
Returns the default display for the application.

◆ mouseDoubleClickEvent()

void QSystemTrayIconSys::mouseDoubleClickEvent ( QMouseEvent event)
protectedvirtual

This event handler, for event event, can be reimplemented in a subclass to receive mouse double click events for the widget.

The default implementation generates a normal mouse press event.

Note
The widget will also receive mouse press and mouse release events in addition to the double click event. It is up to the developer to ensure that the application interprets these events correctly.
See also
mousePressEvent(), mouseReleaseEvent() mouseMoveEvent(), event(), QMouseEvent

Reimplemented from QWidget.

Definition at line 305 of file qsystemtrayicon_x11.cpp.

306 {
307  if (ev->button() == Qt::LeftButton)
309 }
QSystemTrayIcon * q
void activated(QSystemTrayIcon::ActivationReason reason)
This signal is emitted when the user activates the system tray icon.
#define emit
Definition: qobjectdefs.h:76

◆ mousePressEvent()

void QSystemTrayIconSys::mousePressEvent ( QMouseEvent event)
protectedvirtual

This event handler, for event event, can be reimplemented in a subclass to receive mouse press events for the widget.

If you create new widgets in the mousePressEvent() the mouseReleaseEvent() may not end up where you expect, depending on the underlying window system (or X11 window manager), the widgets' location and maybe more.

The default implementation implements the closing of popup widgets when you click outside the window. For other widget types it does nothing.

See also
mouseReleaseEvent(), mouseDoubleClickEvent(), mouseMoveEvent(), event(), QMouseEvent, {Scribble Example}

Reimplemented from QWidget.

Definition at line 286 of file qsystemtrayicon_x11.cpp.

287 {
288  QPoint globalPos = ev->globalPos();
289  if (ev->button() == Qt::RightButton && q->contextMenu())
290  q->contextMenu()->popup(globalPos);
291 
293  emit q->messageClicked();
295  }
296 
297  if (ev->button() == Qt::LeftButton)
299  else if (ev->button() == Qt::RightButton)
301  else if (ev->button() == Qt::MidButton)
303 }
void popup(const QPoint &pos, QAction *at=0)
Displays the menu so that the action atAction will be at the specified global position p...
Definition: qmenu.cpp:1847
static void hideBalloon()
QSystemTrayIcon * q
void activated(QSystemTrayIcon::ActivationReason reason)
This signal is emitted when the user activates the system tray icon.
#define emit
Definition: qobjectdefs.h:76
QMenu * contextMenu() const
Returns the current context menu for the system tray entry.
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
static bool isBalloonVisible()
void messageClicked()
This signal is emitted when the message displayed using showMessage() was clicked by the user...

◆ paintEvent()

void QSystemTrayIconSys::paintEvent ( QPaintEvent event)
protectedvirtual

This event handler can be reimplemented in a subclass to receive paint events passed in event.

A paint event is a request to repaint all or part of a widget. It can happen for one of the following reasons:

  • repaint() or update() was invoked,
  • the widget was obscured and has now been uncovered, or
  • many other reasons.

Many widgets can simply repaint their entire surface when asked to, but some slow widgets need to optimize by painting only the requested region: QPaintEvent::region(). This speed optimization does not change the result, as painting is clipped to that region during event processing. QListView and QTableView do this, for example.

Qt also tries to speed up painting by merging multiple paint events into one. When update() is called several times or the window system sends several paint events, Qt merges these events into one event with a larger region (see QRegion::united()). The repaint() function does not permit this optimization, so we suggest using update() whenever possible.

When the paint event occurs, the update region has normally been erased, so you are painting on the widget's background.

The background can be set using setBackgroundRole() and setPalette().

Since Qt 4.0, QWidget automatically double-buffers its painting, so there is no need to write double-buffering code in paintEvent() to avoid flicker.

Note for the X11 platform: It is possible to toggle global double buffering by calling qt_x11_set_global_double_buffer(). For example,

Note
Generally, you should refrain from calling update() or repaint() inside a paintEvent(). For example, calling update() or repaint() on children inside a paintevent() results in undefined behavior; the child may or may not get a paint event.
Warning
If you are using a custom paint engine without Qt's backingstore, Qt::WA_PaintOnScreen must be set. Otherwise, QWidget::paintEngine() will never be called; the backingstore will be used instead.
See also
event(), repaint(), update(), QPainter, QPixmap, QPaintEvent, {Analog Clock Example}

Reimplemented from QWidget.

Definition at line 266 of file qsystemtrayicon_x11.cpp.

267 {
268  QPainter p(this);
269  if (!getSysTrayVisualInfo()) {
270  const QRegion oldSystemClip = p.paintEngine()->systemClip();
271  const QRect clearedRect = oldSystemClip.boundingRect();
272  XClearArea(QX11Info::display(), winId(), clearedRect.x(), clearedRect.y(),
273  clearedRect.width(), clearedRect.height(), False);
274  QPaintEngine *pe = p.paintEngine();
275  pe->setSystemClip(clearedRect);
276  q->icon().paint(&p, rect());
277  pe->setSystemClip(oldSystemClip);
278  } else {
279  p.setCompositionMode(QPainter::CompositionMode_Source);
280  p.fillRect(rect(), Qt::transparent);
281  p.setCompositionMode(QPainter::CompositionMode_SourceOver);
282  q->icon().paint(&p, rect());
283  }
284 }
The QPainter class performs low-level painting on widgets and other paint devices.
Definition: qpainter.h:86
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
QRect boundingRect() const
Returns the bounding rectangle of this region.
Definition: qregion.cpp:4363
QSystemTrayIcon * q
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
The QPaintEngine class provides an abstract definition of how QPainter draws to a given device on a g...
Definition: qpaintengine.h:90
void setSystemClip(const QRegion &baseClip)
Sets the system clip for this engine.
QIcon icon
the system tray icon
QRect rect() const
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
XVisualInfo * getSysTrayVisualInfo()
WId winId() const
Returns the window system identifier of the widget.
Definition: qwidget.cpp:2557
static Display * display()
Returns the default display for the application.
void paint(QPainter *painter, const QRect &rect, Qt::Alignment alignment=Qt::AlignCenter, Mode mode=Normal, State state=Off) const
Uses the painter to paint the icon with specified alignment, required mode, and state into the rectan...
Definition: qicon.cpp:744

◆ resizeEvent()

void QSystemTrayIconSys::resizeEvent ( QResizeEvent )
protectedvirtual

This event handler can be reimplemented in a subclass to receive widget resize events which are passed in the event parameter.

When resizeEvent() is called, the widget already has its new geometry. The old size is accessible through QResizeEvent::oldSize().

The widget will be erased and receive a paint event immediately after processing the resize event. No drawing need be (or should be) done inside this handler.

See also
moveEvent(), event(), resize(), QResizeEvent, paintEvent(), {Scribble Example}

Reimplemented from QWidget.

Definition at line 260 of file qsystemtrayicon_x11.cpp.

261 {
263  updateIcon();
264 }
virtual void resizeEvent(QResizeEvent *)
This event handler can be reimplemented in a subclass to receive widget resize events which are passe...
Definition: qwidget.cpp:9587

◆ setIconContents() [1/2]

void QSystemTrayIconSys::setIconContents ( NOTIFYICONDATA &  data)

◆ setIconContents() [2/2]

void QSystemTrayIconSys::setIconContents ( NOTIFYICONDATA &  data)

Definition at line 180 of file qsystemtrayicon_win.cpp.

Referenced by findTrayGeometry(), and trayMessage().

181 {
182  tnd.uFlags |= NIF_MESSAGE | NIF_ICON | NIF_TIP;
183  tnd.uCallbackMessage = MYWM_NOTIFYICON;
184  tnd.hIcon = hIcon;
185  QString tip = q->toolTip();
186 
187  if (!tip.isNull()) {
188  tip = tip.left(maxTipLength - 1) + QChar();
189  memcpy(tnd.szTip, tip.utf16(), qMin(tip.length() + 1, maxTipLength) * sizeof(wchar_t));
190  }
191 }
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
int length() const
Returns the number of characters in this string.
Definition: qstring.h:696
QSystemTrayIcon * q
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
QString toolTip
the tooltip for the system tray entry
QString left(int n) const Q_REQUIRED_RESULT
Returns a substring that contains the n leftmost characters of the string.
Definition: qstring.cpp:3664
bool isNull() const
Returns true if this string is null; otherwise returns false.
Definition: qstring.h:505
#define MYWM_NOTIFYICON
const ushort * utf16() const
Returns the QString as a &#39;\0\&#39;-terminated array of unsigned shorts.
Definition: qstring.cpp:5290

◆ showMessage()

bool QSystemTrayIconSys::showMessage ( const QString title,
const QString message,
QSystemTrayIcon::MessageIcon  type,
uint  uSecs 
)

Definition at line 210 of file qsystemtrayicon_win.cpp.

211 {
212  NOTIFYICONDATA tnd;
213  memset(&tnd, 0, notifyIconSize);
214 
215  memcpy(tnd.szInfo, message.utf16(), qMin(message.length() + 1, 256) * sizeof(wchar_t));
216  memcpy(tnd.szInfoTitle, title.utf16(), qMin(title.length() + 1, 64) * sizeof(wchar_t));
217 
218  tnd.uID = q_uNOTIFYICONID;
219  tnd.dwInfoFlags = iconFlag(type);
220  tnd.cbSize = notifyIconSize;
221  tnd.hWnd = winId();
222  tnd.uTimeout = uSecs;
223  tnd.uFlags = NIF_INFO | NIF_SHOWTIP;
224 
226 
227  return Shell_NotifyIcon(NIM_MODIFY, &tnd);
228 }
int type
Definition: qmetatype.cpp:239
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
#define NIF_SHOWTIP
int length() const
Returns the number of characters in this string.
Definition: qstring.h:696
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
static const UINT q_uNOTIFYICONID
static int iconFlag(QSystemTrayIcon::MessageIcon icon)
WId winId() const
Returns the window system identifier of the widget.
Definition: qwidget.cpp:2557
const ushort * utf16() const
Returns the QString as a &#39;\0\&#39;-terminated array of unsigned shorts.
Definition: qstring.cpp:5290

◆ sysTrayTracker()

bool QSystemTrayIconSys::sysTrayTracker ( void *  message,
long *  result 
)
static

Definition at line 118 of file qsystemtrayicon_x11.cpp.

119 {
120  bool retval = false;
122  retval = QSystemTrayIconSys::oldEventFilter(message, result);
123 
124  if (trayIcons.isEmpty())
125  return retval;
126 
128  XEvent *ev = (XEvent *)message;
129  if (ev->type == DestroyNotify && ev->xany.window == sysTrayWindow) {
131  memset(&sysTrayVisual, 0, sizeof(sysTrayVisual));
132  for (int i = 0; i < trayIcons.count(); i++) {
133  if (sysTrayWindow == XNone) {
135  trayIcons[i]->hide(); // still no luck
136  trayIcons[i]->destroy();
137  trayIcons[i]->create();
138  } else
139  trayIcons[i]->addToTray(); // add it to the new tray
140  }
141  retval = true;
142  } else if (ev->type == ClientMessage && sysTrayWindow == XNone) {
143  static Atom manager_atom = XInternAtom(display, "MANAGER", False);
144  XClientMessageEvent *cm = (XClientMessageEvent *)message;
145  if ((cm->message_type == manager_atom) && ((Atom)cm->data.l[1] == sysTraySelection)) {
146  sysTrayWindow = cm->data.l[2];
147  memset(&sysTrayVisual, 0, sizeof(sysTrayVisual));
148  XSelectInput(display, sysTrayWindow, StructureNotifyMask);
149  for (int i = 0; i < trayIcons.count(); i++) {
150  trayIcons[i]->addToTray();
151  }
152  retval = true;
153  }
154  } else if (ev->type == PropertyNotify && ev->xproperty.atom == ATOM(_NET_SYSTEM_TRAY_VISUAL) &&
155  ev->xproperty.window == sysTrayWindow) {
156  memset(&sysTrayVisual, 0, sizeof(sysTrayVisual));
157  for (int i = 0; i < trayIcons.count(); i++) {
158  trayIcons[i]->addToTray();
159  }
160  }
161 
162  return retval;
163 }
static void hideBalloon()
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
static Window sysTrayWindow
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
union _XEvent XEvent
Definition: qwindowdefs.h:116
#define ATOM(x)
Definition: qt_x11_p.h:723
Q_GUI_EXPORT EGLDisplay display()
Definition: qegl.cpp:589
static Window locateSystemTray()
static QList< QSystemTrayIconSys * > trayIcons
struct _XDisplay Display
Definition: qwindowdefs.h:115
static Atom sysTraySelection
static QCoreApplication::EventFilter oldEventFilter
static Display * display()
Returns the default display for the application.
static XVisualInfo sysTrayVisual

◆ trayMessage() [1/2]

bool QSystemTrayIconSys::trayMessage ( DWORD  msg)

◆ trayMessage() [2/2]

bool QSystemTrayIconSys::trayMessage ( DWORD  msg)

Definition at line 230 of file qsystemtrayicon_win.cpp.

Referenced by findTrayGeometry(), and winEvent().

231 {
232  NOTIFYICONDATA tnd;
233  memset(&tnd, 0, notifyIconSize);
234 
235  tnd.uID = q_uNOTIFYICONID;
236  tnd.cbSize = notifyIconSize;
237  tnd.hWnd = winId();
238  tnd.uFlags = NIF_SHOWTIP;
239  tnd.uVersion = version;
240 
242 
243  if (msg == NIM_ADD || msg == NIM_MODIFY) {
244  setIconContents(tnd);
245  }
246 
247  bool success = Shell_NotifyIcon(msg, &tnd);
248 
249  if (msg == NIM_ADD)
250  return success && Shell_NotifyIcon(NIM_SETVERSION, &tnd);
251  else
252  return success;
253 }
#define NIF_SHOWTIP
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
void setIconContents(NOTIFYICONDATA &data)
static const UINT q_uNOTIFYICONID
WId winId() const
Returns the window system identifier of the widget.
Definition: qwidget.cpp:2557

◆ updateIcon()

void QSystemTrayIconSys::updateIcon ( )

Definition at line 255 of file qsystemtrayicon_x11.cpp.

Referenced by resizeEvent().

256 {
257  update();
258 }
void update()
Updates the widget unless updates are disabled or the widget is hidden.
Definition: qwidget.cpp:10883

◆ wheelEvent()

void QSystemTrayIconSys::wheelEvent ( QWheelEvent event)
protectedvirtual

This event handler, for event event, can be reimplemented in a subclass to receive wheel events for the widget.

If you reimplement this handler, it is very important that you ignore() the event if you do not handle it, so that the widget's parent can interpret it.

The default implementation ignores the event.

See also
QWheelEvent::ignore(), QWheelEvent::accept(), event(), QWheelEvent

Reimplemented from QWidget.

Definition at line 312 of file qsystemtrayicon_x11.cpp.

313 {
315 }
QSystemTrayIcon * q
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.

◆ winEvent() [1/2]

bool QSystemTrayIconSys::winEvent ( MSG message,
long *  result 
)
virtual

This special event handler can be reimplemented in a subclass to receive native Windows events which are passed in the message parameter.

In your reimplementation of this function, if you want to stop the event being handled by Qt, return true and set result to the value that the window procedure should return. If you return false, this native event is passed back to Qt, which translates the event into a Qt event and sends it to the widget.

Warning
This function is not portable.
See also
QApplication::winEventFilter()

Reimplemented from QWidget.

◆ winEvent() [2/2]

bool QSystemTrayIconSys::winEvent ( MSG message,
long *  result 
)
virtual

This special event handler can be reimplemented in a subclass to receive native Windows events which are passed in the message parameter.

In your reimplementation of this function, if you want to stop the event being handled by Qt, return true and set result to the value that the window procedure should return. If you return false, this native event is passed back to Qt, which translates the event into a Qt event and sends it to the widget.

Warning
This function is not portable.
See also
QApplication::winEventFilter()

Reimplemented from QWidget.

Definition at line 272 of file qsystemtrayicon_win.cpp.

Referenced by findTrayGeometry().

273 {
274  switch(m->message) {
275  case MYWM_NOTIFYICON:
276  {
277  int message = 0;
278  QPoint gpos;
279 
280  if (version == NOTIFYICON_VERSION_4) {
281  Q_ASSERT(q_uNOTIFYICONID == HIWORD(m->lParam));
282  message = LOWORD(m->lParam);
283  gpos = QPoint(GET_X_LPARAM(m->wParam), GET_Y_LPARAM(m->wParam));
284  } else {
285  Q_ASSERT(q_uNOTIFYICONID == m->wParam);
286  message = m->lParam;
287  gpos = QCursor::pos();
288  }
289 
290  switch (message) {
291  case NIN_SELECT:
292  case NIN_KEYSELECT:
294  ignoreNextMouseRelease = false;
295  else
297  break;
298 
299  case WM_LBUTTONDBLCLK:
300  ignoreNextMouseRelease = true; // Since DBLCLICK Generates a second mouse
301  // release we must ignore it
303  break;
304 
305  case WM_CONTEXTMENU:
306  if (q->contextMenu()) {
307  q->contextMenu()->popup(gpos);
309  }
311  break;
312 
314  emit q->messageClicked();
315  break;
316 
317  case WM_MBUTTONUP:
319  break;
320 
321  default:
322  break;
323  }
324  break;
325  }
326  default:
327  if (m->message == MYWM_TASKBARCREATED)
328  trayMessage(NIM_ADD);
329  else
330  return QWidget::winEvent(m, result);
331  break;
332  }
333  return 0;
334 }
#define NIN_KEYSELECT
void popup(const QPoint &pos, QAction *at=0)
Displays the menu so that the action atAction will be at the specified global position p...
Definition: qmenu.cpp:1847
#define NIN_BALLOONUSERCLICK
QSystemTrayIcon * q
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
void activated(QSystemTrayIcon::ActivationReason reason)
This signal is emitted when the user activates the system tray icon.
#define NIN_SELECT
#define emit
Definition: qobjectdefs.h:76
#define GET_X_LPARAM(lp)
QMenu * contextMenu() const
Returns the current context menu for the system tray entry.
static uint MYWM_TASKBARCREATED
virtual bool winEvent(MSG *message, long *result)
This special event handler can be reimplemented in a subclass to receive native Windows events which ...
Definition: qwidget.cpp:9941
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
static const UINT q_uNOTIFYICONID
void activateWindow()
Sets the top-level widget containing this widget to be the active window.
bool trayMessage(DWORD msg)
#define MYWM_NOTIFYICON
#define NOTIFYICON_VERSION_4
#define GET_Y_LPARAM(lp)
static QPoint pos()
Returns the position of the cursor (hot spot) in global screen coordinates.
Definition: qcursor_mac.mm:310
void messageClicked()
This signal is emitted when the message displayed using showMessage() was clicked by the user...

◆ x11Event()

bool QSystemTrayIconSys::x11Event ( XEvent event)
protectedvirtual

This special event handler can be reimplemented in a subclass to receive native X11 events passed in the event parameter.

In your reimplementation of this function, if you want to stop Qt from handling the event, return true. If you return false, this native event is passed back to Qt, which translates it into a Qt event and sends it to the widget.

Note
Events are only delivered to this event handler if the widget is native.
Warning
This function is not portable.
See also
QApplication::x11EventFilter(), QWidget::winId()

Reimplemented from QWidget.

Definition at line 326 of file qsystemtrayicon_x11.cpp.

327 {
328  if (event->type == ReparentNotify)
329  show();
330  return QWidget::x11Event(event);
331 }
virtual bool x11Event(XEvent *)
This special event handler can be reimplemented in a subclass to receive native X11 events passed in ...
Definition: qwidget.cpp:9969
bool event(QEvent *e)
This is the main event handler; it handles event event.
void show()
Shows the widget and its child widgets.

Friends and Related Functions

◆ QSystemTrayIconPrivate

Definition at line 135 of file qsystemtrayicon_p.h.

Properties

◆ background

QPixmap QSystemTrayIconSys::background
private

Definition at line 175 of file qsystemtrayicon_p.h.

◆ colormap

Colormap QSystemTrayIconSys::colormap
private

Definition at line 177 of file qsystemtrayicon_p.h.

Referenced by addToTray(), and sysTrayTracker().

◆ globalPos

QPoint QSystemTrayIconSys::globalPos

Definition at line 117 of file qsystemtrayicon_win.cpp.

Referenced by mousePressEvent().

◆ hIcon

HICON QSystemTrayIconSys::hIcon

Definition at line 116 of file qsystemtrayicon_win.cpp.

Referenced by createIcon(), QSystemTrayIconSys(), and setIconContents().

◆ ignoreNextMouseRelease

bool QSystemTrayIconSys::ignoreNextMouseRelease
private

Definition at line 123 of file qsystemtrayicon_win.cpp.

Referenced by winEvent().

◆ item

QNSStatusItem* QSystemTrayIconSys::item

◆ maxTipLength

int QSystemTrayIconSys::maxTipLength
private

Definition at line 121 of file qsystemtrayicon_win.cpp.

Referenced by QSystemTrayIconSys(), and setIconContents().

◆ notifyIconSize

uint QSystemTrayIconSys::notifyIconSize
private

Definition at line 120 of file qsystemtrayicon_win.cpp.

Referenced by QSystemTrayIconSys(), showMessage(), and trayMessage().

◆ oldEventFilter

QCoreApplication::EventFilter QSystemTrayIconSys::oldEventFilter = 0
static

Definition at line 157 of file qsystemtrayicon_p.h.

Referenced by sysTrayTracker().

◆ q

QSystemTrayIcon * QSystemTrayIconSys::q
private

◆ sysTraySelection

Atom QSystemTrayIconSys::sysTraySelection = XNone
static

Definition at line 160 of file qsystemtrayicon_p.h.

Referenced by locateSystemTray(), and sysTrayTracker().

◆ sysTrayVisual

XVisualInfo QSystemTrayIconSys::sysTrayVisual = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
static

Definition at line 161 of file qsystemtrayicon_p.h.

Referenced by getSysTrayVisualInfo(), and sysTrayTracker().

◆ sysTrayWindow

Window QSystemTrayIconSys::sysTrayWindow = XNone
static

Definition at line 155 of file qsystemtrayicon_p.h.

Referenced by addToTray(), and sysTrayTracker().

◆ trayIcons

QList< QSystemTrayIconSys * > QSystemTrayIconSys::trayIcons
static

Definition at line 156 of file qsystemtrayicon_p.h.

Referenced by sysTrayTracker().

◆ version

int QSystemTrayIconSys::version
private

Definition at line 122 of file qsystemtrayicon_win.cpp.

Referenced by QSystemTrayIconSys(), trayMessage(), and winEvent().


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