Important: Please read the Qt Code of Conduct -

Crash when double clicked file to open App in Mac OS

  • 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


    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.


    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

  • Lifetime Qt Champion

    @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:
    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).

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

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

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

  • Lifetime Qt Champion

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

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

  • Lifetime Qt Champion

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

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

  • @jsulm This is my Info.plist file

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
    <plist version="1.0">
    	<string>Created by Qt/QMake</string>
    	<string>This file was generated by Qt/QMake.</string>

  • Lifetime Qt Champion

    @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?)?

  • @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("----").

Log in to reply