2

I'm going to deploy a QML based application. Now I'm wondering it's better to use resources system for .qml files and their associated files or using relative addressing or there is a better way?
The first way maybe make the project difficult to manage if the number of qml files and your images become larger and larger. Also I think it would be harder to deploy third party plugins like Qt desktop components.
And the second way is not secure as it should be. Every one can open a text editor and edit your .qml files.
Is there a better way?

s4eed
  • 7,173
  • 9
  • 67
  • 104

1 Answers1

1

Using Resource system :

  1. Binds all the dependencies into one single binary, thus no problem of placing them at exact locations as per the paths given in your code.

  2. Many times you would not want to share your qml code/images etc. [close source projects], helpful in those cases. Also it is more secured as no one can modify your files and cripple your application possibly.

  3. You will not be able to modify these dependent files at run time, which might be required in some cases.

The first way maybe make the project difficult to manage if the number of qml files and your images become larger and larger.

Contrary to what you say, I think its easier to manage them, how so many files there might be. You can see here how easy it is to do using Qt Creator.

Relative addressing:

  1. All the dependencies are scattered at different locations, thus problem of placing them at exact locations as per the paths given in your code.

  2. Since your files are directly available to anyone who would want to access them, unsecure.

  3. If there is a modification required in one the files at run time, you can do it. Eg. having a log file and writing/reading some data into/from it.

  4. Difficult to manage(compared to first approach) when number of files increase as exact paths have to be given.

One personal advantage I have found of second approach is in situations like this :

I need to send my Qt apps for Demos to clients with managers, offshore. These demos go on full day. If some minor UI feature ( eg size of a button seems very small ) is getting too much negative attention, we can direct the manager over call to the respective qml file, and make him do small changes ( eg. scale : 1.5 ) This is helpful as we wont have time to build the whole system, resend the exes to them etc.

Is there a better way? Not that I have seen any. I thinks its a matter of finding which one of the above suits your requirements more.

Amit Tomar
  • 4,800
  • 6
  • 50
  • 83