Important: Please read the Qt Code of Conduct -

How to access scene in other class

  • hi i got small problem i decleared scene in mainwindow i want to add rectitems in the scene in other class...i am accessing the scene but when i am adding items it was not showing any items...


    m=new mainwindow();
    i done like this that scene was not up dating....some one send solution pls

  • Are you sure the rect you added is in the visual area of your view? The code you post is close to useless. We cannot see what is actually happening based on these three lines.

  • mainwindow.cpp
    scene=new QGraphicsScene(this);
    view=new QGraphicsView(this);
    one application is there i created in seperate class which is derived from QDilog....i created one buton in main window.. when i click on that button that dialog will open it contains some file reading thing in that file some rectitem co-ordinates are there...while i was reading the file i want to up date the scene with those rect coordinates.... now tell me how to add rectitem to the scene in that dialog it possible to update the scene in different class??

Log in to reply