Results 1 to 2 of 2

Thread: QFiledialog directory of selected file

  1. #1
    Join Date
    Jan 2011
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default QFiledialog directory of selected file

    hey all
    i did a qfiledialog and here is it's code
    Qt Code:
    1. QFileDialog dialog(this);
    2. dialog.setFileMode(QFileDialog::AnyFile);
    3. dialog.setNameFilter(tr("IMG3 File (*.img3)"));
    4. dialog.setViewMode(QFileDialog::Detail);
    5. QStringList fileNames;
    6. if (dialog.exec())
    7. fileNames = dialog.selectedFiles();
    To copy to clipboard, switch view to plain text mode 
    I want to get the directory of the selected file with filename and extension "C:/1.img3" and write this dir in lineedit
    I tried qfileinfo but no success
    Thanks in advance
    Last edited by high_flyer; 27th January 2011 at 20:04. Reason: code tags

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QFiledialog directory of selected file

    I tried qfileinfo but no success
    Post the code you tried.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. QFileDialog selecting file or directory
    By ^NyAw^ in forum Qt Programming
    Replies: 5
    Last Post: 13th November 2021, 23:03
  2. QFileDialog 'Save As' to non-existent directory
    By mclark in forum Qt Programming
    Replies: 2
    Last Post: 9th September 2010, 22:32
  3. Replies: 0
    Last Post: 7th May 2010, 11:26
  4. Replies: 1
    Last Post: 14th October 2007, 23:10
  5. Replies: 4
    Last Post: 13th June 2007, 15:37

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.