Frage

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?

War es hilfreich?

Lösung

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top