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. ResizeEvent is called indefintely when fitInView is called (QGraphicsScene)
Forum Updated to NodeBB v4.3 + New Features

ResizeEvent is called indefintely when fitInView is called (QGraphicsScene)

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 639 Views
  • 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.
  • aarelovichA Offline
    aarelovichA Offline
    aarelovich
    wrote on last edited by
    #1

    I have this weird problem.

    I create my scene inside a QGraphicsView extended class like so:

    scene = new QGraphicsScene(this);
    this->setScene(scene);
    this->setAlignment(Qt::AlignTop|Qt::AlignLeft);
    showRect.setCoords(0,0,sceneWidth,sceneHeight);
    

    However. This same class has reimplemented the resizeEvent Method according to documentation:

    void ConversationView::resizeEvent(QResizeEvent *e){
        //Q_UNUSED(e);
        this->fitInView(showRect,Qt::KeepAspectRatioByExpanding);
        qWarning() << e->size();
    }
    

    Now I add a box the scene and nothing happens. But when I start resizing the window, there comes a point where I stop and the program hangs and I keep seing the sizing message, forever and ever with very very small variations on its size:

    QSize(1342, 190) 
    QSize(1356, 190) 
    QSize(1342, 190) 
    QSize(1356, 190)
    

    Any ideas?

    1 Reply Last reply
    0
    • aarelovichA Offline
      aarelovichA Offline
      aarelovich
      wrote on last edited by
      #2

      I figured out what the problem was. Instead of redefining the ConversationView's resize event (which extends from QGraphicsView), I redefined the containing Widget's resizeEvent (in this case a class based of a QDialog).

      With the exact same parameters this made the problem go away.

      1 Reply Last reply
      1

      • Login

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