Important: Please read the Qt Code of Conduct -

Qt UIloader with multiple loading of same ui file

  • In an Qt Application the same ui file has to be loaded multiple times. This is done using the Uiloader, i.e opening the file and getting a pointer to the loaded widget with loader.load. This works fine. However when one has to load the same file 30 to 40 times (and one has to change colors and other things afterwards at run time, so that the pointer has to be kept), the loading gets long (3-5 seconds on a dual core machine). Is there a better way to realize multiple loading of the same ui file ?


  • You could load the ui file into a QBuffer and load it from that. This would avoid the need to reload the ui file from the disk. That said, I suspect the slow part is really loading/searching for plugins etc.

  • I could actually do that, but I guess that the heavy work is done when constructing a QWidget from the ui file. It should be possible to have the Qwidget constructed and that it could be cloned afterwards.

  • Moderators

    QWidgets are inherently non-copyable.

  • Yes, I know that. Therefore there is probably no solution to my problem

Log in to reply