Wrapper class for platfrom-independent Qt-based tray menu.
More...
#include <src/QtTrayMenu.h>
|
|
void | exit () |
| | Exit tray and cleanup resources.
|
| |
|
void | showMenu () const |
| | Show tray context menu.
|
| |
| void | update (struct tray *tray, bool notify=true) |
| | Update tray configuration.
|
| |
|
| void | clickMenuItem (int index) const |
| | Simulate click on menu item.
|
| |
|
void | clickMessage () const |
| | Simulate click on popup message.
|
| |
| void | configureAppMetadata (const QString &appName, const QString &appDisplayName, const QString &desktopName) const |
| | Configure metadata for QApplication.
|
| |
| bool | eventFilter (QObject *watched, QEvent *event) override |
| | QObject override to filter events on watched object.
|
| |
| int | init (struct tray *tray, bool notification=true) |
| | Initialize tray with given structure.
|
| |
| int | loop (int blocking) |
| | Process tray loop events.
|
| |
| | QtTrayMenu (int argc, char **argv, QObject *parent=nullptr, bool debug=false) |
| | Create a QtTrayMenu instance.
|
| |
| | QtTrayMenu (QObject *parent=nullptr, bool debug=false) |
| | Create a QtTrayMenu instance.
|
| |
| void | showMessage (const QString &title, const QString &msg, const QString &iconPath, std::function< void()> callback=nullptr, int msecs=10000) |
| | Show tray message popup.
|
| |
| void | showMessage (const QString &title, const QString &msg, std::function< void()> callback=nullptr, QSystemTrayIcon::MessageIcon icon=QSystemTrayIcon::Information, int msecs=10000) |
| | Show tray message popup.
|
| |
Wrapper class for platfrom-independent Qt-based tray menu.
◆ QtTrayMenu() [1/2]
| QtTrayMenu::QtTrayMenu |
( |
QObject * | parent = nullptr, |
|
|
bool | debug = false ) |
|
explicit |
Create a QtTrayMenu instance.
- Parameters
-
| parent | optional parent Qt object |
| debug | if true isntall eventFilter for debug logging |
◆ QtTrayMenu() [2/2]
| QtTrayMenu::QtTrayMenu |
( |
int | argc, |
|
|
char ** | argv, |
|
|
QObject * | parent = nullptr, |
|
|
bool | debug = false ) |
|
explicit |
Create a QtTrayMenu instance.
- Parameters
-
| argc | argument count for QApplication (if that needs to be created) |
| argv | argument list for QApplication (if that needs to be created) |
| parent | optional parent Qt object |
| debug | if true isntall eventFilter for debug logging |
◆ clickMenuItem()
| void QtTrayMenu::clickMenuItem |
( |
int | index | ) |
const |
Simulate click on menu item.
- Parameters
-
| index | Menu item index to simulate click on |
◆ configureAppMetadata()
| void QtTrayMenu::configureAppMetadata |
( |
const QString & | appName, |
|
|
const QString & | appDisplayName, |
|
|
const QString & | desktopName ) const |
Configure metadata for QApplication.
- Parameters
-
| appName | the applications name |
| appDisplayName | the applications display name |
| desktopName | the applications desktop file name |
◆ eventFilter()
| bool QtTrayMenu::eventFilter |
( |
QObject * | watched, |
|
|
QEvent * | event ) |
|
override |
QObject override to filter events on watched object.
- Parameters
-
| watched | object watched for event |
| event | event on object |
- Returns
- true if event should be filtered out and not be processed further
- See also
- https://doc.qt.io/qt-6/qobject.html#eventFilter
◆ init()
| int QtTrayMenu::init |
( |
struct tray * | tray, |
|
|
bool | notification = true ) |
Initialize tray with given structure.
- Parameters
-
| tray | struct containing tray configuration |
| notification | fire tray notification if true |
- Returns
- 0 on success
◆ loop()
| int QtTrayMenu::loop |
( |
int | blocking | ) |
|
Process tray loop events.
- Parameters
-
| blocking | if true the function call will block until QtTrayMenu exits |
- Returns
- 0 on successful processing if non-blocking, -1 otherwise
◆ showMessage() [1/2]
| void QtTrayMenu::showMessage |
( |
const QString & | title, |
|
|
const QString & | msg, |
|
|
const QString & | iconPath, |
|
|
std::function< void()> | callback = nullptr, |
|
|
int | msecs = 10000 ) |
Show tray message popup.
- Parameters
-
| title | popup title |
| msg | popup message |
| callback | tray message callback function |
| iconPath | popup icon file path |
| msecs | popup display duration |
◆ showMessage() [2/2]
| void QtTrayMenu::showMessage |
( |
const QString & | title, |
|
|
const QString & | msg, |
|
|
std::function< void()> | callback = nullptr, |
|
|
QSystemTrayIcon::MessageIcon | icon = QSystemTrayIcon::Information, |
|
|
int | msecs = 10000 ) |
Show tray message popup.
- Parameters
-
| title | popup title |
| msg | popup message |
| callback | tray message callback function |
| icon | popup icon |
| msecs | popup display duration |
◆ supportsMessages()
| bool QtTrayMenu::supportsMessages |
( |
| ) |
|
|
static |
Check if QtTrayMenu supports messages.
- Returns
- true if messages can be shown
◆ update
| void QtTrayMenu::update |
( |
struct tray * | tray, |
|
|
bool | notify = true ) |
|
signal |
Update tray configuration.
- Parameters
-
| tray | struct containing tray configuration |
| notify | fire tray notification if true |
The documentation for this class was generated from the following files: