Implementing a multi-level, embedded unified interface in QT?
-
My specific application requires the user to design a graphical object through multiple levels. The problem is that the UI must allow the user to manually click on some kind of toolbar to click any desired level and that level must have some more or less functionality than the previous one while keeping it in the same interface. Let me give an abstract example.
Level 1: Logic Gates, Level 2: Circuits, Level 3: CPU's, Level 4: Integrated Systems
Now let's say the user just finished logic gates and now wants to go to circuits, they click on Level 2 in the toolbar and this brings up a set of tools completely different from the logic gate tools, and the view port display has made the logic gates 10% smaller to make them fit into the circuits however the user is not opening another interface but the interface changes it's look, feel, and features to support the levels.
Is this possible to do in QT? Any suggestions
-
Im not an expert but here is a possible solution for your tool bar.
Use a QDockWidget that contains a QTabWidget. the QTabWidget will have 4 tabs corresponding to the 4 levels, each with there own tools for building the circuits. As for the view port that zooms in and out depending on the layer being dealt with, you could probably do it with openGL in a QGLWidget "see here":http://qt-project.org/doc/qt-5.0/qtopengl/qglwidget.htmlopenGL is great for making 2d and 3d views and even games. I don't really know anything about openGL or QGLWidget, so I'm not sure how you would draw the circuits and stuff, but its worth a look. To me, your project seems almost like a game, so it may be worth it to go poke around the game development forum :)
Your project sounds very cool! I would love to see it in action one day!
-
Thanks! I love your enthusiasm and I will be sure to show you it when it is finished.
I haven't actually started the UI yet even though of programs unique to certain levels only, I just didn't know how to integrate them. If I made these 4 different tabs, would they allow a whole new set of features and tools to be put in that unique ONE level and allow switching between both while keeping the viewport the same (showing the logic gates but smaller)?
So a designer can go the circuit level and implement a tool that is nowhere to be found on the logic gate level, BUT can still integrate with it.
-
okay I think your asking if each tab had different tool could they all integrate together. Correct me if Im wrong.
The answer is yes! The pieces of the circuit would probably each be there own class (easiest sounding way to me). These classes would all have properties (like ohms for a resistor, volts for a battery, etc) that define their behavior and how they interact with each other as well as there look and feel. Clicking a tool button in one of the tabs would create a new instance of that class. You can do the zoom of the QGLWidget based on the tabs I think. I believe there is a signal called activeChanged() that you can hook the zoom up to (check the QTabWidget Docs). So if the active tab is 1, it would be zoomed into the Logic Gate, but if 4 is active it will zoom out to the Integrated Circuits. That being said, programming this is going to be very tough and time consuming. Before you go to town on this project, check out the tutorials on QGLWidget (Qt Creator->Welcome->Examples). This project will involve many classes and thousands of line of code. But don't let that dissuade you! Just start small and don't hesitate to completely start over once in a while!
-
I appreciate everything you have done. It's rare to see someone so helpful on the internet. I just had a few verification questions to end this post.
- If I open another tab will the main view-port stay the same? What is in the viewport may change but does the overall viewport stay embedded and does not require another visual representation .
- If I open a new tab is it possible to modify the actual window to show the icons and nodes for different tools than other levels. So on Lv.1 I may have a box on the right with abunch of tools and on Lv.2 the box would either be shaped differently (with new tools or stay the same but change tools. All without changing the viewport.
- Let's say their is a tool that routes logic gates into circuits. On the CPU Level can the same tool be used but it is given the previously CUSTOMED MADE circuits to instead route together from user specifications or must the tool be specific to it's class?. The tool simply takes a object and routes it in a volume. Can different classes and object be given to the tool and routed even if they are still in design and not saved.
- (Last Question) Can they be designed completely independent from each level but are still integrated when they come together?
That's about it. Thanks for your advice.