문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top