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. QResource::registerResource and "mapRoot"
Forum Updated to NodeBB v4.3 + New Features

QResource::registerResource and "mapRoot"

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 2.2k Views 3 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.
  • T Offline
    T Offline
    TheTux
    wrote on last edited by
    #1

    Hey

    I'm experiencing a weird behaviour with QResource::registerResource, using the second argument "mapRoot".

    "QResource::registerResource(const QString & rccFileName, const QString & mapRoot = QString()) "

    Not sure if it is the expected way it should work, but when I'm trying to mount a dynamic resource file at the location specified by mapRoot, registerResource is registering my data at ":/" as well.

    This is a problem for me because I have others resources registered at ":/" and I don't want them to collide with the newly registered resources I'm trying to load. The documentation is not crystal clear about this behaviour.

    Here is a test code:

    qDebug() << QResource::registerResource("test.rcc", "/foo/bar");
    qDebug() << ":/img/Dealer :" << QFile::exists(":/img/Dealer");
    qDebug() << ":/foo/bar/img/Dealer :" << QFile::exists(":/foo/bar/img/Dealer");
    

    The output is:

    true
    :/img/Dealer : true
    :/foo/bar/img/Dealer : true

    So my question is, is it the expected behaviour or something is buggy there ?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Are you by any chance also building that rcc file in your application ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • T Offline
        T Offline
        TheTux
        wrote on last edited by
        #3

        Hi and Thank you,

        No i'm building it apart with rcc -o, it's not a part of my building chain at all.

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          But maybe you have it added to your .pro file under RESOURCES?

          (Z(:^

          1 Reply Last reply
          0
          • T Offline
            T Offline
            TheTux
            wrote on last edited by
            #5

            My main project where I spot the issue is managed with cmake, and I don't ask for any build-in resources.
            My test project (code above), is built with qmake, the .pro is pretty straightforward :

            QT += core

            QT -= gui

            TARGET = TestRegister
            CONFIG += console
            CONFIG -= app_bundle

            TEMPLATE = app

            SOURCES += main.cpp

            1 Reply Last reply
            0
            • sierdzioS Offline
              sierdzioS Offline
              sierdzio
              Moderators
              wrote on last edited by
              #6

              OK, that pretty much rules out the possibility that Qt automatically picked up your resource.

              (Z(:^

              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