开发者

Qt : C++ dynamic parameter GUI for plugin parameters

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?


I needed to do something similar a year or so ago; didn't find anything then to make it easier and quicker (link). Can't share it I'm afraid. Role your own.

Obvious, but I reverse-engineered XML generated by the Designer app and made some interfaces to re-generate common blocks of XML. Keep in mind that the XML might change in later Qt releases and I had unit tests to validate my own XML was valid.


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


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/


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.


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


You might want to look into QML.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜