Results 1 to 8 of 8

Thread: QFileInfo::absolutePath: Constructed with empty filename I can't see my image

  1. #1
    Join Date
    Sep 2014
    Location
    Spain
    Posts
    14
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default QFileInfo::absolutePath: Constructed with empty filename I can't see my image

    Hello,
    I'm use Qt Creator and Qt4.
    i want to put an image like a icon but i can't see it, and at runtime, I have the following error message:

    QFileInfo::absolutePath: Constructed with empty filename.

    The image is in my .pro

    Any idea? thanks
    Last edited by ariad; 29th September 2014 at 11:38.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QFileInfo::absolutePath: Constructed with empty filename I can't see my image

    Having the image in OTHER_FILES of the pro file just makes them appear in QtCreator and other IDEs that understand qmake pro files.

    If you want the image to be available independent of path of the application, put the in a Qt resource.

    Cheers,
    _

  3. #3
    Join Date
    Sep 2014
    Location
    Spain
    Posts
    14
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: QFileInfo::absolutePath: Constructed with empty filename I can't see my image

    I think than you want to tell me than I have put in my resource, and yes I did it.

    Qt Code:
    1. QFile filename("images/foto.ico");
    2. if(filename.exists())
    3. qDebug("file exists");
    4. else
    5. qDebug("file not exists");
    6.  
    7. GeoDataIconStyle icon;
    8. icon.setIconPath("images/foto.ico");
    To copy to clipboard, switch view to plain text mode 

    At runtime:
    file exists
    libpng warning: iCCP: profile 'ICC Profile': 1000000h: invalid rendering intent
    QFileInfo::absolutePath: Constructed with empty filename

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QFileInfo::absolutePath: Constructed with empty filename I can't see my image

    Quote Originally Posted by ariad View Post
    I think than you want to tell me than I have put in my resource, and yes I did it.
    Ah, good.
    Any reason you are not accessing the file in the resource but the file on disk instead?

    Cheers,
    _

  5. #5
    Join Date
    Sep 2014
    Location
    Spain
    Posts
    14
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: QFileInfo::absolutePath: Constructed with empty filename I can't see my image

    Yes, the image is on the disk in the folder of my project, I have a folder with the images and I have put a QDebug to check that the file exists and if you see my resource and answer at runtime the application finds the image but also tell me that QFileInfo::absolutePath: Constructed with empty filename...

    I don't know what I can do...

    thanks

  6. #6
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QFileInfo::absolutePath: Constructed with empty filename I can't see my image

    You obviously do not access the file from a resource, but yes, at least it does seem to exist on disk.

    All code that you have posted looks ok. But the warning could come from GeoDataIconStyle::setIconPath() or elsewhere.

    Cheers,
    _

  7. #7
    Join Date
    Sep 2014
    Location
    Spain
    Posts
    14
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: QFileInfo::absolutePath: Constructed with empty filename I can't see my image

    If I run in Qt creator the answer of QDebug is "file no exists" but if I run on the terminal "file exists"

    Maybe that tells you something...

    Thanks

  8. #8
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QFileInfo::absolutePath: Constructed with empty filename I can't see my image

    Most likely a different working directory of the process.

    Which is why a resource would be handy, since that puts the icon data into the executable.

    Cheers,
    _

Similar Threads

  1. Replies: 2
    Last Post: 2nd January 2011, 12:13
  2. QFileInfo
    By ishkabible in forum Qt Programming
    Replies: 3
    Last Post: 20th September 2010, 00:08
  3. Replies: 2
    Last Post: 23rd July 2010, 03:41
  4. Is there such a way QFileInfo
    By baray98 in forum Qt Programming
    Replies: 9
    Last Post: 21st April 2008, 03:23
  5. remove directory empty or not empty
    By raphaelf in forum Newbie
    Replies: 12
    Last Post: 27th October 2006, 07:30

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.