Results 1 to 5 of 5

Thread: QFileDialog

  1. #1

    Default QFileDialog

    In my program I use a QFileDialog to let the user pick a file to open. This works perfect as it should both when I start the program from inside Qt and when I start the app-bundle in finder (I'm sitting on a mac).

    Now I want to deploy the application so it can be used on other computers without Qt installed. I use a script that copies some Qt frameworks (core and gui) to inside the app-bundle and then use install_name_tool. I have used the exact same script for many other programs before and it works perfect.

    The final app-bundle works fine to start. When I click the button to open the filedialog, it shows as it should. But when I close the dialog window, the program crashes with a EXC_BAD_ACCESS. It doesn't matter if I chose a file or not, it always crashes directly after I try to close the file dialog. I have commented out all the other code for the button-click so it must be something with the filedialog.

    The function is now:

    void MainWindow::button_clicked()
    {
    QString name = QFileDialog::getOpenFileName(this, "Open File");
    }

    Any ideas?
    Last edited by skizzik; 23rd August 2011 at 13:02.

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QFileDialog

    I doubt it would be something with filedialog, maybe you are overwriting a buffer somewhere?

  3. #3

    Default Re: QFileDialog

    Thanks for the answer! How am I overwriting a buffer do you think?

    If I change the function to:

    void MainWindow::button_clicked()
    {
    QString name = QFileDialog::getOpenFileName(this, "Open File");
    while(true);
    }

    the program still crashes promptly after I close the dialog-window. If i run it before copying the frameworks it freezes of course. And as I said, it works perfect before I move the frameworks to inside the bundle. And all previous programs works perfect after running the script, many of them use QFileDialog too.

    The script just copies the frameworks to the bundle and then run a few lines like:
    install_name_tool -id @executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore myapp.app/Contents/Frameworks/QtCore.framework/Versions/4/QtCore
    install_name_tool -change QtCore.framework/Versions/4/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore myapp.app/Contents/MacOs/balans

  4. #4

    Default Re: QFileDialog

    Nobody who has any idea of ​​what might be causing the error?

  5. #5
    Join Date
    Jun 2011
    Location
    Finland
    Posts
    164
    Thanks
    1
    Thanked 26 Times in 26 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Maemo/MeeGo

    Default Re: QFileDialog

    There might be problem with libraries you are using. Make sure they are correct versions. Try to run it against both release and debug versions.
    Don't write a post just to thank someone, use "Thanks" button.

Similar Threads

  1. QFileDialog use
    By Doug Broadwell in forum Qt Programming
    Replies: 4
    Last Post: 15th February 2008, 09:24
  2. QFileDialog
    By merry in forum Qt Programming
    Replies: 1
    Last Post: 15th December 2007, 13:41
  3. QFileDialog
    By ToddAtWSU in forum Qt Programming
    Replies: 2
    Last Post: 29th November 2007, 13:36
  4. QFileDialog Mac / PC
    By hey in forum Qt Programming
    Replies: 3
    Last Post: 26th April 2007, 18:23
  5. [Qt4] need help with QFileDialog
    By patcito in forum Qt Programming
    Replies: 2
    Last Post: 7th January 2006, 18:00

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.