Results 1 to 2 of 2

Thread: I get he impression that Qgrapchiscene and Qgrapchisview are sometimes redundant ?

  1. #1
    Join Date
    Sep 2010
    Posts
    654
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    56
    Thanked 1 Time in 1 Post

    Default I get he impression that Qgrapchiscene and Qgrapchisview are sometimes redundant ?

    At diagramscene example I see :

    Qt Code:
    1. scene->update();
    2. view->update();
    To copy to clipboard, switch view to plain text mode 

    I also see :
    Qt Code:
    1. DiagramScene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent)
    To copy to clipboard, switch view to plain text mode 

    The model-view applied to this is some confused.....
    It is as the two objects were sharing something ....
    Who is the responsible of draw ?
    Can I create a mix - object ? (On object with the mixed of both)
    Is it possible ? It is a bad - good idea ?

    Any explication?
    Thanks

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: I get he impression that Qgrapchiscene and Qgrapchisview are sometimes redundant

    Who is the responsible of draw ?
    The view is the only thing doing any drawing. As the QGraphicsScene docs say:
    Note that QGraphicsScene has no visual appearance of its own; it only manages the items. You need to create a QGraphicsView widget to visualize the scene.
    Mouse events on the view are translated into their equivalent event in the scene and forwarded, which is why the scene has these events.
    Can I create a mix - object ? (On object with the mixed of both)
    You have to have a scene and a view (or views) somewhere. If they are both member variables of, for example, the main window class then that makes sense (but is not mandatory).

Similar Threads

  1. Replies: 1
    Last Post: 4th March 2011, 14:48
  2. Impression from a newbie
    By Rik in forum Newbie
    Replies: 4
    Last Post: 5th July 2010, 22:51

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.