Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to access scene in other class
Forum Updated to NodeBB v4.3 + New Features

How to access scene in other class

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 2.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sri438
    wrote on 15 Nov 2011, 10:27 last edited by
    #1

    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();
    ...
    ...
    m->scene->addRect(100,10,100,20);
    m->scene->update();
    @
    i done like this that scene was not up dating....some one send solution pls

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on 15 Nov 2011, 10:34 last edited by
      #2

      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.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sri438
        wrote on 15 Nov 2011, 10:50 last edited by
        #3

        mainwindow.cpp
        @
        scene=new QGraphicsScene(this);
        view=new QGraphicsView(this);
        view->setScene(scene);
        @
        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 class....is it possible to update the scene in different class??

        1 Reply Last reply
        0

        1/3

        15 Nov 2011, 10:27

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved