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. Resource files can't be opened Windows 7?

Resource files can't be opened Windows 7?

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.8k 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.
  • D Offline
    D Offline
    dlafreniere
    wrote on last edited by
    #1

    I am adding "input.txt" to the Resources in the file a .qrc file. On a Windows XP using the MinGW installation it works correctly. On a Windows 7 Visual Studio 2010 installation no resource files can be opened. The QFile.open call fails by returning false:

    QFile inputFile(":/input.txt");
    bool err = inputFile.open(QIODevice::ReadOnly);
    if (err == false)
        return;
    

    The textfinder.prc file:

    <RCC>
    <qresource prefix="/">
    <file>input.txt</file>
    </qresource>
    </RCC>

    The TextFinder.pro file has this line:

    RESOURCES +=
    textfinder.qrc

    I also tried setting a resource pixmap on a Label. The Label correctly shows the label image in the Qt Designer, but not when the application is run.

    How can I get image and text resource files to work on my Windows 7 Qt Creator environment?

    Thank you for any assistance.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      MuldeR
      wrote on last edited by
      #2

      Your code and your .qrc file look okay to me.

      Did you check whether your .qrc file did properly get compiled into a .cpp file by Qt RCC? And did you check whether the generated .cpp file did properly get compiled into an .obj file by your compiler (either MSVC or MinGW/GCC)? And, finally, did you check whether the .obj file did get linked into your EXE file?

      You could also try:
      @QList<QFileInfo> list = QDir(":/").entryInfoList(QStringList("."), QDir::Files);@

      to enumerate all resources compiled into your app...

      My OpenSource software at: http://muldersoft.com/

      Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

      Go visit the coop: http://youtu.be/Jay...

      1 Reply Last reply
      0

      • Login

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