Results 1 to 3 of 3

Thread: Getting filename (w/o folder) when using getOpenFileName

  1. #1
    Join Date
    Apr 2009
    Posts
    132
    Thanks
    67
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Getting filename (w/o folder) when using getOpenFileName

    Hi!

    If I use QString filename=QFileDialog::getOpenFileName(bla bla bla )

    I get something like "C:\folder\filename.ext".

    Is there any way to get only the file it was selected? I mean, this: "filename.ext"

    Thanks.

  2. #2
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Getting filename (w/o folder) when using getOpenFileName

    Qt Code:
    1. QString filename=QFileDialog::getOpenFileName(bla bla bla );
    2. filename=filename.section('/',-1);
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Getting filename (w/o folder) when using getOpenFileName


Similar Threads

  1. Replies: 1
    Last Post: 7th June 2009, 09:22
  2. Finding filename from QNetworkReply
    By Valheru in forum Qt Programming
    Replies: 3
    Last Post: 24th April 2009, 09:29
  3. Replies: 3
    Last Post: 11th September 2008, 20:08
  4. Path to the previous folder
    By Zergi in forum Newbie
    Replies: 2
    Last Post: 15th July 2008, 18:24
  5. Replies: 2
    Last Post: 27th October 2007, 18:16

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.