I would personally use a container widget as follows:
QWidget container;
QVBoxLayout* containerLayout = new QVBoxLayout();
container.setLayout(containerLayout);
ui->scrollArea->setWidget(container);
for(auto word: words){
QCheckBox *checkbox = new QCheckBox(QString::fromStdString(word));
containerLayout->addWidget(checkbox);
}
Note that your original code is syntactically incorrect. I added the missing closing bracket.