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. How does QFile read the QRC path?

How does QFile read the QRC path?

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 1.5k Views 1 Watching
  • 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.
  • M Offline
    M Offline
    mirro
    wrote on last edited by
    #1

    error:QIODevice::read(QFile,"qrc:/qss/MetroUI.qss"):device not open

    QFile qss("qrc:/qss/MetroUI.qss");
    qss.open(QFile::ReadOnly);
    
    Pablo J. RoginaP RatzzR 2 Replies Last reply
    0
    • M mirro

      error:QIODevice::read(QFile,"qrc:/qss/MetroUI.qss"):device not open

      QFile qss("qrc:/qss/MetroUI.qss");
      qss.open(QFile::ReadOnly);
      
      RatzzR Offline
      RatzzR Offline
      Ratzz
      wrote on last edited by Ratzz
      #3

      @mirro

      You can use resource path instead or URL .

      There is an option if in Qt Creator to copy path.

      alt text

      --Alles ist gut.

      1 Reply Last reply
      3
      • M mirro

        error:QIODevice::read(QFile,"qrc:/qss/MetroUI.qss"):device not open

        QFile qss("qrc:/qss/MetroUI.qss");
        qss.open(QFile::ReadOnly);
        
        Pablo J. RoginaP Offline
        Pablo J. RoginaP Offline
        Pablo J. Rogina
        wrote on last edited by
        #2

        @mirro said in How does QFile read the QRC path?:

        QFile qss("qrc:/qss/MetroUI.qss");

        If you use the qrc: protocol I guess you should use it as qrc:/// see documentation:

        Note: When referring to files stored with the Qt Resource System from within QML, you should use "qrc:///" instead of ":/" as QML requires URL paths.

        Since you're not using it from QML, it looks like it's enough just to use :/ instead.

        Upvote the answer(s) that helped you solve the issue
        Use "Topic Tools" button to mark your post as Solved
        Add screenshots via postimage.org
        Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

        M 1 Reply Last reply
        4
        • M mirro

          error:QIODevice::read(QFile,"qrc:/qss/MetroUI.qss"):device not open

          QFile qss("qrc:/qss/MetroUI.qss");
          qss.open(QFile::ReadOnly);
          
          RatzzR Offline
          RatzzR Offline
          Ratzz
          wrote on last edited by Ratzz
          #3

          @mirro

          You can use resource path instead or URL .

          There is an option if in Qt Creator to copy path.

          alt text

          --Alles ist gut.

          1 Reply Last reply
          3
          • Pablo J. RoginaP Pablo J. Rogina

            @mirro said in How does QFile read the QRC path?:

            QFile qss("qrc:/qss/MetroUI.qss");

            If you use the qrc: protocol I guess you should use it as qrc:/// see documentation:

            Note: When referring to files stored with the Qt Resource System from within QML, you should use "qrc:///" instead of ":/" as QML requires URL paths.

            Since you're not using it from QML, it looks like it's enough just to use :/ instead.

            M Offline
            M Offline
            mirro
            wrote on last edited by
            #4
            This post is deleted!
            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