Results 1 to 3 of 3

Thread: I need advise about working with a QGraphicsScene and QGraphicsview

  1. #1
    Join Date
    Jul 2012
    Posts
    201
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default I need advise about working with a QGraphicsScene and QGraphicsview

    Okay guys I am developing an Ms Publisher-like application which will be used primarily for designing 4-page pamphlets. Each pamphlet page is of A5 size. My approach to developing this application is through the use of a QGraphicsView and QGraphicsScene but now I don't know if I need four scenes for each page or if I can use one scene and just sub-divide it four times. If I subdivide the scene 4 times I need to view to display one subdivision at a time to allow the user to work on one page at a time. Problem is, I don't know if that is possible. Your advise will be highly appreciated.

    thanking you in advance.

  2. #2
    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: I need advise about working with a QGraphicsScene and QGraphicsview

    If you use the Graphics / View architecture, you can put all four pages as separate graphics items in the same scene. Since all of your views will presumably be of the same document, then you need only one scene. Which part of the scene you display is determined by the viewport you set in each view QGraphicsView::setSceneRect(). By changing the position of the individual items within the scene, you can choose whether to display the pages side-by-side or in a 2 x 2 array, etc.. You might even add drag and drop capability to let the user change the order of pages.

    If you are using the A-sized paper system as the units for your scene, then you would want to set the scene dimensions to be some multiple of A5 pages wide x high, multiplied by some reasonable dimension in print resolution (eg. 2 x A5 width in mm x 12 pixels / mm by 2 x A5 height x 12 for a 2x2 page scene).

    Alternatively, doing this without Graphics / View, your main UI would contain a QStackedWidget, with one page image per page in the stack, and maybe a 5th page to show the entire document. Each page in the stack is responsible for the editing of the image in that page, and your document keeps track of the order of the pages. Or use a QTabWidget, with one image per tab and a 5th tab for the document view. Let the user rearrange the tabs to change the page order.

    Or, you can use QGraphicsScene and the same stacked widget, each page containing a QGraphicsView dedicated to the scene rect for one page of the document.

    In any case, you will have to provide the same kind of tools for editing and manipulating the page and document content. If you choose to implement the output of those tools as individually editable graphical elements (eg. text, geometric objects, lines, and groups of them), then the Graphics / View architecture is probably the best choice, since it has built-in support for all of that.
    Last edited by d_stranz; 3rd April 2015 at 17:47.

  3. The following user says thank you to d_stranz for this useful post:

    ayanda83 (4th April 2015)

  4. #3
    Join Date
    Jul 2012
    Posts
    201
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: I need advise about working with a QGraphicsScene and QGraphicsview

    @d_stranz, thank you very much for taking the time to answer my question. Your reply was very informative, it helped me a lot. thank you.

Similar Threads

  1. QGraphicsView and QGraphicsScene
    By Molier in forum Qt Programming
    Replies: 11
    Last Post: 28th November 2010, 01:23
  2. Advise sought on working with binary files across OSes
    By TorAn in forum General Programming
    Replies: 2
    Last Post: 19th September 2010, 06:44
  3. QGraphicsView and QGraphicsScene
    By alisami in forum Qt Programming
    Replies: 8
    Last Post: 4th December 2008, 10:10
  4. QGraphicsScene and QGraphicsView
    By sabeesh in forum Qt Programming
    Replies: 7
    Last Post: 1st August 2007, 06:59
  5. QGraphicsScene and QGraphicsView
    By rossd in forum Qt Programming
    Replies: 2
    Last Post: 25th April 2007, 14:43

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.