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. How do I know when a user drags a document to my app's icon?
Forum Updated to NodeBB v4.3 + New Features

How do I know when a user drags a document to my app's icon?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 274 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.
  • TiggerDadT Offline
    TiggerDadT Offline
    TiggerDad
    wrote on last edited by
    #1

    I'm on a Mac. When a user wants to open a file in my app, they usually open my app and use the "Open" menu item. So I can then use QFileDialog::getOpenFileName() to get the file's path, and I can open the file.

    But sometimes they just go to the Finder and drag the file's icon on to my app's icon.

    How do I get notified when that happens? And how do I know what the file is? Is there a signal somewhere I need to listen to?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      I think you are looking for QFileOpenEvent.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      TiggerDadT 1 Reply Last reply
      2
      • SGaistS SGaist

        Hi and welcome to devnet,

        I think you are looking for QFileOpenEvent.

        TiggerDadT Offline
        TiggerDadT Offline
        TiggerDad
        wrote on last edited by
        #3

        @SGaist yes, that’s exactly the thing I was looking for.

        Many thanks. :-)

        B.

        1 Reply Last reply
        1
        • TiggerDadT TiggerDad has marked this topic as solved on

        • Login

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