Drag & Drop to systray icon
-
Is it possible to get info about a file (or capture text that is) dragged and dropped on my Qt App systray icon ?
-
AFAIK you can't drop on the system tray, sorry.
Not on Windows. Whether it works on Linux or Mac, I don't know. -
"QSystemTrayIcon":http://doc.qt.nokia.com/stable/qsystemtrayicon.html inherits directly from QObject and does not accept drops at all.
I don't know if it is possible at all to do this on any operating system.
Do you really mean the system tray (see the screenshot in the link above). Or do you mean something like the "Dock":http://en.wikipedia.org/wiki/Dock_(computing) on "OS X":http://en.wikipedia.org/wiki/Dock_(Mac_OS_X) or the "Taskbar":http://en.wikipedia.org/wiki/Taskbar on windows?
-
@Volker yes i mean systray icon and i saw it on mac already, and also in windows in a c# application.
-
systray icon on the mac is in the top right corner, included in the menu bar. I do not know of an application that support a drop on this icon. You can have menus though.
-
SO, I tried with Notepad++ and it does not work. I don't know whether you can hack the system to achieve this, but I'm pretty sure, it will be system dependent programming, not Qt
-
is this related : http://developer.qt.nokia.com/forums/viewthread/943 ?
-
[quote author="ahmed.helal" date="1292951491"]is this related : http://developer.qt.nokia.com/forums/viewthread/943 ?[/quote]
Yes, it's the same problem in that thread.
-
@volker any idea if the suggested solution is valid ?
-
No chance to get drag'n'drop working with pure Qt, at least not in a platform independent manner.
QSystemTrayIcon is "only" a QObject, not a QWidget and therefore does not have setAccptDrops().
On a Mac the icon does not get any events at all (you can check by installing an event filter).
-
[quote author="Volker" date="1292951292"]systray icon on the mac is in the top right corner, included in the menu bar. I do not know of an application that support a drop on this icon. You can have menus though.[/quote]
For instance droplr. Check out its 30-sec screencast. http://droplr.com/hello
-
Thanks for the link, Peppe. It's the first droppable systray icon I've seen. Unfortunately I still do not have a solution on how to achieve this with Qt :-(