Find all installed modules QML - qt

I'm creating app which ui is defined in json, from which i instatiate components in qml files from C++. But i would be glad if users can use built-in qml types.
Is there some way to find what qml modules (mainly visible components, but listing of all qml modules is huge plus) are installed in system?
Is there other solution for this problem. I'm thinking like create qml string manually, but what about imports?
Any other tips will be apreciated.

Related

what does "Making Applications Scriptable" mean and when should we use it?

Recently I noticed some classes in Qt which is called Qt script module and according to documentation it's used to make an application scriptable! here is my questions :
What does it mean? making an application Scriptable?
And when should we use it?
Thanks in advance
What scripting is
~~~~~~~~~~~~~~~~~
Most of the super huge s/w come with lots of features. And quiet interestingly many of the new features that are added are the combinations of basic existing features. But one cant keep on adding new C++ code to create a simple feature...they can just write a script interactively which performs the existing operations in a tandem process and does the job of new feature.
Best examples..Blender(Python scripting). If can look in this scenario.. Blender has 1000s of features. Most of them are actually scripted features calling the existing features in an orderly fashion.
QtScript
~~~~~~~~
This module of Qt framework provides a javascript interpreter(Google v8 js engine) at your disposal. You can call your QObject classes and related methods from javascript as it they were native functions of js(Only in you application). QScriptable classes expose the internals of your c++ QObject's properties and methods to javascript engine.
When To USe
~~~~~~~~~~~
When you have a huge application with lots of modules, and you want to retain the programmability of your application even after compiling it into machine code, then you have to use scripting.

Modularity in Flex

I'm working on a pretty big application for Flex/Air. We are using GraniteDS and Tide to interact with the model from our Java EE server.
I've been reading about modularization and Modules in Flex. The application has already been built, and I'm figuring a way out to re-design some classes and parts. From what I've read so far, I understand a Module is a different swf which can be dynamically load. Most of the tutorials/documentation are oriented to Flash "programmers" who are using Flex or Air instead of real developers, so that makes online resources harder to get.
What I can't understand - yet - is how to encapsulate ActionScript classes or MXML views under this module.
I've separated some of the code into libraries. For example, the generated code from Granite is in a "server" library. But I would like to separate parts of the logic with its Moderators, Controllers and Views. Are modules the way to go? Is there a "modules for dummies" or "head first Flex Modules for programmers" like tutorial in order to get a better perspective in order to build my architecture? When to choose libraries and when to choose modules?
I'm using Flex 3.5, and a migration to Flex 4 is way far into the future, so no Flex 4 answers please, thanks!
Modules are the answer for encapsulating UI into different sections that do not depend on each other. Think of them like applications inside of applications.
If you want to encapsulate "code", meaning non-ui actionscript, then you really just want classes and packages of classes. You could also package that code into a swc, which is just a compiled version of that code that you can include in multiple projects (I think this is what you meant by libraries).
You wouldn't want to create a module just to contain non-ui code. You wouldn't want to use modules for separating out the model/view/controller in your application.
If you have part of your application, that for the most part runs completely on its own, with no real dependencies on the rest of the application except for maybe a little bit of information passed in, then it makes sense for modules.
Where we use modules mostly is for an application that has different sections to it where you are only working in one section at a time. There is no need for the other sections to be taking up resources, so we have the different sections in modules and load/unload them as necessary.
Does that help?
Edit in reply to the comment below:
By libraries I meant Flex Library
Projects, where you encapsulate
classses and use the swc. Can you have
these libraries inside a Flex Project?
(I use a separate Library Project for
each new library).
Yes, you can use these swc's (Libraries of code) inside of your flex projects. Just drop the swc in the lib directory in your flex/flash builder project and the code is automatically added to your classpath. Just make sure that everything that the code inside a single swc needs is inside that swc. Don't make a swc rely on another swc to function.

Developing Modular Flex Applications

I'd like to be able to understand how to develop a Flex application such that I could provide implementation classes at runtime. In the Java world I'd specify interfaces in an JAR (e.g. myapp-api.jar), the implementation in a separate JAR (e.g. myapp-impl.jar) and package these along with other resources in the application WAR (e.g. myapp.war). Within the code of the application I would instantiate the implementation classes dynamically.
Is this approach possible in Flex? I'm aware that I can instantiate classes dynamically so that's a good start. I'm a bit confused by modules, RSLs and SWCs though.
I was hoping to create a SWF application that had references to an interfaces SWC and an implementation SWC. The idea is that if I need to tweak the application for a specific customer then I could create a new implementation SWC and not have to modify the SWF or interface SWC.
Any ideas?
This is a bit harder to do in flash/flex than it is in java, or at least it is a bit more obscure if you are coming from a java background). I have a couple of pointers for you.
You only have to use RSLs if you really want to have separate libraries of classes at runtime, and especially if you think this library will be used across several projects that the same set of people will be using. (They are mainly intended to decrease download/startup time)
You can also divide your app in several parts yourself - in that case you need to make sure that you don't pack the same info twice - this can be done by generating a linkreport on the first compiled swf and excluding these classes from the second compile. This is how modules work in flex.
SWCs are mainly used as a compile-time library (they are basically a zip containing a swf and a metadata xml file that describes its contents).
If you want to have a separate set of interfaces in a library you could generate a swc with the interfaces and compile another swc with the implementation, you should exclude the interfaces when compiling the implementation classes if you want to avoid having duplicate class/interface definitions. If you compile your final app when linking both the interface and implementation SWCs without excluding the classes you can just use your single final SWF to run the app - if you want to keep it really separate you should look into modules (or plain loading swfs if you are creating a pure actionscript project).
I did use SWCs myself as described above, and am now looking into RSLs and Modules myself for our curren project.

Flex Module Development Workflow

I have just started looking into using Modules in Flex and would like to know how you all go about developing them. I understand how to use them (load, unload, application domains, shared classes, etc.), but I'm wondering what a good workflow is in creating them and using them in multiple applications.
If I were building reusable application components (text editor, image cropper, compass, whatever), and I wanted to reuse them in many different applications, it seems like I would:
1) Create an Application specifically for one of those modules
2) Create a Module inside that Application
3) Develop the Module by itself, make it work right
4) Link shared libraries to it somehow (like library projects I would use between all of the modules)
5) ... then I'm unclear what's next. I now have lets say 10 Module/Applications, and I want to start mashing them together into usable applications. What's the best way to do this? I would like to not have to copy-paste code and swfs, using something like git submodules if an equivalent is possible.
Thanks so much
I think you're looking for SWC files.

Flex: Modules v/s Components for a large scale project

I am planning on a Flex project that involves incorporation of a lot of features.
Each 'feature' can be a component / module.
Which is preferred and what is the difference between a module and a component?
Thanks
The short answer is that it depends.
If you going to use all, or most, of your components during regular execution of the application - components would be alright.
By the sounds of things though, modules might be the better bet for your project.
Modules allow you to group components into external libraries (RSLs). These libraries can be embedded into your application (through project settings) or can be loaded dynamically at runtime (as separate files).
Modules would give you some benefits
Only loading the libraries needed (as needed) instead of all modules everytime.
Load only core modules initially to speed up the initial load time.
Changes to a component do not require you to recompile the application/
Find out more about creating modules here.

Resources