Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. My QGraphicsView will not resize
Forum Updated to NodeBB v4.3 + New Features

My QGraphicsView will not resize

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 2.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    krosseland
    wrote on last edited by
    #1

    Hi,

    I have a simple Widget containing only a QGraphicsView where I display an image using scene->addPixmap ...

    When I drag in the main window I want the QGraphicsView to expand. I have in design mode set the vertical and horizontal size preference to Expanding. However, it does not expand when I make the main window bigger.

    Is there a simple way of resizing the QGraphicsView when I make the main window bigger?

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      You need to put the graphics view in a layout. After you drag the graphics view to the main window select main window and click one of the layout icons on the top toolbar (the blue dots or bars icons) or use a shortcut (CTRL+L).

      Setting a size policy only works when a widget is inside a layout, but for a single element it does nothing. It only matters if there are more widgets in the same layout. Then the policy defines how much space each widget gets in relation to others.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved