Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Does QSystemTrayIcon support QDropEvent?
Qt 6.11 is out! See what's new in the release blog

Does QSystemTrayIcon support QDropEvent?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 3.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    qttrekker
    wrote on last edited by
    #1

    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
    }
    }
    @

    1 Reply Last reply
    0
    • J Offline
      J Offline
      jorj
      wrote on last edited by
      #2

      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...

      1 Reply Last reply
      0
      • A Offline
        A Offline
        alexander
        wrote on last edited by
        #3

        Yes, apparently you have to use native API.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved