Details
-
Bug
-
Resolution: Out of scope
-
P3: Somewhat important
-
None
-
6.5.2
-
None
-
MacOs
Description
On MacOs with Qt 6.5.2 using QScrollArea: regardless of whether setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn) is called, the vertical scrollbar is only shown when needed and not all the time.
Expected: the vertical scroll bar should always be shown.
#include <QApplication> #include <QDialog> #include <QLayout> #include <QScrollArea> #include <QSize> #include <QWidget> #include <QLabel> #include <QPushButton> int main(int argc, char *argv[]) { QApplication a(argc, argv); QDialog dialog; auto dialogLayout = new QVBoxLayout(&dialog); QWidget* mainWidget = new QWidget; QVBoxLayout* mainLayout = new QVBoxLayout(mainWidget); dialogLayout->addWidget(mainWidget); QWidget* topWidget = new QWidget; QScrollArea* topScrollArea = new QScrollArea; topScrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); topScrollArea->setWidget(topWidget); topScrollArea->setWidgetResizable(true); mainLayout->addWidget(topScrollArea); topScrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); QVBoxLayout *topLayout = new QVBoxLayout(); topWidget->setLayout(topLayout); for (int i = 0; i < 10; i++){ QPushButton *tempButton = new QPushButton(QString("%1").arg(i)); tempButton->setMinimumHeight(50); topLayout->addWidget(tempButton); } dialog.show(); return a.exec(); }