Results 1 to 6 of 6

Thread: Display multiple QGraphicsView in same screen while all fullscreen

  1. #1
    Join Date
    Feb 2014
    Posts
    23
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Display multiple QGraphicsView in same screen while all fullscreen

    I've been trying different approaches to solve my problem for quite some time, but nothing seems to work.

    Making a game for one of my CPE classes and I've gotten my game background to load, with scrolling and zooming all working properly. However, in order to overlay buttons that allow the different game functions, they cannot be built into that QGraphicsScene as they will then move and zoom with the display. Thus I'm trying to create another QGraphicsView in transparent mode with its own QGraphicsScene containing just the game overlay information that stays static despite the state of the background.

    I've tried using the Forms editor, but it wont let me stretch a GraphicsView to it while having buttons overlay.

    I've tried just setting up two separate QGraphicsView items in my code not using a UI edited form and disabling my MainWindow, but they both then populate in their own windows as fullscreen. Setting one as the child of the other results in the parent being fullscreen and the child being partial.

    I've tried making both GraphicsView's children of the MainWindow, but once again they end up only filling part of the screen.

    I've probably tried a few other approaches that I can't think of after hours of manipulating things in different manners, but nothing generates my expected result, thus leading me hear to ask.

    Any advice/insight would be a major help.
    Thanks in advance!

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Display multiple QGraphicsView in same screen while all fullscreen

    Quote Originally Posted by squeegedog View Post
    they cannot be built into that QGraphicsScene as they will then move and zoom with the display.
    Even when you set ItemIgnoresTransformations?

    Quote Originally Posted by squeegedog View Post
    Setting one as the child of the other results in the parent being fullscreen and the child being partial.
    Did you set a layout on the parent?

    Cheers,
    _

  3. #3
    Join Date
    Feb 2014
    Posts
    23
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: Display multiple QGraphicsView in same screen while all fullscreen

    Even when you set ItemIgnoresTransformations
    Setting that works well with the zoom, however, the labels still move with the screen scroll.

    Did you set a layout on the parent
    No, the second view is being forced to the upper-left corner of the display. I'm getting decent with working in QT, but I haven't figured out setting layouts etc from code, only using the forms editor.

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Display multiple QGraphicsView in same screen while all fullscreen

    Layouts in code basically work like this

    Qt Code:
    1. QVBoxLayout *layout = new QVBoxLayout(parentWidget);
    2. layout->addWidget(childWidget);
    To copy to clipboard, switch view to plain text mode 

    Cheers,
    _

  5. The following user says thank you to anda_skoa for this useful post:

    squeegedog (6th February 2014)

  6. #5
    Join Date
    Feb 2014
    Posts
    23
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: Display multiple QGraphicsView in same screen while all fullscreen

    Thanks!

    At first I was looking at your solution all wrong, but by adding the layout to my main QGraphicsView, I can add buttons to it that are unaffected by Scene changes. Also removing the need for multiple displays

  7. The following user says thank you to squeegedog for this useful post:

    d_stranz (7th February 2014)

  8. #6
    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: Display multiple QGraphicsView in same screen while all fullscreen

    adding the layout to my main QGraphicsView, I can add buttons to it that are unaffected by Scene changes
    Nice. That's something I can probably use, if I can remember this thread when the time comes to use it...

Similar Threads

  1. Using Multiple Cameras in a single screen
    By anupam in forum Newbie
    Replies: 10
    Last Post: 28th February 2014, 09:55
  2. QGraphicsView get fullscreen
    By AlbertoN in forum Newbie
    Replies: 3
    Last Post: 9th October 2013, 12:47
  3. multiple screen
    By hitesh_sharma@satyam in forum Qt Programming
    Replies: 4
    Last Post: 9th December 2011, 10:09
  4. How to Keep Splash Screen and App on Same Display
    By ajb_advance in forum Qt Programming
    Replies: 2
    Last Post: 4th March 2009, 11:49
  5. Display image fullscreen, the best way?
    By Hmail01 in forum Qt Programming
    Replies: 3
    Last Post: 26th July 2008, 23:00

Tags for this Thread

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.