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. QGraphicsView doesn't fill the actual space for QGraphicsView?
Qt 6.11 is out! See what's new in the release blog

QGraphicsView doesn't fill the actual space for QGraphicsView?

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.0k 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    I have a ready form with a QGraphicsView item on it. In the actual MainWindow constructor, I have this:

    @view_ = new QGraphicsView(ui->GraphicsView);@

    In this case view_ is a QGraphicsView pointer found in the private of MainWindow. When I run the program, I see that the the new allocated QGraphicsView only fills up around 1/4th of the available space in the actual GraphicsView. When I set a scene to it, the small QGraphicsView has scroll bars. To fix this, I manually set the size of the allocated QGraphicsView to match the GraphicsView @view_->resize(400, 400);@ But even then when I set a scene bigger than the QGraphicsView, I get scroll bars. So why do I get scroll bars and why isn't the GraphicsView filled with the allocated QGraphicsView? Is it possible to remove the scroll bars and the ability to scroll while still having the ability to use for instance centerOn function of QGraphicsView?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What is ui->GraphicsView ? A QGraphicsView ?

      If so, why are you creating another one ?

      If not, you are just creating a QGraphicsView with a parent. You should put it in a layout in the central widget (or depending on your application, make it the central widget) in order for it to be manager by your QMainWindow

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      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