PDA

View Full Version : Ladder logic editor



GuL
22nd October 2009, 02:21
I would like to develop a ladder diagram logic editor using qt. I would like sugestions about how to do it.
What class to use?

john_god
22nd October 2009, 02:37
Humm... You will need to draw, what about QGraphicsWidget and QGraphicsScene ?
Also check the "Diagram Scene" example from Qt Examples and Demos, it may help you.

GuL
22nd October 2009, 03:22
Thank you for the fast answer. I'm checking the Diagram Scene.
Any other sugestion?

john_god
23rd October 2009, 01:34
I would do it in small steps, first create the aplication interface, e.g. a mainwindow with a mdi child window, or whatever. Than populate the mainwindow menu with drawing buttons, each button for a ladder drawing element. Even if this does nothing yet, you will have something to show, and you will be entusiastic to continue. I usally use Icofx freeware to create the icons. Than I would create one class for each drawing element, or you can create a drawing abstract base class and create derived classes for each element (althougt I think this approach is more difficult).The example I point it's good, instead of drawing triangules and squares, you will have to ajust the geometry you need for the ladder elements. Also has the mouse click for drawind line conector between elements. What else do you plan for your aplication, do want something like a text editor for PL7 programming language, or something like that ? This would be more complex. I thing you have enought to start, and wish you the best of luck for your project.

GuL
23rd October 2009, 22:02
I started working in a company that develop PLCs in the end of August 2009. We already have a working Ladder Diagram Editor, and I became responsible for the development. I want to port it to QT, today it is built with c++ builder 5 (its quite old, I know).

This version is very dificult to maintain, because it uses Canvas to draw everything. Every time the hole screen is redrawn, that's the hard part. I have to deal with every aspect of the action the user have done and everything is around that action.

So, I need some kind of widget, class, whatever, that might give me less trouble. :)
I will take a look at the sugestions you gave me this weekend.

I also need develop some code editor. I thought of QScinttila. Is it good?
Anybody has any other sugestion?