Amott
Amott

Reputation: 201

Add a QScrollArea to a QFrame

I am developing my own widget which is a kind of tree view, and I am facing a little problem : my items are QPushButtons, they are in a QFrame, which is in a scrollArea. When I deploy my items, scroll bars don't appear and I can't use my scroll wheel. I have tried to change the size of my QFrame dynamically but it doesn't work. I have search on the net but I did not found any real good answer.

My widget

My UI

If someone has a clue to resolve the problem, I am interested !

Thanks !

Upvotes: 0

Views: 1605

Answers (1)

Amott
Amott

Reputation: 201

Finally found the solution :

ui->scrollArea->setWidgetResizable(true);
QGridLayout *gridLayout = new QGridLayout(ui->scrollAreaWidget);
ui->frame->setFixedHeight(ui->scrollArea->height());
gridLayout->addWidget(ui->frame,0,0,1,1);

and change fixedHeight when I deploy a node

Upvotes: 1

Related Questions