diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2017-11-25 18:00:06 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2017-11-25 18:00:06 +0000 |
| commit | 8453224119a4c5ff7d47d9cd4924d0b1ccb99b3a (patch) | |
| tree | 15d339b62e98d5858a57aa787334e14f0e2f0ad7 /src/plugins/General/statusicon/qmmptrayicon.cpp | |
| parent | 6fc05db7c6de9a51beba754f12ff4ac32859977d (diff) | |
| download | qmmp-8453224119a4c5ff7d47d9cd4924d0b1ccb99b3a.tar.gz qmmp-8453224119a4c5ff7d47d9cd4924d0b1ccb99b3a.tar.bz2 qmmp-8453224119a4c5ff7d47d9cd4924d0b1ccb99b3a.zip | |
copy 1.2 branch to trunk
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@7772 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/General/statusicon/qmmptrayicon.cpp')
| -rw-r--r-- | src/plugins/General/statusicon/qmmptrayicon.cpp | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/src/plugins/General/statusicon/qmmptrayicon.cpp b/src/plugins/General/statusicon/qmmptrayicon.cpp index 4113b53a4..5667d8637 100644 --- a/src/plugins/General/statusicon/qmmptrayicon.cpp +++ b/src/plugins/General/statusicon/qmmptrayicon.cpp @@ -21,11 +21,12 @@ #include <QEvent> #include <QWheelEvent> #include <QMouseEvent> -#include <QApplication> +#include <QGuiApplication> +#include <QWindow> #include <qmmp/soundcore.h> #include "qmmptrayicon.h" -#ifdef Q_WS_X11 +#ifdef QMMP_WS_X11 #include "statusiconpopupwidget.h" #endif @@ -41,19 +42,24 @@ QmmpTrayIcon::~QmmpTrayIcon() void QmmpTrayIcon::setToolTip(const QString &tip) { -#ifdef Q_WS_X11 - m_message = tip; - if(m_popupWidget) - showToolTip(); +#ifdef QMMP_WS_X11 + if(hasToolTipEvent()) + { + m_message = tip; + if(m_popupWidget) + showToolTip(); + } + else + QSystemTrayIcon::setToolTip(tip); #else QSystemTrayIcon::setToolTip(tip); #endif } -#ifdef Q_WS_X11 +#ifdef QMMP_WS_X11 bool QmmpTrayIcon::event(QEvent *e) { - if (e->type() == QEvent::Wheel) + if (e->type() == QEvent::Wheel ) { wheelEvent((QWheelEvent *) e); e->accept(); @@ -68,6 +74,18 @@ bool QmmpTrayIcon::event(QEvent *e) return QSystemTrayIcon::event(e); } +bool QmmpTrayIcon::hasToolTipEvent() +{ + //checking for XEmbed system tray implementation + //only this implementation is able to send QHelpEvent + foreach (QWindow *w, qApp->allWindows()) + { + if(w->objectName() == "QSystemTrayIconSysWindow") + return true; + } + return false; +} + void QmmpTrayIcon::wheelEvent(QWheelEvent *e) { SoundCore::instance()->changeVolume(e->delta()/20); |
