Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. qt.conf platform plugin path
Forum Updated to NodeBB v4.3 + New Features

qt.conf platform plugin path

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
5 Posts 4 Posters 6.9k Views 2 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.
  • C Offline
    C Offline
    cian_1706
    wrote on last edited by
    #1

    Hi,

    I'm deploying a Qt desktop application on Windows and on Linux platforms, linking it to Qt shared libraries (ver. 5.9).

    I used qt.conf file to specify custom platform plugin path, and everything works fine.

    Nevertheless, I've the need to specify different paths for platform plugins on Windows and on Linux.

    Is it possible to edit the qt.conf file with "unix" and "win32" scopes (or similar), avoiding separate platform-dependent qt.conf files?

    I cannot find documentation about that (I see a [Platforms] group here, but it appears not suitable to my purpose).

    Thanks in advance for your help.

    Andrea

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

      Hi and welcome to devnet,

      AFAIK, no.

      Out of curiosity, where do you put these plugins ?

      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
      • C Offline
        C Offline
        cian_1706
        wrote on last edited by
        #3

        Hi,

        thank you for your reply and sorry for the delay of my answer.

        On Windows I actually use the platform plugin at the default path ("platforms" subdirectory in the executable file directory), while on Linux I don't want this default behavior, since the executable file resides in /usr/bin directory (I don't want to get the /usr/bin path "dirty" with application dependent stuff), so I managed to have the platform plugin under /usr/local/lib/<myApp>/platforms.

        In order to get the "platform dependent behavior" of qt.conf file, I added a snippet in .pro file, using platform scopes, that creates the proper qt.conf file.

        Andrea

        1 Reply Last reply
        0
        • Pablo J. RoginaP Offline
          Pablo J. RoginaP Offline
          Pablo J. Rogina
          wrote on last edited by
          #4

          @cian_1706 Although I never used qt.conf before, from the link in your post (Using qt.conf) it looks like the per-platform settings is already supported, so I imagine something as follows in just one qt.conf:

          [Platforms]
          WindowsArguments = Plugins=C:/path/to/plugins/under/Windows
          LinuxArguments = Plugins=/path/to/plugins/under/Linux
          

          If you already tested that and it doesn't work, I think that creating different qt.conf per platform from the .pro itself is a good way to go (you need to edit just one place in case of changes)

          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

          1 Reply Last reply
          0
          • hskoglundH Offline
            hskoglundH Offline
            hskoglund
            wrote on last edited by
            #5

            Hi, one other alternative is to skip using qt.conf files.

            Instead you can specify the path to the plugins using c++ code. For it to work you need to do it before the constructor of QApplication starts (that's when the plugins are loaded), so best place is in your main.cpp, say like this:

            int main(int argc, char *argv[])
            {
            #ifdef Q_OS_LINUX
                QCoreApplication::addLibraryPath("/usr/local/lib/<yourApp>");
            #endif
                QApplication a(argc, argv);
                MainWindow w;
                ...
            
            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