Domanda

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?

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top