Results 1 to 4 of 4

Thread: How to embed qt plugins into the executable file?

  1. #1
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    652
    Thanks
    40
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default How to embed qt plugins into the executable file?

    Good morning Qt community,
    I have to modify a project where the application loads a lot of custom Qt plugins at run-time causing a significant slowdown during loading.
    I would like to know if it is possible to avoid this behavior (and consequently also the slowdown) and embed the plugins into the executable at the compile time.
    Thanks in advance,
    Franco
    Franco Amato

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,063
    Thanks
    286
    Thanked 831 Times in 818 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: How to embed qt plugins into the executable file?

    I would like to know if it is possible to avoid this behavior (and consequently also the slowdown) and embed the plugins into the executable at the compile time.
    Then they aren't really plugins, are they? Plugins are basically DLLs, and DLLs get loaded at run time. If you want to link them at compile time, then you use static libraries.

    If your slowdown is because you are loading all of the plugins at once during startup, then maybe you can implement a strategy where the plugin is not fully loaded until it is actually needed (on-demand loading). For example, instead of a single plugin interface, implement two, one that does minimal initialization - just enough to load an icon or some other placeholder to show it is available, and another that loads the full plugin when its functionality is actually needed.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    652
    Thanks
    40
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to embed qt plugins into the executable file?

    Hi,
    thanx for the answer.
    Yes are plugins, ui files implementing custom widgets. Is there a way to make them embedded into the binary instead of loading them dinamically?
    Regards
    Franco Amato

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,063
    Thanks
    286
    Thanked 831 Times in 818 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: How to embed qt plugins into the executable file?

    ui files implementing custom widgets
    I don't think you can make a "plugin" from a UI file by itself, especially if it implements a custom widget. You have to compile the UI code using UIC and MOC and build the cpp and h files that come out into your project.

    Maybe I don't understand what you are trying to do. It would help to show some of the code you are using now for loading these "plugins" dynamically.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Replies: 1
    Last Post: 24th January 2014, 21:10
  2. associating file with executable
    By avanindra in forum Qt Programming
    Replies: 1
    Last Post: 1st September 2012, 08:27
  3. run a executable file
    By Ali Reza in forum Newbie
    Replies: 4
    Last Post: 17th June 2012, 21:09
  4. Replies: 5
    Last Post: 31st August 2011, 00:21
  5. Replies: 5
    Last Post: 15th June 2010, 08:42

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.