Qt : C++ dynamic parameter GUI for plugin paramete

2019-04-12 11:04发布

My Qt based application is extensible via plugins ( http://doc.qt.io/archives/4.6/plugins-howto.html#the-lower-level-api-extending-qt-applications) .

These plugins can have its own parameters.(int,double,String, enumerations..etc)

What I want to do is, define this parameters in an XML and generate the GUI dynamically by parsing the XML file.

I found somewhat similar architecture here - http://www.slicer.org/slicerWiki/index.php/Slicer3:Execution_Model_Documentation#Slicer3_GUI_Generation

Is there any library/framework that I can use with Qt for this.Or do I have to manually write my own code from parsing XML,mapping parameters into Maps , generate GUI checking the XML element...etc

Any tips?

7条回答
Root(大扎)
2楼-- · 2019-04-12 11:07

You can programmatically create *.ui files, see the XML schema. Then you can render them on the fly with QtUiTools.

查看更多
Melony?
3楼-- · 2019-04-12 11:18

You might want to look into QML.

查看更多
戒情不戒烟
4楼-- · 2019-04-12 11:19

If you are using Qt and their plugin system, you should be able to define a function that returns a UI element from the plugin. You could then just show that element, and have the element itself handle configuring the plugin however it needs to be done. It seems simpler than going through an XML interface to specify everything.

查看更多
姐就是有狂的资本
5楼-- · 2019-04-12 11:24

Also, you can use QScript, to control UI and what you want.

查看更多
Anthone
6楼-- · 2019-04-12 11:25

Please note that Slicer4 is based on Qt. I don't know if the GUI-generation part is ported already. Link to the alpha announcement and further information:

http://slicer-users.65878.n3.nabble.com/Slicer-4-0-alpha-td1448047.html

查看更多
SAY GOODBYE
7楼-- · 2019-04-12 11:28

Tulip has such a mechanism, it is based on C++/Qt : http://tulip.labri.fr/TulipDrupal/ I think that the dev team defined it's own type to replace QVariant, in which they pass the plugin arguments. They can support various primary types, default arguments, various types of plugins, ...

Source code is available at : http://sourceforge.net/projects/auber/files/

查看更多
登录 后发表回答