Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to Set QSCROLLBAR to GROUPBOX
Pranit Patil last edited by VRonin
im trying to set Qscrollbar to groupbox but its not working properly
my code is for setup is below-
uiPoMo->scrollArea->setWidget(uiPoMo->groupBox_SenoresDetails); uiPoMo->scrollArea->setWidgetResizable(true); uiPoMo->scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn); uiPoMo->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); QVBoxLayout* pQVBoxLayoutMain = new QVBoxLayout; pQVBoxLayoutMain->addWidget(uiPoMo->scrollArea); QWidget* central1 = new QWidget(this); central1->setLayout(pQVBoxLayoutMain);
Do you mean you want to put a QScrollArea inside a QGroupBox ?
I did but no effect.
@Pranit-Patil It is quite unusual to put scroll bars into a QGroupBox (I can't remember ever seen an application with such an interface). Why do you want to do this?
@jsulm my application need is like this only.
we have no of sensors which will add dynamically and we want to show all sensor in that group box so ..
@Pranit-Patil Then you should have a scroll area in the widget where this group box is, not inside the group box. So, the group box would get bigger when more elements will be inside and user will be able to scroll to access the whole group box.
sorry i didn't understand what your saying
@Pranit-Patil You put your group box in some widget, right? Then put there your scroll area and put the group box in this scroll area. I never saw a group box with scroll bars inside, this is really not how it should work. The scroll bars should be in the parent widget of your group box.
VRonin last edited by
If you have a list/table of uniform things (like in your case sensors) use
QTableWidget(or model+view) to display them instead of creating a layout of unmanageable widgets