Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qsystemtrayicon.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qsystemtrayicon.h"
5#include "qsystemtrayicon_p.h"
6
7#ifndef QT_NO_SYSTEMTRAYICON
8
9#if QT_CONFIG(menu)
10#include "qmenu.h"
11#endif
12#include "qlist.h"
13#include "qevent.h"
14#include "qpoint.h"
15#if QT_CONFIG(label)
16#include "qlabel.h"
17#include "private/qlabel_p.h"
18#endif
19#if QT_CONFIG(pushbutton)
20#include "qpushbutton.h"
21#endif
22#include "qpainterpath.h"
23#include "qpainter.h"
24#include "qstyle.h"
25#include "qgridlayout.h"
26#include "qapplication.h"
27#include "qbitmap.h"
28
29#include <private/qhighdpiscaling_p.h>
30#include <qpa/qplatformscreen.h>
31
33
35{
36 QStyle::StandardPixmap stdIcon = QStyle::SP_CustomBase; // silence gcc 4.9.0 about uninited variable
37 switch (icon) {
40 break;
43 break;
46 break;
48 return QIcon();
49 }
50 return QApplication::style()->standardIcon(stdIcon);
51}
52
126
135 : QSystemTrayIcon(parent)
136{
137 setIcon(icon);
138}
139
144{
145 Q_D(QSystemTrayIcon);
146 d->remove_sys();
147}
148
149#if QT_CONFIG(menu)
150
161void QSystemTrayIcon::setContextMenu(QMenu *menu)
162{
163 Q_D(QSystemTrayIcon);
164 QMenu *oldMenu = d->menu.data();
165 if (oldMenu == menu)
166 return;
167
168 d->menu = menu;
169 d->updateMenu_sys();
170
171 if (d->qpa_sys) {
172 // Show the QMenu-based menu for QPA plugins that do not provide native menus
173 if (oldMenu && !oldMenu->platformMenu())
175 if (menu && !menu->platformMenu()) {
177 menu,
178 [menu](QPoint globalNativePos, const QPlatformScreen *platformScreen)
179 {
180 QScreen *screen = platformScreen ? platformScreen->screen() : nullptr;
181 menu->popup(QHighDpi::fromNativePixels(globalNativePos, screen), nullptr);
182 });
183 }
184 }
185}
186
190QMenu* QSystemTrayIcon::contextMenu() const
191{
192 Q_D(const QSystemTrayIcon);
193 return d->menu;
194}
195
196#endif // QT_CONFIG(menu)
197
206{
207 Q_D(QSystemTrayIcon);
208 d->icon = icon;
209 d->updateIcon_sys();
210}
211
213{
214 Q_D(const QSystemTrayIcon);
215 return d->icon;
216}
217
226{
227 Q_D(QSystemTrayIcon);
228 d->toolTip = tooltip;
229 d->updateToolTip_sys();
230}
231
233{
234 Q_D(const QSystemTrayIcon);
235 return d->toolTip;
236}
237
261{
262 Q_D(const QSystemTrayIcon);
263 if (!d->visible)
264 return QRect();
265 return d->geometry_sys();
266}
267
276{
277 Q_D(QSystemTrayIcon);
278 if (visible == d->visible)
279 return;
280 if (Q_UNLIKELY(visible && d->icon.isNull()))
281 qWarning("QSystemTrayIcon::setVisible: No Icon set");
282 d->visible = visible;
283 if (d->visible)
284 d->install_sys();
285 else
286 d->remove_sys();
287}
288
290{
291 Q_D(const QSystemTrayIcon);
292 return d->visible;
293}
294
299{
300 return QObject::event(e);
301}
302
355
365
389 QSystemTrayIcon::MessageIcon msgIcon, int msecs)
390{
391 Q_D(QSystemTrayIcon);
392 if (d->visible)
393 d->showMessage_sys(title, msg, messageIcon2qIcon(msgIcon), msgIcon, msecs);
394}
395
407 const QIcon &icon, int msecs)
408{
409 Q_D(QSystemTrayIcon);
410 if (d->visible)
411 d->showMessage_sys(title, msg, icon, QSystemTrayIcon::NoIcon, msecs);
412}
413
419
422
424 const QString &message, QSystemTrayIcon *trayIcon,
425 const QPoint &pos, int timeout, bool showArrow)
426{
427 hideBalloon();
428 if (message.isEmpty() && title.isEmpty())
429 return;
430
432 if (timeout < 0)
433 timeout = 10000; //10 s default
434 theSolitaryBalloonTip->balloon(pos, timeout, showArrow);
435}
436
438{
440 return;
441 theSolitaryBalloonTip->hide();
443 theSolitaryBalloonTip = nullptr;
444}
445
447{
449 return;
450 theSolitaryBalloonTip->hide();
451 theSolitaryBalloonTip->balloon(pos, 0, theSolitaryBalloonTip->showArrow);
452}
453
458
459QBalloonTip::QBalloonTip(const QIcon &icon, const QString &title,
460 const QString &message, QSystemTrayIcon *ti)
461 : QWidget(nullptr, Qt::ToolTip),
462 trayIcon(ti),
463 timerId(-1),
464 showArrow(true)
465{
467 QObject::connect(ti, SIGNAL(destroyed()), this, SLOT(close()));
468
469#if QT_CONFIG(label)
470 QLabel *titleLabel = new QLabel;
471 titleLabel->installEventFilter(this);
472 titleLabel->setText(title);
473 QFont f = titleLabel->font();
474 f.setBold(true);
475 titleLabel->setFont(f);
476 titleLabel->setTextFormat(Qt::PlainText); // to maintain compat with windows
477#endif
478
479 const int iconSize = 18;
480 const int closeButtonSize = 15;
481
482#if QT_CONFIG(pushbutton)
483 QPushButton *closeButton = new QPushButton;
484 closeButton->setIcon(style()->standardIcon(QStyle::SP_TitleBarCloseButton));
485 closeButton->setIconSize(QSize(closeButtonSize, closeButtonSize));
486 closeButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
487 closeButton->setFixedSize(closeButtonSize, closeButtonSize);
488 QObject::connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
489#else
490 Q_UNUSED(closeButtonSize);
491#endif
492
493#if QT_CONFIG(label)
494 QLabel *msgLabel = new QLabel;
495 msgLabel->installEventFilter(this);
496 msgLabel->setText(message);
497 msgLabel->setTextFormat(Qt::PlainText);
498 msgLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft);
499
500 // smart size for the message label
501 int limit = QWidgetPrivate::availableScreenGeometry(msgLabel).width() / 3;
502 if (msgLabel->sizeHint().width() > limit) {
503 msgLabel->setWordWrap(true);
504 if (msgLabel->sizeHint().width() > limit) {
505 msgLabel->d_func()->ensureTextControl();
506 if (QWidgetTextControl *control = msgLabel->d_func()->control) {
507 QTextOption opt = control->document()->defaultTextOption();
508 opt.setWrapMode(QTextOption::WrapAnywhere);
509 control->document()->setDefaultTextOption(opt);
510 }
511 }
512 // Here we allow the text being much smaller than the balloon widget
513 // to emulate the weird standard windows behavior.
514 msgLabel->setFixedSize(limit, msgLabel->heightForWidth(limit));
515 }
516#endif
517
519#if QT_CONFIG(label)
520 if (!icon.isNull()) {
521 QLabel *iconLabel = new QLabel;
522 iconLabel->setPixmap(icon.pixmap(iconSize, iconSize));
524 iconLabel->setMargin(2);
525 layout->addWidget(iconLabel, 0, 0);
526 layout->addWidget(titleLabel, 0, 1);
527 } else {
528 layout->addWidget(titleLabel, 0, 0, 1, 2);
529 }
530#endif
531
532#if QT_CONFIG(pushbutton)
533 layout->addWidget(closeButton, 0, 2);
534#endif
535
536#if QT_CONFIG(label)
537 layout->addWidget(msgLabel, 1, 0, 1, 3);
538#endif
540 layout->setContentsMargins(3, 3, 3, 3);
542
543 QPalette pal = palette();
544 pal.setColor(QPalette::Window, QColor(0xff, 0xff, 0xe1));
546 setPalette(pal);
547}
548
549QBalloonTip::~QBalloonTip()
550{
551 theSolitaryBalloonTip = nullptr;
552}
553
555{
556 QPainter painter(this);
557 painter.drawPixmap(rect(), pixmap);
558}
559
564
565void QBalloonTip::balloon(const QPoint& pos, int msecs, bool showArrow)
566{
567 this->showArrow = showArrow;
569 if (!screen)
571 QRect screenRect = screen->geometry();
572 QSize sh = sizeHint();
573 const int border = 1;
574 const int ah = 18, ao = 18, aw = 18, rc = 7;
575 bool arrowAtTop = (pos.y() + sh.height() + ah < screenRect.height());
576 bool arrowAtLeft = (pos.x() + sh.width() - ao < screenRect.width());
577 setContentsMargins(border + 3, border + (arrowAtTop ? ah : 0) + 2, border + 3, border + (arrowAtTop ? 0 : ah) + 2);
579 sh = sizeHint();
580
581 int ml, mr, mt, mb;
582 QSize sz = sizeHint();
583 if (!arrowAtTop) {
584 ml = mt = 0;
585 mr = sz.width() - 1;
586 mb = sz.height() - ah - 1;
587 } else {
588 ml = 0;
589 mt = ah;
590 mr = sz.width() - 1;
591 mb = sz.height() - 1;
592 }
593
595 path.moveTo(ml + rc, mt);
596 if (arrowAtTop && arrowAtLeft) {
597 if (showArrow) {
598 path.lineTo(ml + ao, mt);
599 path.lineTo(ml + ao, mt - ah);
600 path.lineTo(ml + ao + aw, mt);
601 }
602 move(qMax(pos.x() - ao, screenRect.left() + 2), pos.y());
603 } else if (arrowAtTop && !arrowAtLeft) {
604 if (showArrow) {
605 path.lineTo(mr - ao - aw, mt);
606 path.lineTo(mr - ao, mt - ah);
607 path.lineTo(mr - ao, mt);
608 }
609 move(qMin(pos.x() - sh.width() + ao, screenRect.right() - sh.width() - 2), pos.y());
610 }
611 path.lineTo(mr - rc, mt);
612 path.arcTo(QRect(mr - rc*2, mt, rc*2, rc*2), 90, -90);
613 path.lineTo(mr, mb - rc);
614 path.arcTo(QRect(mr - rc*2, mb - rc*2, rc*2, rc*2), 0, -90);
615 if (!arrowAtTop && !arrowAtLeft) {
616 if (showArrow) {
617 path.lineTo(mr - ao, mb);
618 path.lineTo(mr - ao, mb + ah);
619 path.lineTo(mr - ao - aw, mb);
620 }
621 move(qMin(pos.x() - sh.width() + ao, screenRect.right() - sh.width() - 2),
622 pos.y() - sh.height());
623 } else if (!arrowAtTop && arrowAtLeft) {
624 if (showArrow) {
625 path.lineTo(ao + aw, mb);
626 path.lineTo(ao, mb + ah);
627 path.lineTo(ao, mb);
628 }
629 move(qMax(pos.x() - ao, screenRect.x() + 2), pos.y() - sh.height());
630 }
631 path.lineTo(ml + rc, mb);
632 path.arcTo(QRect(ml, mb - rc*2, rc*2, rc*2), -90, -90);
633 path.lineTo(ml, mt + rc);
634 path.arcTo(QRect(ml, mt, rc*2, rc*2), 180, -90);
635
636 // Set the mask
638 bitmap.fill(Qt::color0);
639 QPainter painter1(&bitmap);
640 painter1.setPen(QPen(Qt::color1, border));
641 painter1.setBrush(QBrush(Qt::color1));
642 painter1.drawPath(path);
644
645 // Draw the border
646 pixmap = QPixmap(sz);
647 QPainter painter2(&pixmap);
648 painter2.setPen(QPen(palette().color(QPalette::Window).darker(160), border));
649 painter2.setBrush(palette().color(QPalette::Window));
650 painter2.drawPath(path);
651
652 if (msecs > 0)
653 timerId = startTimer(msecs);
654 show();
655}
656
658{
659 close();
660 if (e->button() == Qt::LeftButton)
661 emit trayIcon->messageClicked();
662}
663
665{
666 if (e->timerId() == timerId) {
667 killTimer(timerId);
668 if (!underMouse())
669 close();
670 return;
671 }
673}
674
676void QSystemTrayIconPrivate::install_sys_qpa()
677{
678 qpa_sys->init();
686}
687
688void QSystemTrayIconPrivate::remove_sys_qpa()
689{
694 qpa_sys->cleanup();
695}
696
697void QSystemTrayIconPrivate::addPlatformMenu(QMenu *menu) const
698{
699#if QT_CONFIG(menu)
700 if (menu->platformMenu())
701 return; // The platform menu already exists.
702
703 // The recursion depth is the same as menu depth, so should not
704 // be higher than 3 levels.
705 const auto actions = menu->actions();
706 for (QAction *action : actions) {
707 if (action->menu())
708 addPlatformMenu(action->menu());
709 }
710
711 // This menu should be processed *after* its children, otherwise
712 // setMenu() is not called on respective QPlatformMenuItems.
714 if (platformMenu)
716#else
717 Q_UNUSED(menu);
718#endif // QT_CONFIG(menu)
719}
720
722
723#endif // QT_NO_SYSTEMTRAYICON
724
725#include "moc_qsystemtrayicon.cpp"
726#include "moc_qsystemtrayicon_p.cpp"
void setIcon(const QIcon &icon)
The QAction class provides an abstraction for user commands that can be added to different user inter...
Definition qaction.h:30
static QStyle * style()
Returns the application's style object.
static void hideBalloon()
static bool isBalloonVisible()
static void updateBalloonPosition(const QPoint &pos)
static void showBalloon(const QIcon &icon, const QString &title, const QString &msg, QSystemTrayIcon *trayIcon, const QPoint &pos, int timeout, bool showArrow=true)
void timerEvent(QTimerEvent *e) override
This event handler can be reimplemented in a subclass to receive timer events for the object.
void mousePressEvent(QMouseEvent *e) override
This event handler, for event event, can be reimplemented in a subclass to receive mouse press events...
void paintEvent(QPaintEvent *) override
This event handler can be reimplemented in a subclass to receive paint events passed in event.
void resizeEvent(QResizeEvent *) override
This event handler can be reimplemented in a subclass to receive widget resize events which are passe...
\inmodule QtGui
Definition qbitmap.h:16
\inmodule QtGui
Definition qbrush.h:30
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
\inmodule QtCore
Definition qcoreevent.h:45
\reentrant
Definition qfont.h:22
void setBold(bool)
If enable is true sets the font's weight to \l{Weight}{QFont::Bold}; otherwise sets the weight to \l{...
Definition qfont.h:373
The QGridLayout class lays out widgets in a grid.
Definition qgridlayout.h:21
QScreen * primaryScreen
the primary (or default) screen of the application.
static QScreen * screenAt(const QPoint &point)
Returns the screen at point, or \nullptr if outside of any screen.
The QIcon class provides scalable icons in different modes and states.
Definition qicon.h:20
bool isNull() const
Returns true if the icon is empty; otherwise returns false.
Definition qicon.cpp:1019
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:834
The QLabel widget provides a text or image display.
Definition qlabel.h:20
void setText(const QString &)
Definition qlabel.cpp:263
void setTextFormat(Qt::TextFormat)
Definition qlabel.cpp:1376
void setMargin(int)
Definition qlabel.cpp:541
void setPixmap(const QPixmap &)
Definition qlabel.cpp:339
void addWidget(QWidget *w)
Adds widget w to this layout in a manner specific to the layout.
Definition qlayout.cpp:186
void setSizeConstraint(SizeConstraint)
Definition qlayout.cpp:1241
@ SetFixedSize
Definition qlayout.h:39
void setContentsMargins(int left, int top, int right, int bottom)
Definition qlayout.cpp:288
The QMenu class provides a menu widget for use in menu bars, context menus, and other popup menus.
Definition qmenu.h:26
QPlatformMenu * platformMenu()
Definition qmenu.cpp:3710
void setPlatformMenu(QPlatformMenu *platformMenu)
Definition qmenu.cpp:3718
\inmodule QtGui
Definition qevent.h:196
\inmodule QtCore
Definition qobject.h:103
int startTimer(int interval, Qt::TimerType timerType=Qt::CoarseTimer)
This is an overloaded function that will start a timer of type timerType and a timeout of interval mi...
Definition qobject.cpp:1817
void installEventFilter(QObject *filterObj)
Installs an event filter filterObj on this object.
Definition qobject.cpp:2339
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
Definition qobject.cpp:2960
virtual bool event(QEvent *event)
This virtual function receives events to an object and should return true if the event e was recogniz...
Definition qobject.cpp:1389
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
\threadsafe
Definition qobject.cpp:3236
virtual void timerEvent(QTimerEvent *event)
This event handler can be reimplemented in a subclass to receive timer events for the object.
Definition qobject.cpp:1470
void destroyed(QObject *=nullptr)
This signal is emitted immediately before the object obj is destroyed, after any instances of QPointe...
void killTimer(int id)
Kills the timer with timer identifier, id.
Definition qobject.cpp:1912
The QPaintEvent class contains event parameters for paint events.
Definition qevent.h:486
\inmodule QtGui
The QPainter class performs low-level painting on widgets and other paint devices.
Definition qpainter.h:46
void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect)
Draws the rectangular portion source of the given pixmap into the given target in the paint device.
The QPalette class contains color groups for each widget state.
Definition qpalette.h:19
void setColor(ColorGroup cg, ColorRole cr, const QColor &color)
Sets the color in the specified color group, used for the given color role, to the specified solid co...
Definition qpalette.h:146
@ WindowText
Definition qpalette.h:51
\inmodule QtGui
Definition qpen.h:28
The QPlatformScreen class provides an abstraction for visual displays.
virtual void cleanup()=0
This method is called to cleanup the platform dependent implementation.
void contextMenuRequested(QPoint globalPos, const QPlatformScreen *screen)
This signal is emitted when the context menu is requested.
void messageClicked()
This signal is emitted when the message displayed using showMessage() was clicked by the user.
virtual QPlatformMenu * createMenu() const
This method allows platforms to use a different QPlatformMenu for system tray menus than what would n...
ActivationReason
This enum describes the reason the system tray was activated.
virtual void init()=0
This method is called to initialize the platform dependent implementation.
\inmodule QtCore\reentrant
Definition qpoint.h:25
constexpr int x() const noexcept
Returns the x coordinate of this point.
Definition qpoint.h:130
constexpr int y() const noexcept
Returns the y coordinate of this point.
Definition qpoint.h:135
The QPushButton widget provides a command button.
Definition qpushbutton.h:20
\inmodule QtCore\reentrant
Definition qrect.h:30
constexpr int height() const noexcept
Returns the height of the rectangle.
Definition qrect.h:239
constexpr int left() const noexcept
Returns the x-coordinate of the rectangle's left edge.
Definition qrect.h:173
constexpr int x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
Definition qrect.h:185
constexpr int width() const noexcept
Returns the width of the rectangle.
Definition qrect.h:236
constexpr int right() const noexcept
Returns the x-coordinate of the rectangle's right edge.
Definition qrect.h:179
The QResizeEvent class contains event parameters for resize events.
Definition qevent.h:548
The QScreen class is used to query screen properties. \inmodule QtGui.
Definition qscreen.h:32
QRect geometry
the screen's geometry in pixels
Definition qscreen.h:45
Qt::MouseButton button() const
Returns the button that caused the event.
Definition qevent.h:116
\inmodule QtCore
Definition qsize.h:25
constexpr int height() const noexcept
Returns the height.
Definition qsize.h:133
constexpr int width() const noexcept
Returns the width.
Definition qsize.h:130
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
Definition qstring.h:192
StandardPixmap
This enum describes the available standard pixmaps.
Definition qstyle.h:716
@ SP_TitleBarCloseButton
Definition qstyle.h:720
@ SP_CustomBase
Definition qstyle.h:798
@ SP_MessageBoxCritical
Definition qstyle.h:728
@ SP_MessageBoxInformation
Definition qstyle.h:726
@ SP_MessageBoxWarning
Definition qstyle.h:727
static bool isSystemTrayAvailable_sys()
void _q_emitActivated(QPlatformSystemTrayIcon::ActivationReason reason)
QPlatformSystemTrayIcon * qpa_sys
The QSystemTrayIcon class provides an icon for an application in the system tray.
ActivationReason
This enum describes the reason the system tray was activated.
bool event(QEvent *event) override
\reimp
MessageIcon
This enum describes the icon that is shown when a balloon message is displayed.
QIcon icon
the system tray icon
void messageClicked()
This signal is emitted when the message displayed using showMessage() was clicked by the user.
void setToolTip(const QString &tip)
bool isVisible() const
void showMessage(const QString &title, const QString &msg, const QIcon &icon, int msecs=10000)
static bool isSystemTrayAvailable()
Returns true if the system tray is available; otherwise returns false.
static bool supportsMessages()
Returns true if the system tray supports balloon messages; otherwise returns false.
void setVisible(bool visible)
QSystemTrayIcon(QObject *parent=nullptr)
Constructs a QSystemTrayIcon object with the given parent.
~QSystemTrayIcon()
Removes the icon from the system tray and frees all allocated resources.
void setIcon(const QIcon &icon)
QString toolTip
the tooltip for the system tray entry
bool visible
whether the system tray entry is visible
QRect geometry() const
\reentrant
Definition qtextoption.h:18
\inmodule QtCore
Definition qcoreevent.h:366
int timerId() const
Returns the unique timer identifier, which is the same identifier as returned from QObject::startTime...
Definition qcoreevent.h:370
static QRect availableScreenGeometry(const QWidget *widget)
Definition qwidget_p.h:474
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
void setLayout(QLayout *)
Sets the layout manager for this widget to layout.
void setAttribute(Qt::WidgetAttribute, bool on=true)
Sets the attribute attribute on this widget if on is true; otherwise clears the attribute.
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,...
Definition qwidget.cpp:7590
void setMask(const QBitmap &)
Causes only the pixels of the widget for which bitmap has a corresponding 1 bit to be visible.
void updateGeometry()
Notifies the layout system that this widget has changed and may need to change geometry.
void setSizePolicy(QSizePolicy)
QLayout * layout() const
Returns the layout manager that is installed on this widget, or \nullptr if no layout manager is inst...
void setPalette(const QPalette &)
Definition qwidget.cpp:4530
QPalette palette
the widget's palette
Definition qwidget.h:132
QPoint pos
the position of the widget within its parent widget
Definition qwidget.h:111
bool close()
Closes this widget.
Definition qwidget.cpp:8562
void move(int x, int y)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qwidget.h:880
QList< QAction * > actions() const
Returns the (possibly empty) list of this widget's actions.
Definition qwidget.cpp:3207
QRect rect
the internal geometry of the widget excluding any window frame
Definition qwidget.h:116
void show()
Shows the widget and its child widgets.
Definition qwidget.cpp:7875
friend class QPixmap
Definition qwidget.h:748
QSize sizeHint
the recommended size for the widget
Definition qwidget.h:148
QStyle * style() const
Definition qwidget.cpp:2600
void setFont(const QFont &)
Definition qwidget.cpp:4667
QFont font
the font currently set for the widget
Definition qwidget.h:133
virtual void resizeEvent(QResizeEvent *event)
This event handler can be reimplemented in a subclass to receive widget resize events which are passe...
Definition qwidget.cpp:9822
bool underMouse() const
Returns true if the widget is under the mouse cursor; otherwise returns false.
Definition qwidget.h:859
QScreen * screen() const
Returns the screen the widget is on.
Definition qwidget.cpp:2496
QPushButton
[1]
opt iconSize
QStyleOptionButton opt
Combined button and popup list for selecting options.
Definition qcompare.h:63
@ AlignTop
Definition qnamespace.h:153
@ AlignLeft
Definition qnamespace.h:144
@ LeftButton
Definition qnamespace.h:58
@ WA_DeleteOnClose
Definition qnamespace.h:321
@ PlainText
@ color1
Definition qnamespace.h:29
@ black
Definition qnamespace.h:30
@ color0
Definition qnamespace.h:28
NSMenu QCocoaMenu * platformMenu
#define Q_UNLIKELY(x)
#define qWarning
Definition qlogging.h:166
constexpr const T & qMin(const T &a, const T &b)
Definition qminmax.h:40
constexpr const T & qMax(const T &a, const T &b)
Definition qminmax.h:42
#define SLOT(a)
Definition qobjectdefs.h:52
#define SIGNAL(a)
Definition qobjectdefs.h:53
GLbitfield GLuint64 timeout
[4]
GLint GLenum GLsizei GLsizei GLsizei GLint border
GLfloat GLfloat f
GLuint color
[2]
GLuint GLsizei const GLchar * message
GLsizei GLfixed GLfixed GLfixed GLfixed const GLubyte * bitmap
GLint limit
GLdouble GLdouble GLdouble GLdouble q
Definition qopenglext.h:259
GLsizei const GLchar *const * path
static QT_BEGIN_NAMESPACE QIcon messageIcon2qIcon(QSystemTrayIcon::MessageIcon icon)
static QBalloonTip * theSolitaryBalloonTip
#define emit
#define Q_UNUSED(x)
QObject::connect nullptr
QString title
[35]
QPainter painter(this)
[7]
QMenu menu
[5]