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. How to make ViewPort expand with QGraphicsView
Forum Updated to NodeBB v4.3 + New Features

How to make ViewPort expand with QGraphicsView

Scheduled Pinned Locked Moved Unsolved General and Desktop
layoutgraphics viewviewport
2 Posts 2 Posters 1.8k 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.
  • P Offline
    P Offline
    ProstoNekitos
    wrote on last edited by
    #1

    Good day,
    I've got GraphicsView widget made in Designer. And subclass from QGraphicsView with few new methods. In MainWindow constructor subclass set as ViewPort for GraphicsView. When resize event for mainwindow is called, GraphicsView size changes:

    
    void MainWindow::resizeEvent(QResizeEvent *)
    {
        ui->graphicsView->resize(this->width(), this->height());
    }
    
    

    But i've got some issues with resizing viewport - it stays the same size. What should i do to resize it?
    0_1524120374057_Снимок.PNG

    0_1524120423078_Снимок.PNG

    P.S.: sorry for terrible language.

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

      Hi and welcome to devnet,

      Did you put your widgets in layouts ?

      You might also be interested by QGraphicsView::fitInView.

      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