Results 1 to 3 of 3

Thread: Get the name of directory from the absloutepath

  1. #1
    Join Date
    Mar 2010
    Posts
    54
    Qt products
    Qt/Embedded
    Platforms
    Symbian S60

    Default Get the name of directory from the absloutepath

    Hi
    I have a very small problem
    I am able to get the absolutepath of the directory using the QFileDialog::getExistingDirectory()
    i.e
    QString str = QFileDialog::getExistingDirectory();
    returns
    str = /root/Desktop/images


    Now , how can I get the "images" from the string str

  2. #2
    Join Date
    Oct 2009
    Posts
    364
    Thanks
    10
    Thanked 37 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Get the name of directory from the absloutepath

    take a look at QString::split and use '/' as the separator

    or you could use QString::section, again use '/' as the separator

    both of these show nice examples on how to use them.

  3. #3
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,540
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Get the name of directory from the absloutepath

    Look at QDir::dirName

Similar Threads

  1. get .pro directory
    By Alnitak in forum Qt Programming
    Replies: 5
    Last Post: 14th October 2010, 18:43
  2. Get directory of QString
    By Astrologer in forum Newbie
    Replies: 1
    Last Post: 23rd April 2010, 12:10
  3. Server directory
    By fitzy in forum Qt Programming
    Replies: 4
    Last Post: 7th October 2009, 11:51
  4. Specify the DLL directory
    By Nyphel in forum Newbie
    Replies: 6
    Last Post: 27th April 2007, 14:29
  5. Size of the directory
    By npc in forum Qt Programming
    Replies: 3
    Last Post: 27th December 2006, 07:05

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.