[SOLVED] What part of Qt should I use for 2D graphics in circuit diagram editor?

  • Hi,
    i want to create a circuit diagram editor. I don't know what parts of Qt should i use for painting 2D diagrams. I found QPainter, OpenGL and QGraphicsScene. What is the best for my problem? I found this example: http://qt-project.org/doc/qt-5.0/qtwidgets/graphicsview-diagramscene.html . My diagram editor will look like similar, but it will be more complicated. I would like to drawn diagram can be exported to svg. What would you recommended to me?

    Thanks for all replies and sorry for my bad english.

  • Your options are between the scenegraph and QGraphicsScene, the first one always uses openGL through QML and allows for occasional QPainter C++ extenssion, the second one can use openGL or use software rendering and is pure C++. If you plan to run simulations on your circuits a.k.a SPICE that would best be implemented in pure C++ for performance reasons.

    Using QGraphicsScene should be more scalable, if you plan to create large circuits, using QML on the other hand will offer significantly faster development, but you have to interface your custom C++ components if you want top performance. For basic diagrams with no interactive simulations QML is the better choice, and last but not least, the documentation and samples on QGraphicsScene/View/Item is significantly more detailed and plentiful, and contains pretty much everything you will need to accomplish the task, with QML you will end up asking a lot of questions and waiting for answers that are not guaranteed to come quickly or at all.

  • [quote author="utcenter" date="1358525277"]Your options ...[/quote]
    I want write it completely in C++. So do you mean the best choice is certainly QGraphicsScene?

  • Best as in only - yes :) There is no public C++ API to use QtQuick, at least for the foreseeable future, so go ahead.

  • OK, thank you very much! :)

  • Have you heard of "Fritzing":http://fritzing.org/ ?

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.