在Qt / C ++中制作可编辑的流程图 [英] Making an editable flowchart in Qt/C++

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

问题描述

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



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



哪些类对这个应用程序是最好的?特别是GUI类?编辑的实际内容不应该与GUI相关,我正在寻找可能错过的建议或方法。除了功能之外,它不一定要看起来很漂亮;到目前为止,我知道如何使用和实现contextMenus,以及常规菜单来包含我需要的所有动作,但现在我需要找到与我的计划兼容的模型和视图,并可以保存数据。 (这是很简单的部分;我有自己的自制类)



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



我正在寻找的流程图是:





或者你可以只是谷歌'流程图'(取消了上下文,我不需要颜色)



提前感谢。我还没有找到我所理解的解决方案;或者使用Qt硬编码。任何建议都不胜感激。

解决方案

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



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


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.

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.

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)

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:

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

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天全站免登陆