Window attached to a system tray icon
-
Hi everyone,
Is there any class to create a window attached to a system tray icon in a similar way as Dropbox does it?
Here you can find an example for "Mac OS X":https://d339l1rkauam1y.cloudfront.net/wp-content/uploads/2013/02/mac.png and another for "Windows":http://i1-news.softpedia-static.com/images/news2/Dropbox-2-0-Introduces-New-Tray-Menu-2.png.
Thanks!
-
Hi,
Looks like a job for a QML dialog otherwise you can also simply try with a decoration less widget.
Hope it helps
-
[quote author="Cesius" date="1421794006"]
Is there any class to create a window attached to a system tray icon in a similar way as Dropbox does it?[/quote]Not directly offered via the Qt API.
But you can try this:
Use QSystemTrayIcon::setContextMenu() to set a custom QMenu. This QMenu instance actually doesn't need to have a ordinary menu item but a QWidgetAction.
@
QWidgetAction* widgetAction = new QWidgetAction;
widgetAction->setDefaultWidget( widget );
QMenu* widgetMenu = new QMenu( sysTray );
widgetMenu->addAction( widgetAction );
sysTray->setMenu( widgetMenu );
@Haven't tested this code though, but worth a try.