Important: Please read the Qt Code of Conduct -

Simple 2d graphics using qt

  • hello,i m quite new to qt.I m developing a project which is supposed to display vector image in a visualizer..the project contains visualizer class inherited from QMainWindow.
    Main.cpp creates visualizer object "visualizer w and"
    visualizer.ui contains a menubar,toolbar,Qtreeview and QtabWidget.
    I have another vecImg class that reads vector file and stores points,lines n polygon info. I want to display the info of vecImg class in
    QTabWidget of the ui.
    main.cpp calls visualizer which in turn invokes vecImg.cpp

    I tried inheriting vecImg from QWidget and override paintEvent to draw lines on tabWidget but that didn't work.

    What should I do to draw vecImg containing info on QTabWidget of the visualizer.ui?

  • Maybe "this": is (QGraphicsPolygonItem) what you are looking for.
    There is also an example "Diagram Scene Example" in Qt Creator on how to use it.
    Hope it helps.


  • Hey thanks,QGraphicScene class helped me!
    its working !

Log in to reply