Important: Please read the Qt Code of Conduct -

Styling Loading Via XML

  • Hi All,

    I have list of styling files in XML format . In my current application , I'm loading all of the available XML files onto models. Then , whenever required just calling the model. Is it a better practice to do?
    or should I load xml files onto models only when it is required ?
    which one will be the most efficient way considering the performance.
    By the way ,The application is real time ,and needs to update display elements / styling as quickly as possible


  • Qt Champions 2017

    Either way it works. No issues. However if you need real time performance and not worried about memory you should load everything, parse and keep it ready.
    If memory is also constraint, you should load whenever required. For this you need to load, parse and make the things ready. You may hit slight performance issue. If performance is ok you can do like this.

    It is trade-off with memory and responsiveness.

  • @dheerendra

    Thank you so much for replying, Dheerendra Sir.
    I have one more question.

    When should I use Visibility , and when should I use Loaders. AS I know , Visibility is used to manipulate one or few Items. Where as loaders are used for large number of items to manipulate. However , this takes time to load . Bit worried about the performance here.
    If objects are created in prior (by setting visibility to false), will it have impact on performance?
    If I create objects dynamically , will the performance reduce? Which method will suit the most.

    Thank you

  • Qt Champions 2017

    How many objects you need to work with ? Do you have too many ?

  • @dheerendra
    Hi Sir , I will be having around 6-7 objects to work with at a time

  • Qt Champions 2017

    Just check by keeping all the objects in memory. If it causes any memory issue, then you have load the qml dynamically.

  • I would suggest you to go for Json instead of XML, as it is simpler and less resource & memory intensive compared to XML.

Log in to reply