Results 1 to 2 of 2

Thread: Getting filename by QFileDialog

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    India
    Posts
    115
    Thanks
    3
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Getting filename by QFileDialog

    Are not you better off using QFileDialog::getOpenFileName()?
    Qt Code:
    1. filename = QFileDialog::getOpenFileName(this);
    To copy to clipboard, switch view to plain text mode 
    EDIT: Sorry, did not read your entire post. You can go about this like:
    Mainwindow.cpp
    Void Mainwindow::XXXX
    {
    QFileDialog filedia;
    filedia.

    filedia.resize(200,320);
    filedia.exec();

    filename=filedia.XXXXXXXXXXXXXXXXXXXXXXXXXXXX

    filedia.close();
    if(filename.count() == 0 || filename.at(0).isEmpty())//Not sure if second condition is necessary, you can check it yourself, i'm currently away from my PC
    {
    QMessageBox msg;
    msg.setText("no input file specified");
    msg.exec();
    return;
    }
    le->setText(filename.at(0));

    }
    Last edited by yogeshm02; 21st January 2010 at 09:44.

Similar Threads

  1. how to get filename
    By jayreddy in forum Qt Programming
    Replies: 1
    Last Post: 24th November 2009, 08:59
  2. get filename from a QFileDialog
    By graciano in forum Qt Programming
    Replies: 2
    Last Post: 17th November 2009, 14:57
  3. QFileDialog for choosing filename to save data
    By araglin in forum Qt Programming
    Replies: 2
    Last Post: 1st April 2009, 08:46
  4. QFileDialog filename list order
    By joelthelion in forum Qt Programming
    Replies: 1
    Last Post: 28th January 2009, 14:58
  5. QFileDialog::getSaveFileName issues with filename
    By dugs in forum Qt Programming
    Replies: 2
    Last Post: 11th December 2006, 17:17

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
  •  
Qt is a trademark of The Qt Company.