Results 1 to 3 of 3

Thread: Trying to use Layouts and QGraphicsView to resize widget for any monitor resolution

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2015
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Trying to use Layouts and QGraphicsView to resize widget for any monitor resolution

    I am trying to design a window that can be displayed fullscreen on monitors of various aspect ratios and resolutions. The window is being made in Designer and the central widget is a Horizontal Layout. The 3 items in the horizontal layout are a GroupBox on the left, a GraphicsView in the center, and another GroupBox on the right. The GroupBoxes may consist of text and/or buttons. The GraphicsView should display a view of a scene that is merely a circle drawn using QGraphicsScene::addEllipse(). The GraphicsView should be maximum in height and only as wide as its height, because its contents will always be a circle (displayed from edge to edge). The window should be displayed fullscreen and resize so the GraphicsView is as tall as possible and square (maintaining aspect ratio).

    I've had trouble doing this for the last day or so... I can get variations of it to work, but I either can't get the GraphicsView to display the circle properly using QGraphicsView::fitInView(), or I can't keep the GraphicsView from becoming too wide (wider than its height). I've attached a simple sample application and some screenshots below. Any help is appreciated!

    Cheers,
    Ryan

    p.s. I'm have tested on Qt 4.8.1 and Visual Studio 2010 and Qt 5.8.0 and MSVC2015.


    How it looks in designerDesignerCapture.jpg


    Results fullscreen on 1920x1080RuntimeCapture.jpg


    Desired results: GraphicsView in Red, GroupBoxes in Blue, Circle in Green: DesiredResults.jpg
    Attached Files Attached Files

Similar Threads

  1. Replies: 1
    Last Post: 5th September 2013, 16:33
  2. QGraphicsview with bad resolution
    By raphael_ in forum Qt Programming
    Replies: 1
    Last Post: 14th December 2012, 16:47
  3. Replies: 3
    Last Post: 11th December 2011, 10:09
  4. Replies: 8
    Last Post: 20th June 2010, 19:15
  5. How to calculate Monitor Resolution?
    By ashukla in forum Qt Programming
    Replies: 2
    Last Post: 7th October 2007, 07:28

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.