Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Solved Crash when double clicked file to open App in Mac OS

    General and Desktop
    2
    11
    2308
    Loading More Posts
    • 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.
    • joeQ
      joeQ last edited by joeQ

      I am true, i get into trouble which is same with this topix 5 years before.

      I just want to finish the function that user can double clicked file to open application. I searched the solution from internet. like

      stackoverflow
      QFileOpenEvent

      Every thing looks good, when i clicked qt debug button to run my demo, app startup. it is running well. I also drag one file to dropped on the Dock icon of the application. My app get the file path. I also use the mouse on file, right button, chose open, ok, also can get the file path. this, i tried double clicked file, it can also get file path.

      But,

      when i close the app. I tried double clicked file to startup app. It Crash. just like 5 years before.

      1. what i wrong? How to resolve it ?
      2. where is i can find QtSDK in Demos/4.7/browser? I had find Qt4.7 at here

      Just do it!

      jsulm 1 Reply Last reply Reply Quote 0
      • jsulm
        jsulm Lifetime Qt Champion @joeQ last edited by jsulm

        @joeQ It is not clear to me: do you double click your executable to start your app?
        If so, then you need to deploy your app first to make this work. See here: http://doc.qt.io/qt-5/osx-deployment.html
        Your app is not starting outside of QtCreator because the OS cannot find needed libraries (QtCreator prepares the environment before starting an app, so it is working there).

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        joeQ 2 Replies Last reply Reply Quote 1
        • joeQ
          joeQ @jsulm last edited by

          @jsulm double clicked specific extension file eg: *.pro , if you double clicked *.pro file, you can startup qtcreate app.

          I double clicked eg. a.abc file, to startup my app.

          Just do it!

          1 Reply Last reply Reply Quote 0
          • joeQ
            joeQ @jsulm last edited by

            @jsulm now i use the QFileOpenEvent in Mac OS. I writen code following the QFileOpenEvent help manual.

            Just do it!

            jsulm 1 Reply Last reply Reply Quote 0
            • jsulm
              jsulm Lifetime Qt Champion @joeQ last edited by

              @joeQ Well, then you need to debug.
              You can for example add qDebug() logs in the code where you think it crashes to localize the exact position in your code.

              Why Qt 4.7?

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              joeQ 1 Reply Last reply Reply Quote 0
              • joeQ
                joeQ @jsulm last edited by

                @jsulm I find one topix, he got the same problem like me. he said,QtSDK 4.7/Demos/browser has the some function. so i want to see the demo code.

                Just do it!

                jsulm 1 Reply Last reply Reply Quote 0
                • jsulm
                  jsulm Lifetime Qt Champion @joeQ last edited by

                  @joeQ Why not debug your app to find out where it crashes?

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  joeQ 2 Replies Last reply Reply Quote 0
                  • joeQ
                    joeQ @jsulm last edited by

                    @jsulm Debug is well, not crash.

                    1. when i startup my app. then to double clicked *.abc file, my app can get the file path from QFileOpenEvent;

                    2. when i close my app. then to double clicked *.abc file, want to startup my app, just like *.pro srartup qtcreate. the mac os show crash infomation.

                    like the person's description 5 years before

                    this case, how to debug ? only print some info to txt file.

                    Just do it!

                    jsulm 1 Reply Last reply Reply Quote 0
                    • joeQ
                      joeQ @jsulm last edited by

                      @jsulm This is my Info.plist file

                      <?xml version="1.0" encoding="UTF-8"?>
                      <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
                      <plist version="1.0">
                      <dict>
                              <key>CFBundleDocumentTypes</key>
                              <array>
                                      <dict>
                                              <key>CFBundleTypeExtensions</key>
                                              <array>
                                                      <string>abc</string>
                                              </array>
                                              <key>CFBundleTypeRole</key>
                                              <string>Editor</string>
                                      </dict>
                              </array>
                      	<key>NSPrincipalClass</key>
                      	<string>NSApplication</string>
                      	<key>CFBundleIconFile</key>
                      	<string></string>
                      	<key>CFBundlePackageType</key>
                      	<string>APPL</string>
                      	<key>CFBundleGetInfoString</key>
                      	<string>Created by Qt/QMake</string>
                      	<key>CFBundleSignature</key>
                      	<string>????</string>
                      	<key>CFBundleExecutable</key>
                      	<string>fileType</string>
                      	<key>CFBundleIdentifier</key>
                      	<string>ibigstone.fileType</string>
                      	<key>NOTE</key>
                      	<string>This file was generated by Qt/QMake.</string>
                      </dict>
                      </plist>
                      

                      Just do it!

                      1 Reply Last reply Reply Quote 0
                      • jsulm
                        jsulm Lifetime Qt Champion @joeQ last edited by

                        @joeQ How to debug? I already suggested how: add qDebug() logs in your code.
                        One question: does your app crash if you double click on its executable (or more generic question: does your app work outside of QtCreator?)?

                        https://forum.qt.io/topic/113070/qt-code-of-conduct

                        joeQ 1 Reply Last reply Reply Quote 0
                        • joeQ
                          joeQ @jsulm last edited by

                          @jsulm I think, I used wrong my Info.plist content.I am new bird for Mac OS, I don't know well about the info.plist. Ok, I wiil spend some time to get it well. Thank u very much.

                          oh, my app worked outsied of QtCreator. so I this case, i think use the write log file is the only way to debug app not the qDebug("----").

                          Just do it!

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post