Congratulations to our 2022 Qt Champions!

[Solved]How to diffetentiate relative and absolute path

  • Hi,

    I have a function with QString as parameter. I am expecting file path in that QString.
    my question is , can i detect whether that path is relative or absolute?
    eg. relative path "someFolder/subFolder/abc.jpg"
    absolute path "C:/Desktop/someFolder/subFolder/abc.jpg".
    Is there something like isRelative() or isAbsolute()?

  • oh .. I just found it . Yes there are functions isAbsolute() and isRelative() in QfileInfo class.

Log in to reply