I am trying to add a box(position:1140, 485 and size:225, 365) with a scroll-able layout with buttons inside the layout. I do NOT want the box to move/resize. I want the box to have a scroll bar with which we can scroll through all the buttons in it.
The code I have so far is not working at all, all I get is a Layout full of buttons with a stretching box(which i DO NOT want). The only thing that is working so far is that the buttons are added to the box in the right-ish way.
All I need is to make the box scroll-able and make it so that the box does NOT resize itself when there are too many buttons.
Here is my code:
QWidget *box = new QWidget(); //creating the box and placing it where I want it
box->move(1145, 485);
box->resize(225, 365);
gameScene->addWidget(box); //adding it to the main scene
//where AM i supposed to use this?
QScrollArea *scrollArea = new QScrollArea();
QGridLayout *layout = new QGridLayout();
box->setLayout(layout);
//testButtons
QPushButton *testButton1 = new QPushButton("Button1");
layout->addWidget(testButton1);
....
QPushButton *testButtonN = new QPushButton("ButtonN");
layout->addWidget(testButtonN);
You can see the box on the BOTTOM RIGHT with the title GAME TRANSCRIPT. I just want the box to contain buttons just like it is. But i Do NOT want it resizing and i DO want it scroll-able since it is cutting off buttons at the bottom.