Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qfile and Qresource problem
Forum Updated to NodeBB v4.3 + New Features

Qfile and Qresource problem

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 719 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bask185
    wrote on last edited by
    #1

    I am working with a few dictionaries and as I am cross-compiling it would be usefull if I would use the resource folder instead.

    I was already using the Resource folder for a .jpg file but it is not working when I want to open my textfile.

    QPixmap logo(":/resources/img/logo.jpg"); // works
    
    QFile file(":/resources/img/Dictionary2.csv.txt"); // does not work
    
    user@user:~/Dropbox/GUI/GUI_Qt/img$ ls
    Dictionary2.csv.txt  logo.jpg  toolbox1.png  toolbox2.png // the file is present in the folder
    

    What am I not knowing? ...besides alot :P

    VRoninV 1 Reply Last reply
    0
    • B bask185

      I am working with a few dictionaries and as I am cross-compiling it would be usefull if I would use the resource folder instead.

      I was already using the Resource folder for a .jpg file but it is not working when I want to open my textfile.

      QPixmap logo(":/resources/img/logo.jpg"); // works
      
      QFile file(":/resources/img/Dictionary2.csv.txt"); // does not work
      
      user@user:~/Dropbox/GUI/GUI_Qt/img$ ls
      Dictionary2.csv.txt  logo.jpg  toolbox1.png  toolbox2.png // the file is present in the folder
      

      What am I not knowing? ...besides alot :P

      VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by VRonin
      #2
      • Did you add Dictionary2.csv.txt to the qrc file?
      • Can you try QFile file(QFileInfo(":/resources/img/Dictionary2.csv.txt").absoluteFilePath());?

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      B 1 Reply Last reply
      3
      • VRoninV VRonin
        • Did you add Dictionary2.csv.txt to the qrc file?
        • Can you try QFile file(QFileInfo(":/resources/img/Dictionary2.csv.txt").absoluteFilePath());?
        B Offline
        B Offline
        bask185
        wrote on last edited by
        #3

        @VRonin said in Qfile and Qresource problem:

        • Did you add Dictionary2.csv.txt to the qrc file?

        Nope, did so now, thank you.

        1 Reply Last reply
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved