QFrame* frame = new QFrame; QHBoxLayout* layout = new QHBoxLayout; frame->setLayout(layout);
QFrame* frame = new QFrame; QGridLayout* layout = new QGridLayout; frame->setLayout(layout);This code creates a grid layout and sets it as the layout for the QFrame. Package Library: QT Library.