diff options
| author | Ahmad Samir <a.samirh78@gmail.com> | 2024-09-04 02:59:37 +0300 |
|---|---|---|
| committer | Ahmad Samir <a.samirh78@gmail.com> | 2024-09-13 21:05:46 +0300 |
| commit | 56d8e7bee707bf4a8f1f89ed367ca4cb18d2bb3d (patch) | |
| tree | a752355c8ddd72f3661a114a0c31d546b76e7950 /src/widgets/util/qsystemtrayicon.cpp | |
| parent | 15520e03d377c13de7dd867ba7d5c8fb4dc9d1c9 (diff) | |
QSystemTrayIcon: use QBasicTimer instead of handling raw timer IDs
Change-Id: I5cb1099892d6c8a016b29f2c22cdef3f3eddae56
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/widgets/util/qsystemtrayicon.cpp')
| -rw-r--r-- | src/widgets/util/qsystemtrayicon.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp index 2a55f014e12..a21f84bb7cb 100644 --- a/src/widgets/util/qsystemtrayicon.cpp +++ b/src/widgets/util/qsystemtrayicon.cpp @@ -29,6 +29,8 @@ #include <private/qhighdpiscaling_p.h> #include <qpa/qplatformscreen.h> +using namespace std::chrono_literals; + QT_BEGIN_NAMESPACE static QIcon messageIcon2qIcon(QSystemTrayIcon::MessageIcon icon) @@ -460,7 +462,6 @@ QBalloonTip::QBalloonTip(const QIcon &icon, const QString &title, const QString &message, QSystemTrayIcon *ti) : QWidget(nullptr, Qt::ToolTip), trayIcon(ti), - timerId(-1), showArrow(true) { setAttribute(Qt::WA_DeleteOnClose); @@ -650,7 +651,7 @@ void QBalloonTip::balloon(const QPoint& pos, int msecs, bool showArrow) painter2.drawPath(path); if (msecs > 0) - timerId = startTimer(msecs); + timer.start(msecs * 1ms, this); show(); } @@ -663,8 +664,8 @@ void QBalloonTip::mousePressEvent(QMouseEvent *e) void QBalloonTip::timerEvent(QTimerEvent *e) { - if (e->timerId() == timerId) { - killTimer(timerId); + if (e->id() == timer.id()) { + timer.stop(); if (!underMouse()) close(); return; |
