Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-69753

Feature request: provide API to change base path used by QLibraryInfo::location

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Duplicate
    • Not Evaluated
    • None
    • 5.6.1, 5.11.1
    • Core: Other
    • None
    • Linux/X11, macOS, Windows

    Description

      In Qt, QLibraryInfo is used for getting paths for different kind of resources. It works perfectly unless you have QCoreApplication::applicationDirPath()/QDir::currentPath() points to the incorrect location.

      This might easily happen if your app is a plugin linked against shared Qt. Which is exactly our situation as we want to use WebEngine. In this case QCoreApplication::applicationDirPath() would return path to the host application rather than to the our plugin directory. Plugin location don't have to match host folder. You are not able to override path by using argv, because on some platforms this is ignored (for example, on Linux, where pid is used for this purpose).

      The problem is that in this case qt.conf becomes useless and we cannot specify path to the resources stored in our plugin directory.

      The simplest solution is using some environment variable to override this path. But you probably will come up with more sophisticated solution.

      I've attached patch which fixes this problem. Note that I'm in Qt 5.6.1 and cannot use some methods from newer versions like qEnvironmentVariable().

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              buddenha Oswald Buddenhagen
              vitaly_fanaskov Anonymous (Inactive)
              Votes:
              2 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes