Qt 6.x
The Qt SDK
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
124{
125}
126
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 d->menu = menu;
166 d->updateMenu_sys();
167 if (oldMenu != menu && d->qpa_sys) {
168 // Show the QMenu-based menu for QPA plugins that do not provide native menus
169 if (oldMenu && !oldMenu->platformMenu())
171 if (menu && !menu->platformMenu()) {
173 menu,
174 [menu](QPoint globalNativePos, const QPlatformScreen *platformScreen)
175 {
176 QScreen *screen = platformScreen ? platformScreen->screen() : nullptr;
177 menu->popup(QHighDpi::fromNativePixels(globalNativePos, screen), nullptr);
178 });
179 }
180 }
181}
182
186QMenu* QSystemTrayIcon::contextMenu() const
187{
188 Q_D(const QSystemTrayIcon);
189 return d->menu;
190}
191
192#endif // QT_CONFIG(menu)
193
202{
203 Q_D(QSystemTrayIcon);
204 d->icon = icon;
205 d->updateIcon_sys();
206}
207
209{
210 Q_D(const QSystemTrayIcon);
211 return d->icon;
212}
213
222{
223 Q_D(QSystemTrayIcon);
224 d->toolTip = tooltip;
225 d->updateToolTip_sys();
226}
227
229{
230 Q_D(const QSystemTrayIcon);
231 return d->toolTip;
232}
233
257{
258 Q_D(const QSystemTrayIcon);
259 if (!d->visible)
260 return QRect();
261 return d->geometry_sys();
262}
263
272{
273 Q_D(QSystemTrayIcon);
274 if (visible == d->visible)
275 return;
276 if (Q_UNLIKELY(visible && d->icon.isNull()))
277 qWarning("QSystemTrayIcon::setVisible: No Icon set");
278 d->visible = visible;
279 if (d->visible)
280 d->install_sys();
281 else
282 d->remove_sys();
283}
284
286{
287 Q_D(const QSystemTrayIcon);
288 return d->visible;
289}
290
295{
296 return QObject::event(e);
297}
298
348{
350}
351
358{
360}
361
385 QSystemTrayIcon::MessageIcon msgIcon, int msecs)
386{
387 Q_D(QSystemTrayIcon);
388 if (d->visible)
389 d->showMessage_sys(title, msg, messageIcon2qIcon(msgIcon), msgIcon, msecs);
390}
391
403 const QIcon &icon, int msecs)
404{
405 Q_D(QSystemTrayIcon);
406 if (d->visible)
407 d->showMessage_sys(title, msg, icon, QSystemTrayIcon::NoIcon, msecs);
408}
409
411{
412 Q_Q(QSystemTrayIcon);
413 emit q->activated(static_cast<QSystemTrayIcon::ActivationReason>(reason));
414}
415
418
420 const QString &message, QSystemTrayIcon *trayIcon,
421 const QPoint &pos, int timeout, bool showArrow)
422{
423 hideBalloon();
424 if (message.isEmpty() && title.isEmpty())
425 return;
426
428 if (timeout < 0)
429 timeout = 10000; //10 s default
430 theSolitaryBalloonTip->balloon(pos, timeout, showArrow);
431}
432
434{
436 return;
439 theSolitaryBalloonTip = nullptr;
440}
441
443{
445 return;
447 theSolitaryBalloonTip->balloon(pos, 0, theSolitaryBalloonTip->showArrow);
448}
449
451{
453}
454
455QBalloonTip::QBalloonTip(const QIcon &icon, const QString &title,
456 const QString &message, QSystemTrayIcon *ti)
457 : QWidget(nullptr, Qt::ToolTip),
458 trayIcon(ti),
459 timerId(-1),
460 showArrow(true)
461{
463 QObject::connect(ti, SIGNAL(destroyed()), this, SLOT(close()));
464
465#if QT_CONFIG(label)
466 QLabel *titleLabel = new QLabel;
467 titleLabel->installEventFilter(this);
468 titleLabel->setText(title);
469 QFont f = titleLabel->font();
470 f.setBold(true);
471 titleLabel->setFont(f);
472 titleLabel->setTextFormat(Qt::PlainText); // to maintain compat with windows
473#endif
474
475 const int iconSize = 18;
476 const int closeButtonSize = 15;
477
478#if QT_CONFIG(pushbutton)
479 QPushButton *closeButton = new QPushButton;
480 closeButton->setIcon(style()->standardIcon(QStyle::SP_TitleBarCloseButton));
481 closeButton->setIconSize(QSize(closeButtonSize, closeButtonSize));
483 closeButton->setFixedSize(closeButtonSize, closeButtonSize);
484 QObject::connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
485#else
486 Q_UNUSED(closeButtonSize);
487#endif
488
489#if QT_CONFIG(label)
490 QLabel *msgLabel = new QLabel;
491 msgLabel->installEventFilter(this);
492 msgLabel->setText(message);
493 msgLabel->setTextFormat(Qt::PlainText);
495
496 // smart size for the message label
498 if (msgLabel->sizeHint().width() > limit) {
499 msgLabel->setWordWrap(true);
500 if (msgLabel->sizeHint().width() > limit) {
501 msgLabel->d_func()->ensureTextControl();
502 if (QWidgetTextControl *control = msgLabel->d_func()->control) {
503 QTextOption opt = control->document()->defaultTextOption();
504 opt.setWrapMode(QTextOption::WrapAnywhere);
505 control->document()->setDefaultTextOption(opt);
506 }
507 }
508 // Here we allow the text being much smaller than the balloon widget
509 // to emulate the weird standard windows behavior.
510 msgLabel->setFixedSize(limit, msgLabel->heightForWidth(limit));
511 }
512#endif
513
515#if QT_CONFIG(label)
516 if (!icon.isNull()) {
517 QLabel *iconLabel = new QLabel;
518 iconLabel->setPixmap(icon.pixmap(iconSize, iconSize));
520 iconLabel->setMargin(2);
521 layout->addWidget(iconLabel, 0, 0);
522 layout->addWidget(titleLabel, 0, 1);
523 } else {
524 layout->addWidget(titleLabel, 0, 0, 1, 2);
525 }
526#endif
527
528#if QT_CONFIG(pushbutton)
529 layout->addWidget(closeButton, 0, 2);
530#endif
531
532#if QT_CONFIG(label)
533 layout->addWidget(msgLabel, 1, 0, 1, 3);
534#endif
536 layout->setContentsMargins(3, 3, 3, 3);
538
539 QPalette pal = palette();
540 pal.setColor(QPalette::Window, QColor(0xff, 0xff, 0xe1));
542 setPalette(pal);
543}
544
545QBalloonTip::~QBalloonTip()
546{
547 theSolitaryBalloonTip = nullptr;
548}
549
551{
552 QPainter painter(this);
553 painter.drawPixmap(rect(), pixmap);
554}
555
557{
559}
560
561void QBalloonTip::balloon(const QPoint& pos, int msecs, bool showArrow)
562{
563 this->showArrow = showArrow;
565 if (!screen)
567 QRect screenRect = screen->geometry();
568 QSize sh = sizeHint();
569 const int border = 1;
570 const int ah = 18, ao = 18, aw = 18, rc = 7;
571 bool arrowAtTop = (pos.y() + sh.height() + ah < screenRect.height());
572 bool arrowAtLeft = (pos.x() + sh.width() - ao < screenRect.width());
573 setContentsMargins(border + 3, border + (arrowAtTop ? ah : 0) + 2, border + 3, border + (arrowAtTop ? 0 : ah) + 2);
575 sh = sizeHint();
576
577 int ml, mr, mt, mb;
578 QSize sz = sizeHint();
579 if (!arrowAtTop) {
580 ml = mt = 0;
581 mr = sz.width() - 1;
582 mb = sz.height() - ah - 1;
583 } else {
584 ml = 0;
585 mt = ah;
586 mr = sz.width() - 1;
587 mb = sz.height() - 1;
588 }
589
591 path.moveTo(ml + rc, mt);
592 if (arrowAtTop && arrowAtLeft) {
593 if (showArrow) {
594 path.lineTo(ml + ao, mt);
595 path.lineTo(ml + ao, mt - ah);
596 path.lineTo(ml + ao + aw, mt);
597 }
598 move(qMax(pos.x() - ao, screenRect.left() + 2), pos.y());
599 } else if (arrowAtTop && !arrowAtLeft) {
600 if (showArrow) {
601 path.lineTo(mr - ao - aw, mt);
602 path.lineTo(mr - ao, mt - ah);
603 path.lineTo(mr - ao, mt);
604 }
605 move(qMin(pos.x() - sh.width() + ao, screenRect.right() - sh.width() - 2), pos.y());
606 }
607 path.lineTo(mr - rc, mt);
608 path.arcTo(QRect(mr - rc*2, mt, rc*2, rc*2), 90, -90);
609 path.lineTo(mr, mb - rc);
610 path.arcTo(QRect(mr - rc*2, mb - rc*2, rc*2, rc*2), 0, -90);
611 if (!arrowAtTop && !arrowAtLeft) {
612 if (showArrow) {
613 path.lineTo(mr - ao, mb);
614 path.lineTo(mr - ao, mb + ah);
615 path.lineTo(mr - ao - aw, mb);
616 }
617 move(qMin(pos.x() - sh.width() + ao, screenRect.right() - sh.width() - 2),
618 pos.y() - sh.height());
619 } else if (!arrowAtTop && arrowAtLeft) {
620 if (showArrow) {
621 path.lineTo(ao + aw, mb);
622 path.lineTo(ao, mb + ah);
623 path.lineTo(ao, mb);
624 }
625 move(qMax(pos.x() - ao, screenRect.x() + 2), pos.y() - sh.height());
626 }
627 path.lineTo(ml + rc, mb);
628 path.arcTo(QRect(ml, mb - rc*2, rc*2, rc*2), -90, -90);
629 path.lineTo(ml, mt + rc);
630 path.arcTo(QRect(ml, mt, rc*2, rc*2), 180, -90);
631
632 // Set the mask
634 bitmap.fill(Qt::color0);
635 QPainter painter1(&bitmap);
636 painter1.setPen(QPen(Qt::color1, border));
637 painter1.setBrush(QBrush(Qt::color1));
638 painter1.drawPath(path);
640
641 // Draw the border
642 pixmap = QPixmap(sz);
643 QPainter painter2(&pixmap);
644 painter2.setPen(QPen(palette().color(QPalette::Window).darker(160), border));
645 painter2.setBrush(palette().color(QPalette::Window));
646 painter2.drawPath(path);
647
648 if (msecs > 0)
649 timerId = startTimer(msecs);
650 show();
651}
652
654{
655 close();
656 if (e->button() == Qt::LeftButton)
657 emit trayIcon->messageClicked();
658}
659
661{
662 if (e->timerId() == timerId) {
663 killTimer(timerId);
664 if (!underMouse())
665 close();
666 return;
667 }
669}
670
672void QSystemTrayIconPrivate::install_sys_qpa()
673{
674 qpa_sys->init();
682}
683
684void QSystemTrayIconPrivate::remove_sys_qpa()
685{
690 qpa_sys->cleanup();
691}
692
693void QSystemTrayIconPrivate::addPlatformMenu(QMenu *menu) const
694{
695#if QT_CONFIG(menu)
696 if (menu->platformMenu())
697 return; // The platform menu already exists.
698
699 // The recursion depth is the same as menu depth, so should not
700 // be higher than 3 levels.
701 const auto actions = menu->actions();
702 for (QAction *action : actions) {
703 if (action->menu())
704 addPlatformMenu(action->menu());
705 }
706
707 // This menu should be processed *after* its children, otherwise
708 // setMenu() is not called on respective QPlatformMenuItems.
710 if (platformMenu)
712#else
713 Q_UNUSED(menu);
714#endif // QT_CONFIG(menu)
715}
716
718
719#endif // QT_NO_SYSTEMTRAYICON
720
721#include "moc_qsystemtrayicon.cpp"
722#include "moc_qsystemtrayicon_p.cpp"
void setIcon(const QIcon &icon)
void setIconSize(const QSize &size)
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:20
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:312
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:973
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:788
The QLabel widget provides a text or image display.
Definition qlabel.h:20
int heightForWidth(int) const override
\reimp
Definition qlabel.cpp:650
void setText(const QString &)
Definition qlabel.cpp:263
void setTextFormat(Qt::TextFormat)
Definition qlabel.cpp:1374
void setMargin(int)
Definition qlabel.cpp:541
void setPixmap(const QPixmap &)
Definition qlabel.cpp:339
void setAlignment(Qt::Alignment)
Definition qlabel.cpp:442
void setWordWrap(bool on)
Definition qlabel.cpp:472
QSize sizeHint() const override
\reimp
Definition qlabel.cpp:820
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:1240
@ 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:3682
void setPlatformMenu(QPlatformMenu *platformMenu)
Definition qmenu.cpp:3690
\inmodule QtGui
Definition qevent.h:195
\inmodule QtCore
Definition qobject.h:90
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:1792
void installEventFilter(QObject *filterObj)
Installs an event filter filterObj on this object.
Definition qobject.cpp:2269
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
Definition qobject.cpp:2823
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:1363
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
\threadsafe
Definition qobject.cpp:3099
virtual void timerEvent(QTimerEvent *event)
This event handler can be reimplemented in a subclass to receive timer events for the object.
Definition qobject.cpp:1433
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:1872
The QPaintEvent class contains event parameters for paint events.
Definition qevent.h:485
\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:145
@ WindowText
Definition qpalette.h:50
\inmodule QtGui
Definition qpen.h:25
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:23
constexpr int x() const noexcept
Returns the x coordinate of this point.
Definition qpoint.h:127
constexpr int y() const noexcept
Returns the y coordinate of this point.
Definition qpoint.h:132
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:238
constexpr int left() const noexcept
Returns the x-coordinate of the rectangle's left edge.
Definition qrect.h:172
constexpr int x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
Definition qrect.h:184
constexpr int width() const noexcept
Returns the width of the rectangle.
Definition qrect.h:235
constexpr int right() const noexcept
Returns the x-coordinate of the rectangle's right edge.
Definition qrect.h:178
The QResizeEvent class contains event parameters for resize events.
Definition qevent.h:547
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
\inmodule QtCore
Definition qsize.h:25
constexpr int height() const noexcept
Returns the height.
Definition qsize.h:132
constexpr int width() const noexcept
Returns the width.
Definition qsize.h:129
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition qstring.h:1083
virtual QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const =0
StandardPixmap
This enum describes the available standard pixmaps.
Definition qstyle.h:714
@ SP_TitleBarCloseButton
Definition qstyle.h:718
@ SP_CustomBase
Definition qstyle.h:796
@ SP_MessageBoxCritical
Definition qstyle.h:726
@ SP_MessageBoxInformation
Definition qstyle.h:724
@ SP_MessageBoxWarning
Definition qstyle.h:725
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:359
static QRect availableScreenGeometry(const QWidget *widget)
Definition qwidget_p.h:468
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:7676
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:4537
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:8608
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
void hide()
Hides the widget.
Definition qwidget.cpp:8209
QList< QAction * > actions() const
Returns the (possibly empty) list of this widget's actions.
Definition qwidget.cpp:3214
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:7956
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:2607
void setFont(const QFont &)
Definition qwidget.cpp:4674
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:9868
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:2503
void setFixedSize(const QSize &)
Sets both the minimum and maximum sizes of the widget to s, thereby preventing it from ever growing o...
Definition qwidget.cpp:4089
double e
opt iconSize
QStyleOptionButton opt
Combined button and popup list for selecting options.
@ AlignTop
Definition qnamespace.h:152
@ AlignLeft
Definition qnamespace.h:143
@ LeftButton
Definition qnamespace.h:57
@ WA_DeleteOnClose
Definition qnamespace.h:320
@ PlainText
@ color1
Definition qnamespace.h:28
@ black
Definition qnamespace.h:29
@ color0
Definition qnamespace.h:27
NSMenu QCocoaMenu * platformMenu
#define Q_UNLIKELY(x)
#define qWarning
Definition qlogging.h:162
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:51
#define SIGNAL(a)
Definition qobjectdefs.h:52
GLbitfield GLuint64 timeout
[4]
GLint GLenum GLsizei GLsizei GLsizei GLint border
GLfloat GLfloat f
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]
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent