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. OSX - handling QEvent::FileOpen
Forum Updated to NodeBB v4.3 + New Features

OSX - handling QEvent::FileOpen

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 1.6k 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.
  • F Offline
    F Offline
    fredrossperry
    wrote on last edited by
    #1

    In my app, I want to check to see if the user wants to open a file via Finder (using QEvent::FileOpen). If hey haven't, then I want to show a file dialog to ask them for one. But I need to run exec() for events to start flowing. Is there an event that happens after QEvent::FileOpen, that I can use to know that a QEvent::FileOpen is not coming? I'd rather not use a timer. Thanks.

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

      Hi,

      The event will only happen if e.g. the user drops the file on your application icon. Since this should happen very early in the process, you could set a flag and check it in a slot called using a QTimer::singleShot with 0 as timeout value. This should let the event loop spin enough so that you can handle the FileOpen event. Note that I haven't tried that

      Hope it helps

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

      1 Reply Last reply
      0
      • F Offline
        F Offline
        fredrossperry
        wrote on last edited by
        #3

        Thanks, that seems to work. Do we all think this can be relied upon?

        1 Reply Last reply
        0
        • F Offline
          F Offline
          fredrossperry
          wrote on last edited by
          #4

          I take that back. If I put in a non-zero timeout, it works. Zero does not. Currently I've got 100 msec.

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

            Then the event get's a bit later through than I thought. Anyway, did you check if that value is also valid when your computer is under load ?

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

            1 Reply Last reply
            0
            • F Offline
              F Offline
              fredrossperry
              wrote on last edited by
              #6

              I guess I'm going to have to.

              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