Answer the question
In order to leave comments, you need to log in
How to add a scrollbar to a layout where LineEdits are added in QT?
Hello! There was a seemingly simple task, but it is impossible to implement.
The screenshot shows an example of a part of the interface that I made.
The bottom line is that when you click on "add powers" in the layout, which is located below, N LineEdits should be created for entering numerical values. I implemented this in a loop, the main logic of which is given below:
ui->scrollArea->setLayout(ui->verticalLayout);
int height = INITIAL_VALUE;
for (int i = 0; i < count; i++) {
ui->verticalLayout->addWidget(new QLineEdit());
height += 50;
ui->scrollArea->setGeometry(15, 290, 160, height);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question