在Qt / C ++中创建一个可编辑的流程图 [英] Making an editable flowchart in Qt/C++

查看:3084
本文介绍了在Qt / C ++中创建一个可编辑的流程图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个可编辑的流程图,我有很多问题在概念上与Qt。我尝试了许多不同的方式实现类从 QTreeWidget QTableWidget ,并使用一堆简单 QPushButtons

I'm working on making a editable flowchart and I'm having a lot of issues conceptually with Qt. I've tried many different ways of implementing classes ranging from QTreeWidget, QTableWidget, and using just a bunch of easy QPushButtons.

理想情况下,我想要一个设置,我可以右键单击每个流程并编辑它。除了具有拖放功能以重新排列流中的对象外。试图找到一个类/一组类,我可以一起使用来实现这一直是一场斗争。

Ideally I'd like to have a setup where I can right click on each piece of the flow and edit it. In addition to having a drag and drop feature to rearrange the objects in the flow. Trying to find a class/group of classes I can use together to achieve this has been a struggle.

哪些类最适合此应用程序;特别是GUI类?编辑的实际内容不应该与GUI相关我正在寻找建议或方法我可能错过了。除了功能,它不必看起来那么奇怪;矩形和直线就足够了。

What classes would work the best for this application; specifically GUI classes? The actual content of the editing shouldn't be relevant to the GUI I'm looking for suggestion or methods I may have missed. Aside from the functionality, it doesn't have to look that fancy; rectangles and straight lines would suffice.

到目前为止,我知道如何使用和实现contextMenus和常规菜单来包含我需要的所有动作,但现在我需要找到与我的计划兼容并且可以保存数据的模型和视图。 (这是容易的部分;我有自己的自制类)

So far I know how to use and implement contextMenus, and regular Menus to contain all the actions I'll need, but now I need to find a model and view that is compatible with my plans and can hold the data. (That's the easy part; I have my own self made class for that)

我是Qt和C ++的新手。 (不是面向对象编程的新手,只是不同的语法和API。)

I'm new to Qt and C++. (Not new to object orientated programming, just the different syntax and API.)

我在寻找的流程图是这样:

The sort of flowchart I'm looking for is this:

或者你可以只是google流程图(取出上下文,我不需要颜色)

Or you can just google 'flowchart' (Taken out of context and I don't need colors)

提前感谢。我还没有找到一个我明白的解决方案;或使用Qt硬编码。

Thanks in advance. I haven't found a solution that I understand yet; or that uses Qt hardcoding. Any suggestions are appreciated.

推荐答案

有一个图场景示例,它使用图形视图框架制作流程图。它是一个应用程序,您可以在其中添加流程图形状和文本,并通过箭头连接形状。形状,箭头和文字可以使用不同的颜色,并且可以更改文字的字体,样式和下划线。

There is a Diagram Scene Example which uses the Graphics View framework to make flowchart diagrams. It is an application in which you can add flowchart shapes and text and connect the shapes by arrows. The shapes, arrows, and text can be given different colors, and it is possible to change the font, style, and underline of the text.

您可以查看在代码中,看看如何创建自定义图形项目和处理鼠标事件和项目的移动。

You can take a look at the code and see how to create custom graphics items and handle mouse events and movement of items.

这篇关于在Qt / C ++中创建一个可编辑的流程图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆