Results 1 to 2 of 2

Thread: Getting filename by QFileDialog

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2009
    Posts
    39
    Thanks
    3
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Arrow Getting filename by QFileDialog

    Hi to all......
    I want to get filename using QFileDialog, Filename should be in String( not StringList). I'm posting a code here. i need to get file in LineEdit.

    Mainwindow.cpp
    Void Mainwindow::XXXX
    {
    QFileDialog filedia;

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

    filename=filedia.XXXXXXXXXXXXXXXXXXXXXXXXXXXX

    filedia.close();
    if(filename=="")
    {
    QMessageBox msg;
    msg.setText("no input file specified");
    msg.exec();
    return;
    }
    le->setText(filename);

    }
    I'm getting Filedialog of size 240x320.But if i select any file the Path is not get set in LineEdit, Further this LineEdit string will be accesed for transfer from serial port. PLz suggest me what must be the option to be in XXXXXXXXXXXXXXXXXXXX or someother fuction should be called for this..

    earlier i used
    filename = filedia.getOpenFileName(this,tr("Open Image"), "D:/", tr("FILES(*.txt *.bmp *.wmv *.doc *.pdf *.jpg *.xls *.exe)"));

    this was taking the file source path in line edit. But The problem was size of FileDialog it was too big, but i want to port in 240x320 Board. So plz suggest to get file name..
    Thanking You.
    Last edited by Rajeshsan; 21st January 2010 at 09:28.

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.