Qt6 topics merged with General

Does QSystemTrayIcon support QDropEvent?

  • Is there any way to intercept drop events on a system tray icon? I've checked the official documentation for [url=http://doc.trolltech.com/4.7-snapshot/qsystemtrayicon.html]QSystemTrayIcon[/url] and it doesn't mention anything about drop events.

    I was hoping drag/drop events could be configured for systray icons similar to [url=http://doc.trolltech.com/4.6/qtablewidget.html#dropEvent]QTableWidget[/url]. I'd like to be able to drag files from my desktop onto a system tray icon and
    void DropArea::dropEvent(QDropEvent *event)
    const QMimeData *mimeData = event->mimeData();
    if (mimeData->hasUrls()) {
    QList<QUrl> urlList = mimeData->urls();
    QString text;
    for (int i = 0; i < urlList.size(); ++i) {
    QString url = urlList.at(i).path();
    text += url + QString("\n");
    // do something with text

  • youre right, it doesnt mention anything about it in the docs... im going to say probably not possible...

    which is a shame... maybe someone else will know more and be able to prove me wrong...

  • Yes, apparently you have to use native API.

Log in to reply