Results 1 to 3 of 3

Thread: Files in the project folder won't open...

  1. #1
    Join Date
    Jan 2012
    Posts
    15
    Qt products
    Qt3
    Platforms
    Windows

    Default Files in the project folder won't open...

    If I use a Qlabel to insert an image in my frame, or a txt, it can't be in the project folder or they won't show up once i press ctrl r....

    It's weird... I have to use images from other folders... but that's not good since I don't want to have to create the folders on every computer I take my program to...

  2. #2
    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: Files in the project folder won't open...

    Read about resources

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Files in the project folder won't open...

    The current working directory of the running application (QDir::currentPath()) is not necessarily, or even usually, the same as the source code directory or the directory containing the executable (QCoreApplication::applicationDirPath ()). If you open files using relative paths then they will break if the directory is not what you expect. Use resources if the data is fixed, or a smarter way to find the file and error checking otherwise.

Similar Threads

  1. Replies: 3
    Last Post: 26th September 2011, 14:14
  2. Open file/folder in finder with selection
    By anjul.chauhan in forum Qt Programming
    Replies: 0
    Last Post: 20th June 2011, 07:10
  3. Multiplateform open folder in explorer
    By bunjee in forum Qt Programming
    Replies: 3
    Last Post: 10th January 2011, 08:27
  4. Replies: 0
    Last Post: 13th October 2010, 04:27
  5. Have Creator open source files with project
    By Asperamanca in forum Qt Tools
    Replies: 2
    Last Post: 23rd October 2009, 08:25

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.