QHBoxLayout* layout = new QHBoxLayout; layout->setContentsMargins(20, 10, 20, 10);
QHBoxLayout* layout = new QHBoxLayout; layout->setContentsMargins(QMargins(20, 10, 20, 10));
QHBoxLayout* layout = new QHBoxLayout; layout->setContentsMargins(0, 0, 0, 0);This example sets all the margins to zero, meaning there will be no space between the widgets and the edges of the QHBoxLayout. Package Library: Qt.