Warning, file /include/QtWidgets/qsystemtrayicon.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004 #ifndef QSYSTEMTRAYICON_H
0005 #define QSYSTEMTRAYICON_H
0006
0007 #include <QtWidgets/qtwidgetsglobal.h>
0008 #include <QtCore/qobject.h>
0009
0010 #ifndef QT_NO_SYSTEMTRAYICON
0011
0012 #include <QtGui/qicon.h>
0013
0014 QT_BEGIN_NAMESPACE
0015
0016
0017 class QSystemTrayIconPrivate;
0018
0019 class QMenu;
0020 class QEvent;
0021 class QWheelEvent;
0022 class QMouseEvent;
0023 class QPoint;
0024
0025 class Q_WIDGETS_EXPORT QSystemTrayIcon : public QObject
0026 {
0027 Q_OBJECT
0028 Q_PROPERTY(QString toolTip READ toolTip WRITE setToolTip)
0029 Q_PROPERTY(QIcon icon READ icon WRITE setIcon)
0030 Q_PROPERTY(bool visible READ isVisible WRITE setVisible DESIGNABLE false)
0031
0032 public:
0033 QSystemTrayIcon(QObject *parent = nullptr);
0034 QSystemTrayIcon(const QIcon &icon, QObject *parent = nullptr);
0035 ~QSystemTrayIcon();
0036
0037 enum ActivationReason {
0038 Unknown,
0039 Context,
0040 DoubleClick,
0041 Trigger,
0042 MiddleClick
0043 };
0044
0045 #if QT_CONFIG(menu)
0046 void setContextMenu(QMenu *menu);
0047 QMenu *contextMenu() const;
0048 #endif
0049
0050 QIcon icon() const;
0051 void setIcon(const QIcon &icon);
0052
0053 QString toolTip() const;
0054 void setToolTip(const QString &tip);
0055
0056 static bool isSystemTrayAvailable();
0057 static bool supportsMessages();
0058
0059 enum MessageIcon { NoIcon, Information, Warning, Critical };
0060
0061 QRect geometry() const;
0062 bool isVisible() const;
0063
0064 public Q_SLOTS:
0065 void setVisible(bool visible);
0066 inline void show() { setVisible(true); }
0067 inline void hide() { setVisible(false); }
0068 void showMessage(const QString &title, const QString &msg, const QIcon &icon, int msecs = 10000);
0069 void showMessage(const QString &title, const QString &msg,
0070 QSystemTrayIcon::MessageIcon icon = QSystemTrayIcon::Information, int msecs = 10000);
0071
0072 Q_SIGNALS:
0073 void activated(QSystemTrayIcon::ActivationReason reason);
0074 void messageClicked();
0075
0076 protected:
0077 bool event(QEvent *event) override;
0078
0079 private:
0080 Q_DISABLE_COPY(QSystemTrayIcon)
0081 Q_DECLARE_PRIVATE(QSystemTrayIcon)
0082
0083 Q_PRIVATE_SLOT(d_func(), void _q_emitActivated(QPlatformSystemTrayIcon::ActivationReason))
0084
0085 friend class QSystemTrayIconSys;
0086 friend class QBalloonTip;
0087 };
0088
0089 QT_END_NAMESPACE
0090
0091 #endif
0092 #endif