Nominate our 2022 Qt Champions!

QGraphicView and fixed viewport

  • When I resize my application, also resizing the viewport in scene coordinates. Is it possible fixed viewport size in scene? I tried do it using fitInView(), but I had a big problem with perfomance.

  • Could you be more specific about what you want?
    -have you seen a setFixedSize(int, int) function in your mainwindow?
    -You can resize the Window to fit your GL stuff, one way to do that is to connect QGLWidget and your QMainWindow with a custom signal and a slot, passing two parameters (width and height) to resize your application.


  • Yes, I have seen a setFixedSize(int, int), but it's not exactly what I want.This function fixed widget size.When I resize my application I need that resize widget size, but viewport size inside scene has been constant.
    I'm using QGraphicsView/QGraphicsScene, not OpenGL.

  • Are you perhaps mistaking the viewports size with scene size?

  • Please provide some code showing what you are doing.

Log in to reply