PDA

View Full Version : Need help to make GUI application using Qt Plugin Arhitecture



tripji
1st October 2012, 08:35
Hi All,

I am very new to Qt, have worked in Eclipse plugin domain.
I've to design a GUI using Qt. I am planning to make use of Qt plugins as much as possible. I've following two main queries:

1- For non-ui plugins (like user profiles, pre-define date etc.) is it possible that I create one util plugin and other non-ui plugins a dependent on this plugin, So the once util plugin is loaded other plugins gets loaded and also MainWindow class should have the reference to the util plugin which will be used to access the functionalities of other non-ui plugins. (Find attached the diagram8268)
The other way is since MainWindow class already loading all plugins so we can use the reference of non-ui plugins in the main class, So in this case Util plugin is not required.

Please suggest which would be the best approach?

2- For using ui plugins is it good to have all plugin references in the MainWindow or the corresponding dock window (where plugins functionality shows) should take care of it?

Please let me know if you have any better approach for building GUI using Qt plugins.

wysota
2nd October 2012, 01:45
To be honest I don't see much of a difference between your two approaches. A single plugin can implement many interfaces if you need it. Making a plugin depend on another plugin is a bit tricky since at some point you need them to have some common interface so either you link one plugin against the other one (making it "statically dependent" on the other plugin) or you link both against some other library implementing the common interface (making both plugins depend on the library). For instance QtCreator follows the first pattern I described (actually it follows both of them at once for different aspects of plugin functionality).

tripji
5th October 2012, 07:01
Thanks a lot Mr. Wysota for your reply. This will really help me a lot.

I've one more question regarding GUI design.

My system is as follows:

GUI <--> Middle Layer <--> Backend

The Middle and Backend layer is provided by some third party vendor and I've to design the GUI.
The middle and GUI uses Qt. The middle layer provides all commonly use frameworks (like error logging, settings, request/notification, plugin interface etc.) which can be used direclty by the GUI.

Now I've following two options:

Option 1- The GUI interacts with middle layer and uses all its framework classes directly like shown in the figure below:

8284

Pros- less signal/slots and overhead
Cons- Tight coupling between GUI and Middle layer
option 2- The GUI interacts with middle layer using one extra GUI component called GUIDispatcher which is linked to Middle layer framework classes using signal/slot or callbacks as shown in the figure below:

8285

Pros- Loose coupling between GUI and Middle layer
Cons- overhead without major functionality addition

Also since middle layer provides all major frameworks on which GUI is highly dependent (like all plugin should derive from plugin interface available as middle layer) so is it possible to achieve all GUI functionality from option 2.

Any help would be highly appreciable.

Thanks in advance.

wysota
5th October 2012, 07:36
I don't see much space for "plugins" here. It looks to me like a regular static dependency (and hence you should simply link the GUI to the middle layer and the middle layer to the backend). Your GUIDispatcher pattern doesn't change any of this.