Graph with elements hierarchy in Qt - c++

I need make graph in graphic framework Qt. I use QGraphicView and QGraphicScene and make my graph by hand (add Recangles, late add line to display hierarchy of single elements). For you to get an idea, picture, what I think:
And my supervisor tell me, that it is inefective. Somebody had to do something similar before me. So I must look for some library or framework in Qt, which support graph like mine (see above) and support mouse tracking, because after click I need do some operation.
So I searched on Google for few days and only thing I find is QTreeView. It is what I need, but it's for directory structure and that's not what I imagined.
Please, know somebody something like QTreeView, but in graphical adaptation? Thanks for any help.

Related

Swiftui set boundaries for drag and drop, based on color

I am using the latest swiftui and would like to know if it is possible to create drag & drop boundaries based on color?
I already created a drag & drop with rotation, pinching, etc. But would like to be able to create regions where you can drop into.
Thanks
Yes it is! It's a great idea, and I think you should pursue it.
As it stands there's a hundred different ways to go about things. Spend some time thinking about how you would want it to work, then just take baby steps. You've already covered a lot of the ground work by implementing rotation and pinching.
Write some code (in a playground so you get instant feedback) that does some simple drag and drop work. Add in a line of code that turns the background a different color or changes its opacity when you let go/lift your finger.
Those types of incremental changes are well documented and you will be able to google them quickly. I think it's a great sign that you haven't found ready made examples. It means you are thinking outside the box.
This is an opportunity for you to think like a developer and a designer. If you post your results somewhere or release a project on GitHub at some point, others will be able to find your work using the same search criteria you used when you didn't find any results.
If you get stuck, post the code the code that has you baffled, and I'm sure you get help on this site. Best of luck 🍀

Table/Grid using MFC

I just started developing an MFC application for the first time and I'm hoping to get more familiar with the whole "controls" concept. I am using the dialog editor in visual studio and so far I was not able to find functionality to add a simple table/grid. It seems quite basic to me, but I can't even find reliable information on how to do it on the internet.
I am looking for something similar to Qt's QTableWidget, something that I can later program with variable amount of rows and columns tailored to my application's use cases.
Do you have any ideas how to do it?
I use CGridCtrl which is very powerful and does a lot of the legwork for you.
Sounds like you're after a List View Control, which is wrapped by MFC's CListCtrl class. The dialog editor will enable you to add one and set its properties.

How to find wxWidgets?

I am new to wxWidgets. I have checked a couple of tutorials and can write simple code to generate simple GUI in C++.
Sometimes I have problems when I try to find a specific widget, or just a kind of widget. Documentation has some images. For example, if I want a scroll bar, I can search for it and see a picture too. But often, I have a picture in mind of what I would like to find, but simply don't know how it is called, or what category I should search in. Or probably even more commonly, a widget that would solve some problem already exists, but I just don't know about it.
If there is some online source, where widgets are listed and structured in a logical way along with their images, to quickly find and identify them... I haven't found it.
How can I find widgets to use?
Unfortunately wxWidgets doesn't have anything like this currently. What I recommend is running the widgets sample and looking at the controls shown in it. It doesn't show all of them (there are separate samples for most of the more complex or more esoteric widgets), but it does show quite a few.

Node graph editor layout algorithm

I'm very much trying to do what was asked here:
http://www.qtcentre.org/threads/45028-Designing-a-Node-Editor-(Hint-Blender-Node-Editor)
Which is basically a blender style node editor using Qt. Creating rects with circles which can be drag/dropped is fairly simple to figure out (see the image below).
The issue I have is how the algorithm for connecting the circles between nodes would work. Also I don't know how this could be drawn efficiently using QGraphicsItem API's? I have seen QPainter::cubicTo() which looks like it may be the way to go?
I assume it somehow manages to find a none overlapping path? But it must also handle the case where it has to overlap?
And what about the user being able to move these lines around in case the algorithm has done a bad job? I don't think this would be simple to implement using QPainter::cubicTo() as you could only move the curves control points?
I don't think you'll get anyone posting the code for doing the whole lot here.
Well, I volunteer -- just in case someone still needs such a library.
It is a Qt-based node editor implemented on top of QGraphicsView.
A library consumer defines data models, the rest is done by the node editor.
Some features:
Model-view approach.
Models describe data types, number of input and outputs and optional embedded QWidget.
The Scene could be saved to file.
The rest similar projects were either not finished, not supported anymore or lacking some features.
https://github.com/paceholder/nodeeditor
I would suggest that you implement it without taking into consideration overlap but with the possibility of overriding how the connecting line is drawn.
It looks like there were some good replies on the Qt forum. I don't think you'll get anyone posting the code for doing the whole lot here.
Perhaps take a look at the Qt demos Graphics View/Elastic Nodes - There is code for the demo that you can use as a starting point, but it is a lot of work to get from there to something like the Blender node editor.
Another node editor to take a look at is SynthEdit or Synth Maker (has a nice one).

Graph edit framework

I was looking at MeVisLab and I wondered if anyone knows a good framework for making a user interface similar to the one they use. I like the designing flow with boxes and arrows thing.
What I would really like is to able to integrate with C++ using Qt, and perhaps export the graph to xml of something like that.
There is another example of the interface here:
I hope someone knows something
Qt's Graphics View is a "framework" which does a good bit of the handling for the kind of scenario you describe. It doesn't take much code to get off the ground and within striking range of what you're looking for:
http://doc.qt.nokia.com/latest/graphicsview-diagramscene.html
http://doc.qt.nokia.com/latest/graphicsview-elasticnodes.html
I'm not aware of any open-source Qt-based programs that offer exactly what you want already written. Just noticed IBM did open source "DataExplorer", which is interesting to me...I might go take a look at that myself:
http://www.research.ibm.com/dx/