Question

I have this code:

  QFrame* contentsFrame = new QFrame();
  contentsFrame->setLayout(contentsLyt_);

  QScrollArea* scrollArea = new QScrollArea();
  scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
  scrollArea->setWidgetResizable(false);
  contentsLyt_->addWidget( scrollArea );

  scrollArea->setWidget(contentsFrame);

The app gets freezed while setting the widget. I cannot debug or enter to setWidget because it is Qt functionality. Executing this freezes. Stopping there doesn't give me any clue. Both pointers are not NULL. It is some kind of loop inside Qt i don't understand.

Any idea?

Was it helpful?

Solution

You are setting a widget for the scroll area which indirectly contains the scroll area. That's why Qt is getting into an infinite loop, I think.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top