Results 1 to 17 of 17

Thread: Scene vs. multiple views

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2006
    Posts
    426
    Thanks
    8
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Scene vs. multiple views

    Quote Originally Posted by wysota View Post
    By "closest" I understand it's not exactly what you wanted. What functionality are you missing exactly?
    OK, I am getting to it now... current code is this:

    Qt Code:
    1. void QfwSummaryView::drawItems( QPainter * painter,
    2. int numItems,
    3. QGraphicsItem* items[],
    4. const QStyleOptionGraphicsItem options[] )
    5. {
    6. for ( int idx = 0; idx < numItems; idx++ ) {
    7. QfwSummarizableItem* item = dynamic_cast<QfwSummarizableItem*>( items[ idx ] );
    8. if ( item ) {
    9. painter->save();
    10. item->drawSummary( painter );
    11. painter->restore();
    12. }
    13. }
    14. }
    To copy to clipboard, switch view to plain text mode 


    See the attached screen dump, I have 2 tracks with multiple curves, each curve shares the same Y axis, but they have their own X axis. The Y axis is long that require scroll bar, so the idea is to have 2 views: the bottom view is to draw those curves, the top view is to draw "legend" along with X axis min value and max value....

    I am currently using the same QGraphicsScene, there is a boundingRect problem, for instance the area plot (in the right track) has narrow width, but the "legend" at the top is wider, yet exposure is controlled by the real object's boundingRect...

    So, I think I need to have two scenes, can someone gives me a simple UML class diagram, as well as how to keep then in sync?
    Attached Images Attached Images

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Scene vs. multiple views

    I think this is a candidate case for two scenes. As for synchronization, simply connect signals and slots from the scrollbars together.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Dec 2006
    Posts
    426
    Thanks
    8
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Scene vs. multiple views

    Quote Originally Posted by wysota View Post
    I think this is a candidate case for two scenes. As for synchronization, simply connect signals and slots from the scrollbars together.
    Scrollbar synchronization is not a problem. But the item's synchronization may be complicated.

    The pen may be changed (assuming I have a pen editor), the brush may be changed, or the width of the track may be changed.

    At the end, I need to print them in the same paper without QSplitter...

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Scene vs. multiple views

    Quote Originally Posted by lni View Post
    The pen may be changed (assuming I have a pen editor), the brush may be changed, or the width of the track may be changed.
    It's not changed by some "outside force", when you apply the change to items in one scene, you can apply them to items on the other scene as well. You can even store pointers to items from scene A in corresponding items in scene B (and vice versa) to be able to quickly map between them.

    At the end, I need to print them in the same paper without QSplitter...
    I don't think that's a problem. After all you are rendering scenes, not widgets.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Dec 2006
    Posts
    426
    Thanks
    8
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Scene vs. multiple views

    Quote Originally Posted by wysota View Post
    It's not changed by some "outside force", when you apply the change to items in one scene, you can apply them to items on the other scene as well. You can even store pointers to items from scene A in corresponding items in scene B (and vice versa) to be able to quickly map between them.
    Ya, somewhere I need to keep link of two items in different scene. But I need a good design with UML class diagram

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Scene vs. multiple views

    It seems I have managed to answer my own question from 13 years later
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Scene vs. multiple views

    You're getting old if you can't remember the details of a conversation you had only 13 years ago...
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. QGraphicsView, QGraphicsItem, QGraphicsScene
    By Shuchi Agrawal in forum Newbie
    Replies: 10
    Last Post: 23rd March 2011, 20:50
  2. Question about a model with multiple views
    By awhite1159 in forum Qt Programming
    Replies: 3
    Last Post: 26th June 2008, 00:27
  3. Creating new scene from a part of an old one
    By maverick_pol in forum Qt Programming
    Replies: 6
    Last Post: 28th November 2007, 18:14
  4. Creating a scene from piece of another scene
    By maverick_pol in forum Qt Programming
    Replies: 3
    Last Post: 23rd August 2007, 17:51
  5. How to use QGraphicsView and Scene right ...
    By Mike in forum Qt Programming
    Replies: 6
    Last Post: 22nd January 2007, 08: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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.