Basiclayouts: Add scrolling to example

Adds scrolling to basic layouts example because the user interface in
the example doesn't fit properly on smaller screen sizes.

Fixes: QTCREATORBUG-27634
Change-Id: I61e6eac2b28e5b3ff0f984894fe38167b3f46a9c
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Markku Nokkala <markku.nokkala@qt.io>
(cherry picked from commit 89ce9a1c5a29e3f420931baa88c705856b99ac25)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Elias Hautala 2022-07-28 16:09:11 +03:00 committed by Qt Cherry-pick Bot
parent fed79f4802
commit ba33df8fcd

View File

@ -36,9 +36,24 @@ Dialog::Dialog()
mainLayout->addWidget(formGroupBox); mainLayout->addWidget(formGroupBox);
mainLayout->addWidget(bigEditor); mainLayout->addWidget(bigEditor);
mainLayout->addWidget(buttonBox); mainLayout->addWidget(buttonBox);
//! [4] //! [5] //! [4]
setLayout(mainLayout); QWidget *scrollAreaContent = new QWidget;
scrollAreaContent->setLayout(mainLayout);
QScrollArea *scrollArea = new QScrollArea;
scrollArea->setFrameShape(QFrame::NoFrame);
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
scrollArea->setWidgetResizable(true);
scrollArea->verticalScrollBar()->setStyleSheet("QScrollBar:vertical {width: 20px;}");
scrollArea->setWidget(scrollAreaContent);
QVBoxLayout *scrollLayout = new QVBoxLayout;
scrollLayout->setContentsMargins(0,0,0,0);
scrollLayout->addWidget(scrollArea);
//! [5]
setLayout(scrollLayout);
setWindowTitle(tr("Basic Layouts")); setWindowTitle(tr("Basic Layouts"));
} }
//! [5] //! [5]