On designer as default scrollarea creating a central widget. This is the auto-generated code from designer and if you put your label into this content it will work. Or you can create your own class inherited from QLabel and promote that contents widget into your class and that will work too.
scrollAreaWidgetContents
= new QWidget();
scrollAreaWidgetContents->setObjectName(QStringLiteral("scrollAreaWidgetContents"));
scrollAreaWidgetContents
->setGeometry
(QRect(0,
-460,
1920,
1080));
verticalLayout
= new QVBoxLayout(scrollAreaWidgetContents
);
verticalLayout->setSpacing(6);
verticalLayout->setContentsMargins(11, 11, 11, 11);
verticalLayout->setObjectName(QStringLiteral("verticalLayout"));
verticalLayout->setContentsMargins(0, 0, 0, 0);
label
= new QLabel(scrollAreaWidgetContents
);
label->setObjectName(QStringLiteral("label"));
label
->setPixmap
(QPixmap(QString::fromUtf8("../../../Pictures/chuukarudoruhu.jpg")));
scrollAreaWidgetContents = new QWidget();
scrollAreaWidgetContents->setObjectName(QStringLiteral("scrollAreaWidgetContents"));
scrollAreaWidgetContents->setGeometry(QRect(0, -460, 1920, 1080));
verticalLayout = new QVBoxLayout(scrollAreaWidgetContents);
verticalLayout->setSpacing(6);
verticalLayout->setContentsMargins(11, 11, 11, 11);
verticalLayout->setObjectName(QStringLiteral("verticalLayout"));
verticalLayout->setContentsMargins(0, 0, 0, 0);
label = new QLabel(scrollAreaWidgetContents);
label->setObjectName(QStringLiteral("label"));
label->setPixmap(QPixmap(QString::fromUtf8("../../../Pictures/chuukarudoruhu.jpg")));
To copy to clipboard, switch view to plain text mode
Bookmarks