Results 1 to 2 of 2

Thread: QFileDialog hang ups

  1. #1
    Join Date
    Aug 2007
    Posts
    275
    Thanks
    28
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default QFileDialog hang ups

    I was trying to use QFileDialog::getOpenFileName static function,when i ran my app normally not in debugging mode it runs fine, but when i ran it in my debugger (GDB) i encountered some "segmentation fault"

    please see my code below
    Qt Code:
    1. void MyFunc::openCFGFile(void)
    2. {
    3. QString strFile = QFileDialog::getOpenFileName(this,
    4. tr("Select Configuration File To Open"),"",
    5. "Configuration File (*.cfg)"); // <--segmentation fault happen here
    6. if (strFile.isEmpty())
    7. return;
    8. //store cfgFile
    9. cfgFile = new QFile(strFile);
    10. if (!cfgFile->open(QFile::ReadOnly))
    11. {
    12. QMessageBox::warning(this, tr("File Open Error"),
    13. tr("Cannot Open file %1:\n%2.")
    14. .arg(strFile)
    15. .arg(cfgFile->errorString()));
    16. cfgFile->close();
    17. return;
    18. }
    19. cfgFile->close();
    20. }
    To copy to clipboard, switch view to plain text mode 

    please tell me what did i do wrong?

    baray98

  2. #2
    Join Date
    Jan 2006
    Posts
    368
    Thanks
    14
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QFileDialog hang ups

    Used to happen to me on win32. Try using the non-native version (see the docs).\

    Not sure why it happened.

Similar Threads

  1. QFileDialog and file sequences
    By peterhillman in forum Qt Programming
    Replies: 5
    Last Post: 24th November 2007, 10:16
  2. Replies: 11
    Last Post: 31st May 2007, 01:11
  3. QFileDialog in Qt designer
    By tpf80 in forum Qt Tools
    Replies: 1
    Last Post: 17th May 2007, 00:41
  4. QFileDialog Mac / PC
    By hey in forum Qt Programming
    Replies: 3
    Last Post: 26th April 2007, 18:23
  5. copy file/s from QFileDialog
    By raphaelf in forum Newbie
    Replies: 4
    Last Post: 4th July 2006, 14:26

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.