Results 1 to 15 of 15

Thread: Problem to find file path

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Bremen, Germany
    Posts
    554
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanked 86 Times in 81 Posts

    Default Re: Problem to find file path


  2. #2
    Join Date
    Oct 2007
    Posts
    201
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    19
    Thanked 1 Time in 1 Post

    Default Re: Problem to find file path

    Quote Originally Posted by ChristianEhrlicher View Post
    This one giving the path where dll file is getting created. But i wanna the file path. Lets assume it is("D:\PRGM\Colors\Resources"). How to get this.?
    Cheers,
    Phillip



    --- Please post the solution you got to solve your problem. It may help others.

  3. #3
    Join Date
    Jan 2006
    Location
    Bremen, Germany
    Posts
    554
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanked 86 Times in 81 Posts

    Default Re: Problem to find file path

    applicationDirPath() returns the path where the executable currently is.

  4. #4
    Join Date
    Oct 2007
    Posts
    201
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    19
    Thanked 1 Time in 1 Post

    Default Re: Problem to find file path

    Quote Originally Posted by ChristianEhrlicher View Post
    applicationDirPath() returns the path where the executable currently is.
    Ya ChristianEhrlicher, You are absolutly right. Im also geeting this. But as i posted i need the path like("D\PRGM\Colors\Resources"). My solution is getting created in ("D\Target\bin\debug\here is my exe") as i m making solution by using cmake file.
    Cheers,
    Phillip



    --- Please post the solution you got to solve your problem. It may help others.

  5. #5
    Join Date
    Jan 2006
    Location
    Bremen, Germany
    Posts
    554
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanked 86 Times in 81 Posts

    Default Re: Problem to find file path

    As I said earlier - you need to start from a well known point. The only path you know exactly is the one from your executable. It doesn't matter what buildsystem you use. The only important thing is where your paths are once the app is installed on the target computer(s).

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

    Default Re: Problem to find file path

    I would suggest make the path of resources relative to the application path.
    and use it in .pro file to include directories.

    Or use some file to store the path and read from there.

    Both solutions will help u to load resources and easily modify the path even if u install the application on some other computer

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Problem to find file path

    Be aware that the path where you build the application is not its final resting place. After building your should install the application to a defined path along all the resources. Especially that installing the application might require super user privileges.

  8. #8
    Join Date
    Oct 2007
    Posts
    201
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    19
    Thanked 1 Time in 1 Post

    Default Re: Problem to find file path

    Than you all. I solved it. the code worked for me is

    Myfunction(QString qssfilename)
    {
    QFile file(":/"+qssfilename+".qss");
    }
    Last edited by phillip_Qt; 28th April 2008 at 11:12. Reason: correct code
    Cheers,
    Phillip



    --- Please post the solution you got to solve your problem. It may help others.

Similar Threads

  1. QT string Find problem
    By kingslee in forum Qt Programming
    Replies: 2
    Last Post: 16th October 2006, 21:45
  2. problem with linking
    By mickey in forum Qt Programming
    Replies: 49
    Last Post: 12th August 2006, 22:41
  3. Replies: 7
    Last Post: 1st August 2006, 22:15
  4. Problem with reading a file
    By Buhmann in forum Qt Programming
    Replies: 11
    Last Post: 17th February 2006, 14:02
  5. QProcess problem with windows batch file
    By bood in forum Qt Programming
    Replies: 11
    Last Post: 6th January 2006, 09:08

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.