简体   繁体   English

最佳Qt小部件,用于流程控制

[英]Best Qt Widget to use for flow controls

I want a widget that can have various number of input & output pins, and each instance of this widget acts as a module which can connect to another module via these pins. 我希望一个小部件可以具有多个输入和输出引脚,并且该小部件的每个实例都充当一个模块,可以通过这些引脚连接到另一个模块。 Eventually, this will give me a work flow with many connected blocks. 最终,这将为我提供许多连接的模块的工作流程。 Ideally, the connection can be done via mouse operations such as drag and drop from one pin to another. 理想情况下,可以通过鼠标操作(例如从一个引脚拖放到另一个引脚)来完成连接。 And I also need to add texts or even draw some shapes onto the blocks. 而且我还需要添加文本,甚至在块上绘制一些形状。

I know that I can write this from scratch but what's the best base widget to start with? 我知道我可以从头开始编写,但是最开始的最佳基本小部件是什么?

I would go with QGraphicsItem . 我会选择QGraphicsItem It supports features like drag & drop, collision detection, etc.. Those should be useful for your use-case. 它支持拖放,碰撞检测等功能。这些功能对您的用例很有用。 Make sure to check other classes that inherits this one (look for Inherited By: ). 确保检查继承该类的其他类(查找Inherited By:

Also, make sure to check out this article . 另外,请务必查看本文

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM